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).


Here is the entirety of my .zshrc file:

export ZSH=/home/andrew/.oh-my-zsh
source $ZSH/

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

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:

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...
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 ...
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...
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...
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 (...
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 ...
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...
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 ...
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...
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...
terminal Guide for build and installation
This information should be included in the Building the Code section of the README file. ...
ohmyzsh source ~/.zshrc error
@huangjihua @mcornella There are steps which helped me: zsh chsh -s $(which zsh) Logout from the sys...
alacritty Tmux austostart?
It should be like this: Which operating system does the issue occur on? MacOS Catalina I understood ...
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...
ohmyzsh tab completion not working
For me there were no permission issues on my completion scripts so the above didn't fix my issue ...
alacritty Support for Alt+key (option as meta)
With latest alacritty and tmux I finally got forward and backward movement with the following: ...
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...
gitsome Command "python 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). ...
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. ...
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...
terminal Move the solution to VS2019 and v142 toolset
As mentioned in README (also related to #534) If you're running VS2019 ...
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...
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 ...
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...
hyper Drag and drop does not work, in the terminal window anymore
guys I create a plugin for this: just hyper install hyper...
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...
tqdm How to update single progress bar in multiprocessing map()
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...
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...
ConEmu Arrow keys not working in Bash for Windows
@ErrantErinaceinae Are you kidding? Months??? The issue was created four days ago! This is absolutel...
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...
ohmyzsh Insecure completion-dependent directories detected on macOS Catalina
Put ZSH_DISABLE_COMPFIX=true in your ~/.zshrc Before source $ZSH/ ~/.zshrc ...
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. ...
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...
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...
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...
termux app access from adb shell?
That's what I got so far (on my rooted phone): /data/data/com.termux/files/home/bin/ ...
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...
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...
hyper Hyperterm fails to display symbols
termCSS: 'x-row {line-height: initial} .unicode-node {position: relative}' in config works well as t...
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...
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 ...
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...
terminal Alt arrow keys do nothing; key unbinding broken?
This behavior is due to #3585 Proper expected behavior is restored with the following: ...
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 is sourced and update OMZ to the...
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...
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...
alacritty w3mimgdisplay not working correctly
I guess that the only non-hacky way to make this working is to incorporate image preview functionali...
asciinema player asciinema-player with React
The player component is reagent component Hello Asciinema player has very strange behavior in my sma...
alacritty Auto copy
@unphased Can you try on OSX? Just add sav...