File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 62
62
63
63
{% endif -%}
64
64
65
+ # Report common issues.
66
+ function __zoxide_doctor() {
67
+ {%- if hook == InitHook::None %}
68
+ return 0
69
+
70
+ {%- else %}
71
+ [[ ${_ZO_DOCTOR:-1} -ne 0 ]] || return 0
72
+ [[ ${PROMPT_COMMAND:=} != *'__zoxide_hook'* ]] || return 0
73
+
74
+ _ZO_DOCTOR=0
75
+ \builtin printf '%s\n' \
76
+ 'zoxide: detected a possible configuration issue.' \
77
+ 'Please ensure that zoxide is initialized right at the end of your shell configuration file (usually ~/.bashrc).' \
78
+ '' \
79
+ 'If the issue persists, consider filing an issue at:' \
80
+ 'https://github.com/ajeetdsouza/zoxide/issues' \
81
+ '' \
82
+ 'Disable this message by setting _ZO_DOCTOR=0.' \
83
+ '' >&2
84
+ {%- endif %}
85
+ }
86
+
65
87
{{ section }}
66
88
# When using zoxide with --no-cmd, alias these internal functions as desired.
67
89
#
@@ -70,6 +92,8 @@ __zoxide_z_prefix='z#'
70
92
71
93
# Jump to a directory using only keywords.
72
94
function __zoxide_z() {
95
+ __zoxide_doctor
96
+
73
97
# shellcheck disable=SC2199
74
98
if [[ $# -eq 0 ]]; then
75
99
__zoxide_cd ~
@@ -93,6 +117,7 @@ function __zoxide_z() {
93
117
94
118
# Jump to a directory using interactive search.
95
119
function __zoxide_zi() {
120
+ __zoxide_doctor
96
121
\builtin local result
97
122
result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${result}"
98
123
}
154
179
{%- endmatch %}
155
180
156
181
{{ section }}
157
- # To initialize zoxide, add this to your configuration (usually ~/.bashrc):
182
+ # To initialize zoxide, add this to your shell configuration file (usually ~/.bashrc):
158
183
#
159
184
# eval "$(zoxide init bash)"
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ function __zoxide_doctor() {
69
69
'Please ensure that zoxide is initialized right at the end of your shell configuration file (usually ~/.zshrc).' \
70
70
'' \
71
71
'If the issue persists, consider filing an issue at:' \
72
- 'https://github.com/ajeetdsouza/zoxide/issues. ' \
72
+ 'https://github.com/ajeetdsouza/zoxide/issues' \
73
73
'' \
74
74
'Disable this message by setting _ZO_DOCTOR=0.' \
75
75
'' >&2
You can’t perform that action at this time.
0 commit comments