mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-30 14:24:16 +08:00
27228d83fe
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.
13 lines
339 B
Bash
13 lines
339 B
Bash
if [ $commands[fasd] ]; then # check if fasd is installed
|
|
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
|
|
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
|
|
fasd --init auto >| "$fasd_cache"
|
|
fi
|
|
source "$fasd_cache"
|
|
unset fasd_cache
|
|
|
|
alias v='f -e "$EDITOR"'
|
|
alias o='a -e xdg-open'
|
|
alias j='zz'
|
|
fi
|