Solvedpowerlevel9k Character duplicate when using tab completion as root

I've seen reports of other people having this issue, but for me it's only as the root user. Tab completion isn't working properly as displayed in the below gif. I first use sudo -sE to preserve the user environment for root. Then I use sudo -i and show an additional problem with directory completion. I do have ZSH set as the SHELL for my root user and I have /root/.zshrc symlinked to my user's .zshrc (/home/andrew/.zshrc).

powerlevel9k_issue

Here is the entirety of my .zshrc file:

export ZSH=/home/andrew/.oh-my-zsh
ZSH_THEME="powerlevel9k/powerlevel9k"
source $ZSH/oh-my-zsh.sh

No customization at all. I've tried this with ZLE_RPROMPT_INDENT=0 in my .zshrc file and without. Same results.

I will say that I've noticed this issue seems to be with all powerline themes. I would LOVE it if you were able to nail down the issue as this is my favorite zsh theme!

43 Answers

✔️Accepted Answer

I have encountered the same problem on iTerm, and I've solved it.
The reason for the problem is ROOT_ICON, the emoji widths problem.
To solve it, just check Use Unicode version 9 widths in Preferences > Profiles > Text
image

Other Answers:

@iowelinux That did not fix it for me. Only disabling the root_indicator in the POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS variable fixes it for me. I have this line in my .zshrc:

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status background_jobs history time)

Related Issues:

28
powerlevel9k VSCode integrated terminal versus nerdfont-complete
Update At first it seemed like if I found a PowerLine font that was also enabled with nerd-fonts I c...
20
powerlevel9k Prompt with newline causes previous lines to be deleted when tab autocompleting
@bhilburn @jordanweaver I've got an update I've managed to get the issue to stop ...
11
powerlevel9k os_icon shows os as text
So POWERLEVEL9K_MODE='awesome-patched' stands before you source oh-my-zsh right? If so have you rest...
8
powerlevel9k Character duplicate when using tab completion as root
I have encountered the same problem on iTerm and I've solved it The reason for the problem is ROOT_I...
7
powerlevel9k Caching to speed up prompt generation
By the way for those of you who don't follow /r/zsh Powerlevel10k now works on all major platforms (...
29
vim devicons NERDTree: square brackets around icon on sourcing vimrc
Ah I think I know what this is Whenever I try to source ~/.vimrc file when NERDTree is open ...
574
terminal Typing inside of the default WSL terminal feels amazing, why is it better than every other app?
I really do not mind when someone comes by and decides to tell us that we're doing a good job at som...
294
ohmyzsh compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew
Per #9602 (comment) brew cleanup fixed it for me I am using Apple M1 When I added this line: export ...
264
tqdm Jupyterlab and tqdm_notebook
I confirm this problem on my environment but it is upstream so IMHO nothing can be done on tqdm Plea...
99
ohmyzsh how to enable username and hostname in the default theme?
In fact I finally found the solution for the problem I do want to stick with the default theme but I...
92
terminal Guide for build and installation
This information should be included in the Building the Code section of the README file. ...
87
ohmyzsh source ~/.zshrc error
@huangjihua @mcornella There are steps which helped me: zsh chsh -s $(which zsh) Logout from the sys...
86
alacritty Tmux austostart?
It should be like this: Which operating system does the issue occur on? MacOS Catalina I understood ...
85
terminal error 0x80070002 when launching `powershell.exe'
Just add the path of the power shell to the environment variable Thank you It works! %systemroot%\Sy...
84
ohmyzsh tab completion not working
For me there were no permission issues on my completion scripts so the above didn't fix my issue ...
78
alacritty Support for Alt+key (option as meta)
With latest alacritty and tmux I finally got forward and backward movement with the following: ...
76
termux app 403 forbidden while update or pkg Install
If someone facing the issue when you run pkg install ... Issue : when ever I try to update / upgrade...
75
gitsome Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7SrToZ/gitsome/
I had the same problem on OSX and Solve my issue (I have both python versions installed). ...
75
ohmyzsh Zsh is not installed! Please install zsh first!
Well zsh is not there so it must not be installed sudo apt install zsh will do. ...
71
bat Ubuntu install error when rg is installed also
As a workaround one can use sudo apt install -o Dpkg::Options::=--force-overwrite bat ripgrep (taken...
70
terminal Move the solution to VS2019 and v142 toolset
As mentioned in README (also related to #534) If you're running VS2019 ...
67
ohmyzsh rvm error after starting zsh
For me it is rm ~/.zcomp* I'm getting this error when opening new zshell: As suggested on other rela...
62
guake guake hangs when you put exit on the CLI and then choose No.
To whom hangs on Ubuntu 18.04 #1198 (comment) mentioned a solution: This works for me ...
58
ohmyzsh Warning: plugin cargo not found
Removing the comma at the end of git solved it for me thank you @mcornella ! Went from: to to fix it...
54
hyper Drag and drop does not work, in the terminal window anymore
guys I create a plugin for this: https://github.com/qweasd1/hyper-drop-file just hyper install hyper...
50
alacritty Alt-Left/Right and Home/End don't work and prevent alacritty from closing
@spacecowboy I added the following lines to support skipping words via Alt+Left and Alt+Right on mac...
47
tqdm How to update single progress bar in multiprocessing map()
from https://stackoverflow.com/questions/41920124/multiprocessing-use-tqdm-to-display-a-progress-bar...
44
guake Global shortcut does not work in gnome applications in ubuntu 17.10
@Woile @eN0Rm as a workaround you may disable the shortcut in the guake config and reassign it in th...
43
terminal MEGATHREAD: Breaking settings changes in version 0.11!
Out of curiosity BREAKING SETTINGS CHANGES IN 0.11 BREAKING CHANGE We've deleted a lot of legacy set...
42
ConEmu Arrow keys not working in Bash for Windows
@ErrantErinaceinae Are you kidding? Months??? The issue was created four days ago! This is absolutel...
42
terminal Windows Terminal keeps forgetting/can't find my default WSL Ubuntu profile
Happened to me (seemingly) after updating Docker for Windows Haven't had any issues with WSL2 for mo...
42
ohmyzsh Insecure completion-dependent directories detected on macOS Catalina
Put ZSH_DISABLE_COMPFIX=true in your ~/.zshrc Before source $ZSH/oh-my-zsh.sh ~/.zshrc ...
41
ohmyzsh _arguments:451: _vim_files: function definition file not found
I got it fixed by removing the .zcompdump file from my root directory and running exec zsh. ...
38
alacritty [Feature] Add setting to hide titlebar
PR #947 has been merged 2 months ago hiding the title-bar is now possible via: Like iTerm2 allows (P...
37
ConEmu Windows Subsystem For Linux Bash Specify Startup Directory
@NitroBAY Ops I made a mistake The Windows file system is mounted to Windows Subsystem For Linux(WSL...
37
terminal Terminal hangs on exit with 'process exited with code 127' message
@carragom Oh that explains it - closeOnExit is a Profile setting Hi! I've noticed that on newer rele...
34
termux app access from adb shell?
That's what I got so far (on my rooted phone): /data/data/com.termux/files/home/bin/termux-shell.sh ...
33
bat [fzf] Bat is awesome, but
It's so awesome but whyyyyy Whenever bat detects a non-interactive terminal it will fall back to pri...
31
kitty Error opening terminal: xterm-kitty
From stackoverflow: export TERM=xterm And it works. Any ideas how to fix this? This is a brand new M...
28
hyper Hyperterm fails to display symbols
termCSS: 'x-row {line-height: initial} .unicode-node {position: relative}' in config works well as t...
27
hyper Opening a new tab throws an uncaught exception
After taking some hints from the comments I removed the hypercwd plugin which seems to have solved t...
26
alacritty Font support for Oh-My-Zsh due to imperfect rendering
@kchibisov thank you for your patience and help It worked! After all it was nothing difficult ...
26
hyper Plugins not installing
I'm using Hyper 1.0.0 (64-bit) on Windows 10 I'm having issues getting plugins to install too Earlie...
24
terminal Alt arrow keys do nothing; key unbinding broken?
This behavior is due to #3585 Proper expected behavior is restored with the following: ...
24
ohmyzsh Got completions warning and command not found: compdef when tried to use omz on none root user
Set ZSH_DISABLE_COMPFIX=true in your zshrc file before oh-my-zsh.sh is sourced and update OMZ to the...
23
ConEmu WSL2 no longer working after windows update
Thank you This does indeed work You don't need to specify the user (the default one that corresponds...
23
hyper "Unable to start terminal process: CreateProcess failed" when opening new tab under WSL
Removing hypercwd plugin fixed this for me. EDIT: Noticed that this is a duplicate but still relevan...
22
alacritty w3mimgdisplay not working correctly
I guess that the only non-hacky way to make this working is to incorporate image preview functionali...
21
asciinema player asciinema-player with React
The player component is reagent component Hello Asciinema player has very strange behavior in my sma...
20
alacritty Auto copy
@unphased Can you try https://github.com/cathay4t/alacritty/tree/copy_selection on OSX? Just add sav...