NOCOR=${NOCOR:-0}
NOMENU=${NOMENU:-0}
NOPRECMD=${NOPRECMD:-0}
+COMMAND_NOT_FOUND=${COMMAND_NOT_FOUND:-0}
+GRML_ZSH_CNF_HANDLER=${GRML_ZSH_CNF_HANDLER:-/usr/share/command-not-found/command-not-found}
BATTERY=${BATTERY:-0}
GRMLSMALL_SPECIFIC=${GRMLSMALL_SPECIFIC:-1}
GRML_ALWAYS_LOAD_ALL=${GRML_ALWAYS_LOAD_ALL:-0}
}
# }}}
VCS_INFO_hg_get_data () { # {{{
- local hgbranch hgbase
+ local hgbranch hgbase file
hgbase=${vcs_comm[basedir]}
- hgbranch=$(< ${hgbase}/.hg/branch)
+
+ file="${hgbase}/.hg/branch"
+ if [[ -r ${file} ]] ; then
+ hgbranch=$(< ${file})
+ else
+ hgbranch='default'
+ fi
+
VCS_INFO_formats '' "${hgbranch}" "${hgbase}"
return 0
}
while [[ ${realbasedir} != '/' ]]; do
if [[ -n ${vcs_comm[detect_need_file]} ]] ; then
[[ -d ${basedir}/${dirname} ]] && \
- [[ -f ${basedir}/${dirname}/${vcs_comm[detect_need_file]} ]] && \
+ [[ -e ${basedir}/${dirname}/${vcs_comm[detect_need_file]} ]] && \
break
else
[[ -d ${basedir}/${dirname} ]] && break
# }}}
VCS_INFO_hg_detect() { #{{{
VCS_INFO_check_com hg || return 1
- vcs_comm[detect_need_file]=branch
+ vcs_comm[detect_need_file]=store
VCS_INFO_detect_by_dir '.hg'
return $?
}
# }}}
+# command not found handling {{{
+
+(( ${COMMAND_NOT_FOUND} == 1 )) &&
+function command_not_found_handler() {
+ setopt localoptions no_sh_wordsplit
+ if [[ -x ${GRML_ZSH_CNF_HANDLER} ]] ; then
+ ${GRML_ZSH_CNF_HANDLER} $1
+ fi
+ return 1
+}
+
+# }}}
+
# {{{ set prompt
if zrcautoload promptinit && promptinit 2>/dev/null ; then
promptinit # people should be able to use their favourite prompt
"NOTITLE=1 zsh" => disable setting the title of xterms without disabling
preexec() and precmd() completely
"BATTERY=1 zsh" => activate battery status (via acpi) on right side of prompt
+ "COMMAND_NOT_FOUND=1 zsh"
+ => Enable a handler if an external command was not found
+ The command called in the handler can be altered by setting
+ the GRML_ZSH_CNF_HANDLER variable, the default is:
+ "/usr/share/command-not-found/command-not-found"
A value greater than 0 is enables a feature; a value equal to zero
disables it. If you like one or the other of these settings, you can