[wd] v0.3.1: Improved completion and bug fixes

This commit is contained in:
Markus Faerevaag 2014-07-15 17:42:30 +02:00
commit 346f6b7d24
4 changed files with 114 additions and 92 deletions

View file

@ -5,23 +5,16 @@ zstyle ':completion::complete:wd:*:commands' group-name commands
zstyle ':completion::complete:wd:*:warp_points' group-name warp_points
zstyle ':completion::complete:wd::' list-grouped
# Call `_wd()` when when trying to complete the command `wd`
zmodload zsh/mapfile
function _wd() {
local ret=1
local CONFIG=$HOME/.warprc
# Stolen from
# http://stackoverflow.com/questions/9000698/completion-when-program-has-sub-commands
# local curcontext="$curcontext" state line
# typeset -A opt_args
local ret=1
local -a commands
local -a warp_points
warp_points=( "${(f)mapfile[$CONFIG]}" )
# LIST="${mapfile[$FNAME]}" # Not required unless stuff uses it
warp_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
commands=(
'add:Adds the current working directory to your warp points'