Note that there are some explanatory texts on larger screens.

plurals
  1. POZSH auto-complete screws up command name
    text
    copied!<p>When I start doing tab auto-complete of a command, it keeps what I initally typed next to it and the command becomes unreadable. In the example below, I typed 'git che' and hit tab. Once I select 'checkout' the command prompt becomes 'git che git checkout'. The command still works and in my history it stores 'git checkout'. But its pretty annoying visually. Is there anyway to change this behavior. I tried this in 2 different terminal emulators, so I can confirm its ZSH and not the emulator. Thanks</p> <p><a href="https://imgur.com/XuLZl.png" rel="noreferrer">Screenshot</a></p> <p>EDIT:</p> <p>echo $ZSH_VERSION<br> 4.3.10</p> <p>It doesnt seem to happen with zsh -f. Though its hard to tell since the only autocomplete that works is directories. I'm using 'oh-my-zsh' with this custom theme:</p> <pre><code>autoload -U add-zsh-hook add-zsh-hook chpwd do_ls_on_chdir function do_ls_on_chdir() { ls; } function dirStack(){ OUT=''; NUM=1; for X in $(dirs | cut -d ' ' -f2-10); do OUT="$OUT$1%B$NUM:%b$1$X "; (( NUM=NUM+1 )) done echo $OUT; </code></pre> <p>}</p> <pre><code>ZSH_THEME_GIT_PROMPT_ADDED="" ZSH_THEME_GIT_PROMPT_MODIFIED="" ZSH_THEME_GIT_PROMPT_DELETED="" ZSH_THEME_GIT_PROMPT_RENAMED="" ZSH_THEME_GIT_PROMPT_UNMERGED="" ZSH_THEME_GIT_PROMPT_UNTRACKED="" ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[yellow]%}↑" ZSH_THEME_GIT_PROMPT_PREFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[red]%}✗" ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg_bold[green]%}✔" local user_color='blue' local back="${BG[237]}" test $UID -eq 0 &amp;&amp; user_color='red' PROMPT='$(dirStack $back) $back%B%!%b$back %{$fg_bold[$user_color]%}%~%{$reset_color%}'\ '$back $(git_prompt_status)%{$reset_color%}'\ '$back%{$fg_bold[magenta]%}$(git_prompt_info)%{$reset_color%}'\ '$back$(git_prompt_ahead)$reset_color'\ '$back%(!.#.&gt;)$reset_color ' PROMPT2='%{$fg[red]%}%_ %{$reset_color%}' PROMPT3='%{$fg[red]%}... %{$reset_color%}' RPROMPT='%(?..%{$fg_bold[red]%}exit %?%{$reset_color%})'\ ' %{$FG[186]%}(%D %*)%{$reset_color%}' </code></pre> <p>SOLUTION:</p> <p>NOTE: stackoverflow wont let me answer my own question since I asked it within the past 8 hours. I dont feel like waiting.</p> <p>So I figured it out. It turns out I wasnt properly escaping the ANSI color codes (I think). Everywhere I had $reset_color in my PROMPT variable, I changed that to %{$reset_color%} and it fixed it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload