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

Re: Remove space added by completion



At 23:11 +0100 14 Feb 2014, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
zzapper wrote:

When you tab complete you get a trailing space for free which is mostly
what you want but is there a flag etc which can remove it?

See the -q, -r and -R options to compadd in the documentation.

I assume you don't want to disable it completely given that it is
"mostly what you want". You should actually find that it gets removed if
the next key you type is something that would imply the suffix wasn't
wanted. I can't think of an example with a space but typing space after
a / suffix from a completed directory will usually remove the trailing
/.

It might be useful to have a specific example of an unwanted space.

I don't know about the original poster, but one place where I often don't want a space after a completion is with git branch names, to make it easier to do commands like:

 # List commits in current branch but not in master
 git log master..
 # List commits from either branch which aren't in the other
 git log branch1...branch2

The completion for git already supports completing branches after those dots, but an unwanted space is automatically added after completing the first branch name.

Of course, I can't say for sure that I wouldn't get more annoyed by the space not being automatically added there in cases where I'm only going to be specifying a single branch.



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