z tab complete adding an open quote #46

jgallen23 opened this Issue Feb 10, 2012 · 11 comments

4 participants


When I type z cod and then hit tab, I get this: [jga] ~: z "/Users/jga/code (notice the open quote, but not closing)


That's pretty weird and shouldn't be happening. Are you using bash or zsh?


Using bash


This happens on both my Mac and Ubuntu machines


I can't replicate this on either my mac or ubuntu machines. I wonder if there are any quotes or weird directory names in your ~/.z file that might somehow be causing this?

If you want, you can take a look at line 107 in z.sh, and change it from:

if( $1 ) print "\"" $1 "\""


if( $1 ) print $1

which should disable quoting of tab completed dirs entirely.


thanks, that fixed it


I am having the same issues here. I am using zsh and here is what happens (a bit different from @jgallen23):

➜ ~ z co[TAB]
➜ ~ z \"/Users/Jean/code

➜ ~ z git[TAB]
➜ ~ z \"/Users/Jean/code/github\" 

I have to admit I'm kind of stumped about this issue. Looks like maybe zsh already treats completions as quoted? And I can't replicate the issue on bash.

The easy workaround for anyone affected is to remove the quoting in line 107 as described above, but I kind of hate that.

z tries to tab complete after treating all arguments as regex, so if you do, for example:

z co git[TAB]

it should look like:

z co "/Users/Jean/code/github"

as only the last argument is replaced after completion. So what I do is check if the last when you hit enter argument is a valid directory, and it it is, assume you tab-completed to there. And that will break on "directories with spaces" unless they are quoted correctly. Note, at that point, I'm ignoring the co argument...

Any ideas?


I have the same issue on Zsh:

z \"/Users/sorin/.tilde/dot/oh-my-zsh

At 222, you're quoting the completion again.


Good point, does removing the outer quotes in 222 work correctly? If so, can you test with a /directory with spaces


Actually, no, that didn't work, but if I remove the quotes at line 107, it works properly. Spaces are escaped.

z App[tab]
z /Users/sorin/Library/Application\ Support
@rupa rupa added a commit that closed this issue Apr 14, 2012
@rupa remove quotes from completions for now
closes #46
@rupa rupa closed this in 771c584 Apr 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment