make location of file .important_commands configurable keeping backward compatibility
authorThilo Six <tech@xk2c.de>
Sat, 10 Oct 2015 13:32:36 +0000 (15:32 +0200)
committerFrank Terbeck <ft@grml.org>
Sun, 29 Jan 2017 20:59:03 +0000 (21:59 +0100)
doc/grmlzshrc.t2t
etc/zsh/zshrc

index eadf7ce..fafe2d3 100644 (file)
@@ -448,8 +448,9 @@ to: **'zsh: <repository name>'** 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 =
index 0bf68f8..7b04de8 100644 (file)
@@ -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