Commit 9814a552 authored by Frank Terbeck's avatar Frank Terbeck

cfg:ta: Put working-directory computation into its own function

parent d4ba7760
......@@ -2127,9 +2127,21 @@ if (( ${+functions[ta]} )); then
zstyle ':completion:*:*:ta:*:*' generate TA/candidates
# We can calculate the working directory of most candidate
# sessions, too:
zstyle -e ':fnc:ta:*' working-directory '
local dir=$HOME/src/prj/${session#d/}
test -d $dir && reply=$dir'
function TA/compute-working-directory () {
local dir
if [[ $session == d/grml ]]; then
dir=$HOME/src/grml
else
dir=$HOME/src/prj/${session#d/}
fi
if [[ -d $dir ]]; then
reply=$dir
else
reply=$HOME
fi
return 0
}
zstyle -e ':fnc:ta:*' working-directory TA/compute-working-directory
fi
else
zprintf 2 'Tmux utility "ta" is not in available, skipping setup.\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment