I've been using Zsh recently, and when I complete a file name within quotes, the completion adds a space after the completed file name. Interestingly, this does not occur when I complete directory names in quotes.

To illustrate (using an underscore to signify the cursor location):

$ mv ".xmod_"  --<TAB>--> $ mv ".Xmodmap _"

Preferably, I would like to have the following happen:

$ mv ".xmod_" --<TAB>--> $ mv ".Xmodmap" _

This seems like the most intuitive way to me, anyway. I just want to remove the space added between the completed file name and the ending quotation mark.

I did try searching for a solution to this, but I'm afraid my minimal knowledge of Zsh and the possible causes of this have not led me to a solution so far.

Update: Originally, I had this question as just relevant to the "mv" program, but I noticed that this behavior with the quotes seems to occur with all file completions (I only tried "cp" in addition).

Also, here is the modules section of my .zshrc, in case any might be causing this to happen:

autoload -U colors compinit promptinit select-word-style zkbd
select-word-style bash

Apart from this, and some other minor option settings, there isn't much else in my .zshrc.

  • Which version of zsh are you using? The intended behaviour seems to be the default in 5.0.5. Can you try if the behaviour persists if you start zsh with zsh -f? If it does I would assume a bug in your zsh, as I cannot thing of any use for this behaviour, else the problem resides in your configuration. – Adaephon Sep 2 '14 at 6:24
  • I'm using Zsh 5.0.5, and when I tried using zsh -f like you mentioned, the problem still occurs. – bitflips Sep 2 '14 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.