Pure: Command is added twice to promt after hitting tab

Created on 10 Nov 2016  ·  30Comments  ·  Source: sindresorhus/pure

When I do the following:

❯ cd ~/P

and hit tab the result I get is this:

❯ cdcd ~/P
Pictures/  Projects@  Public/ 

It's also not possible to remove the first cd when using the backspace to clear the command.

it happens with every command that has multiple options when using tab completion.

Most helpful comment

I faced the same issue.
I had the following in my .zshrc
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8

When I added export LC_CTYPE=en_US.UTF-8, the issue went away.

All 30 comments

What's your zsh version and can you reproduce this with a minimal zshrc? If so, could you provide the zshrc that reproduces the issue?

❯ zsh --version
zsh 5.0.8 (x86_64-apple-darwin15.0)
❯ cacat ~/.zshrc 
source /Users/me/Projects/Github/antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle mafredri/zsh-async
antigen bundle sindresorhus/pure

# Tell antigen that you're done.
antigen apply

export PATH="./bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:$HOME/bin"

PATH="$PATH:$HOME/.composer/vendor/bin"
export XDEBUG_CONFIG="idekey=PHPSTORM"
export PHP_IDE_CONFIG="serverName=local"

source ~/.aliases

~/.aliases is just a long list of alias commands

Thanks, did you try without oh-my-zsh?

no, will try that now

When using bash or sh, it doesn't happen

Does it also happen without pure? Bash and sh won't be relevant to this issue (there's no pure for them) so you don't need to compare those.

Honestly I'm not sure what it could be, it seems like it's something unique to your environment. I was betting on some oh-my-zsh configuration (which is why I wondered if you tried without it). There's also the fact that oh-my-zsh has a theme named pure which can conflict if you try to activate it from oh-my-zsh.

I can't reproduce this issue (then again I'm not using oh-my-zsh).

I would recommend you upgrade your zsh though (e.g. through Homebrew), just in case (also, 5.2 has a lot of improvements over 5.0.8).

As soon as i turn pure of in my ~/.zshrc the problem is gone. I've updated both oh-my-zsh and zsh

Could it be antigen?

The issue gets worse as soon as I start a tmux session, tmux becomes unusable with pure :(

I've tried your exact setup, antigen with your .zshrc and cannot reproduce this issue.

So just to confirm, you're running the latest versions of pure and zsh-async? And your zsh --version is now 5.2?

If so, the only thing remaining as an unknown is your terminal program (e.g. is it Terminal, iTerm?) and ~/.aliases file.

Yes, pure and zsh-async are both at the latest version (commit). In fact I just forked pure and added my fork as a remote to the installed version to do some debugging of my own. It turns out that Hyper (the missing pice of your puzzle) doens't like the character. In my current pure.zsh file, all code is commented out, except the last line setting the PROMT variable. See the screenshot. When I change the character, the behavior is gone. (tmux is still a mess, but I think it's not related to pure)

image

seems to be a Hyper related issue, as the it works fine on other both iTerm als Terminal

Glad you found the issue. You could try changing the font in Hyper and see if that helps. I have tested Hyper myself and I do not experience this problem (tested on 0.8.1 and 0.8.3). Even with a clean hyper configuration I cannot reproduce.

Either way, closing this since it doesn't seem to be a pure issue. But feel free to post a fix, if you find one, so it can help others with a similar issue.

I'm also having this issue with everything updated. No custom settings or any plugins on Hyper. No custom font.

It's pretty annoying I can't seem to find why it does it. It doesn't happen in Terminal with same setup ✌️

@henrikdahl does it happen if you set PROMPT='> '? Not sure there's anything we can do here, seems like a Hyper issue. You could also try changing fonts.

@mafredri doesn't seem to be related to the font, tried 4 different fonts and the default one.

It appears to be directly related to the prompt symbol. Tried changing it to for example #and that fixes it. Tried a couple of similar unicode characters and they all had the same issue.

I think the one you guys picked is perfect however so I'd love to see it work ✌️

Works fine with >

skarmavbild 2017-01-12 kl 23 02 30

With

skarmavbild 2017-01-12 kl 23 03 40

How about PROMPT='❯ '? Pure symbol, but with no colors. What version of macOS do you have? And what does your .zshrc look like? Do you use a framework, e.g. oh-my-zsh, etc?

Still issue with just PROMPT='❯ ' sadly.

macOS 10.12.2

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin

source $(brew --prefix)/share/antigen/antigen.zsh

antigen bundle mafredri/zsh-async
antigen bundle sindresorhus/pure

antigen apply

Can't reproduce, sorry :-(.

Are you using Hyper 1.1.0?

Yeah 1.1.0. Np, I know how hard it is to debug from issues ✌️

If you get any ideas please let me know

Btw. Unlike the title of this issue suggest, I have to press tab until the new line with options comes for cd to bug. Did you try it like that?

One last though, have you tried closing hyper and wiping .hyper.js and .hyper_plugins, starting from scratch?

I'm fairly certain its a part of my setup. I've purchased the 2016 rMBP and cycled through 3 (2 returns) with Hyper and Pure, fresh install each time and they all had the same issue. Additionally my friend who I helped setup his Hyper + Pure also has the same issue.

It might just be a Hyper bug? It's still odd that you can't reproduce it.

Hmm, very weird indeed. Have you tried updating zsh through homebrew? You should have 5.2 on the system, but 5.3.1 is available.

skarmavbild 2017-01-12 kl 23 28 37

Which version are you running? I'll update ✌️

Well I'm running 5.3.1-dev-0 (HEAD-4fb4ce1) but it's pretty close to 5.3.1.

Still same issue 😓

Got the same issue.
_Pre-tab:_
image

_Post-tab:_
image

Using the Spaceship theme in Hyper using oh-my-zsh.

@0916174 this is not the issue tracker for the spaceship theme, you should report your issue there or at oh-my-zsh.

Oh, sorry about that. It was quite late, so I wasn’t paying attention properly.

I faced the same issue.
I had the following in my .zshrc
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8

When I added export LC_CTYPE=en_US.UTF-8, the issue went away.

Experiencing the same issue using macOS Catalina 10.15.4. As mentioned before, changing the LC_CTYPE to UTF-8 or just changing the Prompt Symbol to anything else, seems to work. So I'm assuming it's something around this specific character.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rawaludin picture rawaludin  ·  3Comments

parro-it picture parro-it  ·  10Comments

lezuber picture lezuber  ·  11Comments

erusev picture erusev  ·  4Comments

tyrollins picture tyrollins  ·  4Comments