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

Re: The removal of spaces after a tab-complete

On Dec 21,  8:32pm, David B Harris wrote:
} I'm finding some irritating behaviour with zsh that I can't seem to turn
} off. Specifically, after I make a completion, then hit "|" (that's a
} pipe), zsh deletes the space that was inserted after the tab-complete.

You can't turn it off.  You can only forcibly defeat it.  You can either
define your own completions with auto-suffix-removal disabled, for every
situation in which you don't want this to happen; or you can re-bind the
specific keys for which, when typed after a completion, it should not
happen.  The latter is probably easier:

    function self-insert-no-autoremove {
    zle -N self-insert-no-autoremove
    bindkey '|' self-insert-no-autoremove

The reasons why you can't turn it off are varied and in some instances
nearly lost in the mists of time, but it boils down to something like:
(1) it was automatically added, so it's not costing you keystrokes if
it automatically goes away again; (2) the absence of the space doesn't
matter to the syntax; (3) there are more cases where leaving the space
is wrong, than cases where removing it is wrong; so (4) if you really
want a space there, you can just type one yourself.

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