Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _expand completer and hashed dirs



2009/9/21 Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>:
> Hey list,
>
> Some time back I started using the _expand completer in my setup.
> And so far I like it.
>
> However, with hashed directories, I got a little problem I cannot seem
> to fix. Suppose, I got the following:
>
> hash -d vim=${HOME}/.vim
>
> While this works fine:
>
>    % ls ~vi<tab>
>    % ls ~vim/
>
> This doesn't:
>
>    % ls ~vim<tab>
>    - all expansions -
>    /home/hawk/.vim
>    - original -
>    ~vim
>
> I would much rather like to get 'ls ~vim/' out of it.
> I've been playing with a number of styles, but they don't seem to
> have any impact on the situation.
>
> Here's a minimal zshrc, to reproduce what I'm seeing:
>
> [snip]
> bindkey -e
> hash -d vim=${HOME}/.vim
> autoload -Uz compinit
> compinit
> zstyle ':completion:*:descriptions' format "- %d -"
> zstyle ':completion:*' group-name ''
> zstyle ':completion:*' completer _expand _complete _ignored _approximate
> [snap]
>
> Does anybody have a clue as to how to cure this?

You could try putting _expand after _complete, but maybe you won't
like what it does with other constructs then. (I'm guessing you
rebound ^I to complete-word rather than expand-or-complete). If that
doesn't do what you want, I think you'd have to use two different
keybinds for completing and expanding.

ie something like
zstyle ':completion:most-recent-file:*' match-original both
zstyle ':completion:most-recent-file:*' file-sort modification
zstyle ':completion:most-recent-file:*' file-patterns '*:all\ files'
zstyle ':completion:most-recent-file:*' hidden all
zstyle ':completion:most-recent-file:*' completer _files
zle -C most-recent-file menu-complete _generic
bindkey "^N"      most-recent-file

but not _files and another name for the completer would probably make sense :).

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author