27228d83fe403cf664c0c8626a3874ed3989d084

Author
Michael Morgan <morgan.michael@me.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

fasd: update `v` alias to evaluate $EDITOR lazily (#7900)

For the `v` alias to work in its current state, the environment variable
EDITOR must already be defined by the time `source $ZSH/oh-my-zsh.sh`
happens. However, in the included zshrc template, EDITOR is set from
within the "User configuration" section, which begins immediately after
the above line. This means that, unless the user knows to move their
`export EDITOR` statements, EDITOR will be undefined when fasd.plugin.zsh
loads, and therefore the alias will have the value 'f -e ""', preventing
it from functioning.

With this change, `"$EDITOR"` will be evaluated each time the alias is
invoked, instead of just once when the alias is created. This allows for
EDITOR to be set from "User configuration" in the zshrc, and has the
additional flexibility of allowing a user to specify a different EDITOR
for a single session or invocation of the alias.

Diff

 1diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
 2index 36a0428a7dc58be5ed4ebaf3dfbb71279bff6f34..ec2e5183a8347c5d33c74fac81c26c4b8201bf15 100644
 3--- a/plugins/fasd/fasd.plugin.zsh
 4+++ b/plugins/fasd/fasd.plugin.zsh
 5@@ -6,7 +6,7 @@ if [ $commands[fasd] ]; then # check if fasd is installed
 6   source "$fasd_cache"
 7   unset fasd_cache
 8 
 9-  alias v="f -e \"$EDITOR\""
10+  alias v='f -e "$EDITOR"'
11   alias o='a -e xdg-open'
12   alias j='zz'
13 fi