Closed araggohnxd closed 2 years ago
This is Windows Terminal, right?
Do you get the same garbage output if you run exec zsh
?
Please attach your .zshrc
and .zshenv
.
This is Windows Terminal, right?
Yes, it is.
Do you get the same garbage output if you run
exec zsh
?
No, only when opening a fresh terminal.
Please attach your
.zshrc
and.zshenv
.
# .zshrc
# Set shell options
setopt GLOB_DOTS
setopt NO_AUTO_MENU
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY
setopt IGNORE_EOF
# Environment variables
export GPG_TTY=$TTY
export VISUAL="nano"
export EDITOR="nano"
export MANPAGER="sh -c 'col -bx | bat -plman'"
export YSU_HARDCORE=1
if [[ "$(</proc/version)" == *[Mm]icrosoft* ]] 2>/dev/null; then
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
export LIBGL_ALWAYS_INDIRECT=1
fi
# zstyle ':z4h:' start-tmux no
zstyle ':z4h:' term-shell-integration yes
zstyle ':z4h:' prompt-at-bottom no
zstyle ':z4h:ssh-agent:' start yes
zstyle ':z4h:ssh-agent:' extra-args -t 20h
zstyle ':z4h:fzf-complete' recurse-dirs yes
# Additional Git repositories
z4h install marlonrichert/zsh-autocomplete || return
z4h install MichaelAquilina/zsh-you-should-use || return
z4h init || return
# Additional sources
z4h source marlonrichert/zsh-autocomplete/zsh-autocomplete.plugin.zsh
z4h source MichaelAquilina/zsh-you-should-use/you-should-use.plugin.zsh
z4h source $HOME/.zsh/aliases
z4h source $HOME/.zsh/functions
eval "$(zoxide init zsh)" # init z
# Key bindings
z4h bindkey z4h-backward-kill-word Ctrl+Backspace
z4h bindkey z4h-cd-back Alt+Left
z4h bindkey z4h-cd-forward Alt+Right
z4h bindkey z4h-cd-up Alt+Up
z4h bindkey z4h-cd-down Alt+Down
z4h bindkey z4h-eof Ctrl+D
z4h bindkey cls Ctrl+L
# Define named directories
[[ -z $z4h_win_home ]] || hash -d w=$z4h_win_home
# Set history file path
HISTFILE=$HOME/.zsh/.zsh_history
# .zshenv
if [ -n "${ZSH_VERSION-}" ]; then
: ${ZDOTDIR:=~}
setopt no_global_rcs
[[ -o no_interactive && -z "${Z4H_BOOTSTRAPPING-}" ]] && return
setopt no_rcs
unset Z4H_BOOTSTRAPPING
fi
Z4H_URL="https://raw.githubusercontent.com/romkatv/zsh4humans/v5"
: "${Z4H:=${XDG_CACHE_HOME:-$HOME/.zsh}/zsh4humans/v5}"
umask o-w
if [ ! -e "$Z4H"/z4h.zsh ]; then
mkdir -p -- "$Z4H" || return
>&2 printf '\033[33mz4h\033[0m: fetching \033[4mz4h.zsh\033[0m\n'
if command -v curl >/dev/null 2>&1; then
curl -fsSL -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
elif command -v wget >/dev/null 2>&1; then
wget -O- -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
else
>&2 printf '\033[33mz4h\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
return 1
fi
mv -- "$Z4H"/z4h.zsh.$$ "$Z4H"/z4h.zsh || return
fi
. "$Z4H"/z4h.zsh || return
setopt rcs
What happens if you remove all of your manual changes?
Well, I didn't really keep track of what it looked like before, but ever since I commented the zstyle ':z4h:' start-tmux no
line I got this problem. In fact, initially, it had my prompt always at bottom, which I don't particularly like, but it didn't had this issue. It started once I disabled it. With prompt at bottom enabled, you can also see those characters pop up, but they are quickly cleared as the prompt is redrawn.
You can run z4h installer again to get pristine .zshrc
and .zshenv
. It'll backup your rc files, so they won't be lost. After that remove start-tmux
, add zstyle ':z4h:' prompt-at-bottom no
at the top of .zshrc
and check whether the problem disappears.
By the way, prompt at the bottom is better even if unusual. With the conventional setup prompt starts at the top and gradually descends to the bottom as you are executing commands. Once it gets to the bottom it stays there. With prompt-at-bottom
set to yes
prompt appears at the bottom from the get go. This makes it easier to find prompt (it's always at the bottom!) and to position your terminal window(s) so that it's most convenient for you to look at the prompt and the output of the last command.
This is just a tangent. There is obviously some problem somewhere that causes junk output.
You can run z4h installer again to get pristine
.zshrc
and.zshenv
. It'll backup your rc files, so they won't be lost. After that removestart-tmux
, addzstyle ':z4h:' prompt-at-bottom no
at the top of.zshrc
and check whether the problem disappears.
Oddly enough, it didn't fix it, but I did realize something. In my first z4h installation, I answered no as to wether I wanted tmux to be installed, so I guess I was running the integrated version. This time I accepted it, and apparently the line zstyle ':z4h:' start-tmux command tmux -u new -A -D -t z4h
fixed the problem. If I delete it, the problem persists, though.
By the way, prompt at the bottom is better even if unusual.
I may give it another try, I'm just so used to spam Ctrl+L at this point xD
Can you post .zshrc
and .zshenv
once again? I need the version that exhibits the problem and deviates as little as possible from the default files. Also attach your .p10k.zsh
. It's best if you attach them as files (you might need to rename them to *.txt
to please github).
Surely. The only modifications made from the original installation were disabling prompt at bottom and commenting the tmux line. And the only way I could attach them was by renaming them to .txt. Sorry! p10k.txt zshenv.txt zshrc.txt
Ok, now I'm deeply confused. Apparently, my fresh installation of z4h didn't even started tmux. that's why it "fixed" my problem. Once I commented the zstyle ':z4h:' start-tmux command tmux -u new -A -D -t z4h
line, then it actually started tmux, as my prompt got fixed in the bottom of the terminal. I don't understand what is happening.
That line instructs z4h to auto-start tmux if you have it. I guess you don't have it, so z4h does nothing.
If you comment out that line, you get integrated tmux (which is actually not tmux at all).
Now it makes sense, thanks. Nevertheless, integrated tmux still actually prints garbage in my terminal, even in my fresh z4h install, my bad for saying it was fixed.
Got it. I'll try to reproduce it with your configs once I get home. In the meantime could you check the version of Windows Terminal? Also, which Linux distribution are you using?
In the meantime could you check the version of Windows Terminal?
Version 1.15.2874.0.
Also, which Linux distribution are you using?
I use ArchWSL.
ArchWSL isn't something I can install on my dev machine (too risky for my taste). I'll try it first on Ubuntu. If that doesn't work (or rather if z4h works fine), we'll figure what to do.
I'll try it first on Ubuntu. If that doesn't work (or rather if z4h works fine), we'll figure what to do.
I didn't get around to doing this and it's unlikely I ever will.
That said, I use Ubuntu as my main OS and don't have this issue.
Closing because I don't intend to debug this further.
I figured it out. This issue in the official WSL repository discuss the problem I'm having, and this answer provides a simple and swift solution. Any chance of this modification being added to the default .tmux.conf
file provided by zsh4humans? It could potentially help other users experiencing the same issue.
I've made the change you suggested. Please run z4h update
and let me know if the issue is fixed on your end.
It surely is. Thank you so much for addressing it!
Thanks for doing all the work here!
I use z4h in my WSL2 setup, and basically every time I open a new terminal, these characters pop up in my command line for no apparent reason:
Putting the line
zstyle ':z4h:' start-tmux no
inside my.zshrc
fixes it, but I pretty much miss every feature that requires tmux, especially the fix for horrific mess when resizing terminal window.Having tmux enabled does not cause me any problem other than that, it's just that it kinda bothers me to clear my command line every time I startup my terminal.