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

Re: Completion question



2011/6/7  <meino.cramer@xxxxxx>:
>>mpla/home/me/data/subdira/subdirb/The Long and winding commandline.wav
>     ^
>
> If I press TAB now, nothing happens, since zsh seems to take the
> whole commandline into account while searching for a possible
> completion. And of course
> "mpla/home/me/data/subdira/subdirb/The Long and winding commandline.wav"
> is not know as a command on my system... ;)
>
> Is it possible to configure zsh to only take the string from the
> beginning up to the position of the cursor into account for the
> completion processing ?

Maybe a stupid answer, but you just have to add a space for the
completion to work as expected, ie:

“mpla /home/me/data/subdira/subdirb/The Long and winding commandline.wav”

…with the cursor just after “mpla”.

Since it's something you probably do often (at least I do), you may
want to automatize:

cmdit() {
  LBUFFER=' '$LBUFFER
  zle beginning-of-line
}
zle -N cmdit
bindkey WHATEVERKEYYOUWANT cmdit

I personally have a set of programs I often add at the beginning of a
line (sudo, dist, archive extractor, gdb, valgrind…), now¹ I only have
to type something like :
 M-x s for sudo
 M-x g for gdb
 M-x v for valgrind
…

The cursor does not move, so I can add additional parameters at the
end, if needed.

Best regards,

¹ https://github.com/Arkanosis/Arkonf/blob/master/zsh/.zsh/prefix

-- 
Jérémie



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