From cedfc98d894d4c53123046ef4c1ca65135f9f9a4 Mon Sep 17 00:00:00 2001 From: Thilo Six Date: Sat, 10 Oct 2015 15:32:36 +0200 Subject: [PATCH] make location of file .important_commands configurable keeping backward compatibility --- doc/grmlzshrc.t2t | 5 +++-- etc/zsh/zshrc | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/grmlzshrc.t2t b/doc/grmlzshrc.t2t index eadf7ce..fafe2d3 100644 --- a/doc/grmlzshrc.t2t +++ b/doc/grmlzshrc.t2t @@ -448,8 +448,9 @@ to: **'zsh: '** via zsh's vcs_info. == PERSISTENT HISTORY == If you got commands you consider important enough to be included in every -shell's history, you can put them into ~/.important_commands and they will be -available via the usual history lookup widgets. +shell's history, you can put them into $GRML_IMPORTANT_COMMANDS (which defaults +for backward compatibility to ~/.important_commands) and they will be available +via the usual history lookup widgets. = REFERENCE = diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 0bf68f8..7b04de8 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3133,10 +3133,14 @@ for var in BLUE RED GREEN CYAN YELLOW MAGENTA WHITE ; unset $var builtin unset -v var # "persistent history" -# just write important commands you always need to ~/.important_commands +# just write important commands you always need to $GRML_IMPORTANT_COMMANDS +# defaults for backward compatibility to ~/.important_commands if [[ -r ~/.important_commands ]] ; then - fc -R ~/.important_commands + GRML_IMPORTANT_COMMANDS=~/.important_commands +else + GRML_IMPORTANT_COMMANDS=${GRML_IMPORTANT_COMMANDS:-${ZDOTDIR:-${HOME}}/.important_commands} fi +[[ -r ${GRML_IMPORTANT_COMMANDS} ]] && builtin fc -R ${GRML_IMPORTANT_COMMANDS} # load the lookup subsystem if it's available on the system zrcautoload lookupinit && lookupinit -- 2.1.4