ohmyzsh / ohmyzsh

🙃 A delightful community-driven (with 2,300+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.

Home Page:https://ohmyz.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command is printed before the output of said cmd

waikoo opened this issue · comments

Describe the bug

As seen in the screenshot, I write ls and before the actual output of ls, I also get the string ls. The Mint logo's top row is pushed back as many characters as the word neofetch takes up.
NOTE This only happens when outside of tmux. Inside tmux, I don't have this problem.

As an attempt to try to solve this, I:

  • tried disabling all the plugins (commenting them out from a module I have)
  • tried to revert the custom location of my zsh config from ~/.config/zsh/ to the root folder:
  1. I renamed my ~/.config/zsh to zsh_old
  2. I downloaded OMZ again
  3. I copied the contents of my old ~/.config/zsh/.zshrc over to ~/.zshrc
  4. As soon as I corrected the path to source ~/.oh-my-zsh/oh-my-zsh.sh, the duplication of commands started again.

Extra info:
I have my zsh config & the ohmyzsh folder in ~/.config/zsh/ and I source the .zshrc from there from my ~/.zshrc.

Steps to reproduce

The problem seems to arise as soon as I link oh-my-zsh.sh.

Expected behavior

Commands shouldn't be duplicated in the output before the actual output of the command.

Screenshots and recordings

cmd_duplication
cmd_duplication2

OS / Linux distribution

Linux Mint 21.3 Virginia

Zsh version

5.8.1

Terminal emulator

alacritty

If using WSL on Windows, which version of WSL

None

Additional context

When using tmux, this doesn't happen, it works as expected.

Which theme are you using? Is it still reproducible if you disable that one, and use robbyrussell one, for example?

I didn't have any theme set through $ZSH_THEME, I was using starship prompt.
I disabled starship, set ZSH_THEME="robbyrussell" the theme changed but the duplication of commands remained.

Could you share your zshrc? (and zshenv if applicable)

.zshenv:

. "$HOME/.cargo/env"

zshrc:

export LANG=en_US.utf8
# export ZSH=$HOME/.config/zsh/ohmyzsh
export ZDOTDIR=$HOME/.config/zsh
export ZCUSTOM=$ZDOTDIR/ohmyzsh/custom
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.config/zsh/ohmyzsh}/custom}/plugins/zsh-completions/src

autoload -U compinit && compinit

export FZF_TMUX_OPTS="-p"
export FZF_DEFAULT_OPTS="--height 60% \
--border sharp \
--pointer => \
--marker ++ \
-- preview 'bat --color=always --style=numbers --line-range :500 {}' 
"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"

HISTSIZE=500
HISTFILESIZE=500
BROWSER="brave"
EDITOR="nvim"
VISUAL="nvim"
TERM="tmux-256color"
ENABLE_CORRECTION="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
HIST_STAMPS="yyyy/mm/dd"

# Vim
bindkey -v
# set -o vi
bindkey -s "^Y" "sudo " 
setopt no_glob_complete
eval "$(zoxide init zsh)"

# Source oh-my-zsh
source ~/.config/zsh/ohmyzsh/oh-my-zsh.sh

# Source zsh files
source $ZCUSTOM/exports.zsh
source $ZCUSTOM/plugins.zsh
source $ZCUSTOM/aliases.zsh
source $ZCUSTOM/functions.zsh
source $ZCUSTOM/bulk.zsh
source $ZCUSTOM/zsh-interactive-cd.plugin.zsh
source /usr/share/doc/fzf/examples/completion.zsh
source /usr/share/doc/fzf/examples/key-bindings.zsh

# Completion - tab to see list of options - works without this:
zstyle ':completion:*' completer _extensions _complete _approximate
# black red green yellow blue magenta cyan white
# less_termcap[md]="${fg_bold[magenta]}"
# less_termcap[mb]="${fg_bold[yellow]}"
# Explicitly enable colors
ZLSCOLORS=$LS_COLORS:'di=1;93:' ; export ZLSCOLORS
export LESS_TERMCAP_se="%F{black}"

export LESS_TERMCAP_md="%F{black}"

source $ZDOTDIR/ohmyzsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.config/zsh/ohmyzsh/plugins/dirhistory/dirhistory.plugin.zsh
eval "$(starship init zsh)"

# bun completions
[ -s "/home/wixur/.bun/_bun" ] && source "/home/wixur/.bun/_bun"

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

You probably have a preexec function that leaks the command to the output. Can you run which -a $preexec_functions?

omz_termsupport_preexec () {
	[[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
	emulate -L zsh
	setopt extended_glob
	local -a cmdargs
	cmdargs=("${(z)2}")
	if [[ "${cmdargs[1]}" = fg ]]
	then
		local job_id jobspec="${cmdargs[2]#%}"
		case "$jobspec" in
			(<->) job_id=${jobspec}  ;;
			("" | % | +) job_id=${(k)jobstates[(r)*:+:*]}  ;;
			(-) job_id=${(k)jobstates[(r)*:-:*]}  ;;
			([?]*) job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]}  ;;
			(*) job_id=${(k)jobtexts[(r)${(Q)jobspec}*]}  ;;
		esac
		if [[ -n "${jobtexts[$job_id]}" ]]
		then
			1="${jobtexts[$job_id]}"
			2="${jobtexts[$job_id]}"
		fi
	fi
	local CMD="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}"
	local LINE="${2:gs/%/%%}"
	title "$CMD" "%100>...>${LINE}%<<"
}
_zsh_highlight_preexec_hook () {
	typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=
	typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=
}
prompt_starship_preexec () {
	__starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME
}

At a surface level precmd hooks look normal.

Can you run set -xv to enable trace logs, reproduce the issue, and then disable tracing again with set +xv? Then paste the trace logs of the entire process, and also provide the output of locale and locale -a.

output of set -xv:

set%                                                                                                                                           +_omz_async_request:1> local -i ret=0
+_omz_async_request:2> typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
+_omz_async_request:5> local handler
+omz_termsupport_precmd:1> [[ '' != true ]]
+omz_termsupport_precmd:2> title '%15<..<%~%<<' '%n@%m:%~'
+title:1> setopt localoptions nopromptsubst
+title:4> [[ -n '' ]]
+title:8> : '%n@%m:%~'
+title:10> case tmux-256color (cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* | foot* | contour*)
+title:10> case tmux-256color (screen* | tmux*)
+title:16> print -Pn '\ek%15\<..\<%~%\<\<\e\'
~+omz_termsupport_cwd:2> local URL_HOST URL_PATH
+omz_termsupport_cwd:3> URL_HOST=+omz_termsupport_cwd:3> omz_urlencode -P wexer
+omz_urlencode:1> emulate -L zsh
+omz_urlencode:2> local -a opts
+omz_urlencode:3> zparseopts -D -E -a opts r m P
+omz_urlencode:5> local in_str=wexer
+omz_urlencode:6> local url_str=''
+omz_urlencode:7> local spaces_as_plus
+omz_urlencode:8> [[ -z -P ]]
+omz_urlencode:9> local str=wexer
+omz_urlencode:12> local encoding=UTF-8
+omz_urlencode:13> local safe_encodings
+omz_urlencode:14> safe_encodings=( UTF-8 utf8 US-ASCII )
+omz_urlencode:15> [[ -z UTF-8 ]]
+omz_urlencode:26> local i byte ord LC_ALL=C
+omz_urlencode:27> export LC_ALL
+omz_urlencode:28> local reserved=';/?:@&=+$,'
+omz_urlencode:29> local mark='_.!~*()-'
+omz_urlencode:30> local dont_escape='[A-Za-z0-9'
+omz_urlencode:31> [[ -z '' ]]
+omz_urlencode:32> dont_escape+=';/?:@&=+$,'
+omz_urlencode:35> [[ -z '' ]]
+omz_urlencode:36> dont_escape+='_.!~*()-'
+omz_urlencode:38> dont_escape+=']'
+omz_urlencode:42> local url_str=''
+omz_urlencode:43> i = 1
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=w
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=w
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=e
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=e
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=x
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=x
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=e
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=e
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=r
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=r
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:59> echo -E wexer
+omz_termsupport_cwd:3> URL_HOST=wexer
+omz_termsupport_cwd:4> URL_PATH=+omz_termsupport_cwd:4> omz_urlencode -P /home/wixur
+omz_urlencode:1> emulate -L zsh
+omz_urlencode:2> local -a opts
+omz_urlencode:3> zparseopts -D -E -a opts r m P
+omz_urlencode:5> local in_str=/home/wixur
+omz_urlencode:6> local url_str=''
+omz_urlencode:7> local spaces_as_plus
+omz_urlencode:8> [[ -z -P ]]
+omz_urlencode:9> local str=/home/wixur
+omz_urlencode:12> local encoding=UTF-8
+omz_urlencode:13> local safe_encodings
+omz_urlencode:14> safe_encodings=( UTF-8 utf8 US-ASCII )
+omz_urlencode:15> [[ -z UTF-8 ]]
+omz_urlencode:26> local i byte ord LC_ALL=C
+omz_urlencode:27> export LC_ALL
+omz_urlencode:28> local reserved=';/?:@&=+$,'
+omz_urlencode:29> local mark='_.!~*()-'
+omz_urlencode:30> local dont_escape='[A-Za-z0-9'
+omz_urlencode:31> [[ -z '' ]]
+omz_urlencode:32> dont_escape+=';/?:@&=+$,'
+omz_urlencode:35> [[ -z '' ]]
+omz_urlencode:36> dont_escape+='_.!~*()-'
+omz_urlencode:38> dont_escape+=']'
+omz_urlencode:42> local url_str=''
+omz_urlencode:43> i = 1
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=/
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=/
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=h
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=h
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=o
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=o
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=m
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=m
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=e
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=e
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=/
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=/
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=w
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=w
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=i
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=i
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=x
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=x
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=u
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=u
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=r
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=r
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:59> echo -E /home/wixur
+omz_termsupport_cwd:4> URL_PATH=/home/wixur
+omz_termsupport_cwd:7> [[ -z '' && -z '' ]]
+omz_termsupport_cwd:10> printf '\e]7;file://%s%s\e\' wexer /home/wixur
+_zsh_highlight_main__precmd_hook:3> setopt localoptions
+_zsh_highlight_main__precmd_hook:4> eval '[[ -o warnnestedvar ]]'
+(eval):1> [[ -o warnnestedvar ]]
+_zsh_highlight_main__precmd_hook:8> _zsh_highlight_main__command_type_cache=( )
+prompt_starship_precmd:2> STARSHIP_CMD_STATUS=0 STARSHIP_PIPE_STATUS=( 0 )
+prompt_starship_precmd:5> ((  1  ))
+prompt_starship_precmd:6> __starship_get_time
+__starship_get_time:1> ((  STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000))  ))
+prompt_starship_precmd:6> ((  STARSHIP_DURATION = STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME  ))
+prompt_starship_precmd:7> unset STARSHIP_START_TIME
+prompt_starship_precmd:15> STARSHIP_JOBS_COUNT=0
+/usr/bin/zsh:2> /usr/local/bin/starship prompt '--terminal-width=143' '--keymap=' '--status=0' '--pipestatus=0' '--cmd-duration=6' '--jobs=0'
+/usr/bin/zsh:2> /usr/local/bin/starship prompt --right '--terminal-width=143' '--keymap=' '--status=0' '--pipestatus=0' '--cmd-duration=6' '--jobs=0'

output of echo "duplication":

echo "duplication"
+omz_termsupport_preexec:1> [[ '' != true ]]
+omz_termsupport_preexec:3> emulate -L zsh
+omz_termsupport_preexec:4> setopt extended_glob
+omz_termsupport_preexec:7> local -a cmdargs
+omz_termsupport_preexec:8> cmdargs=( echo '"duplication"' )
+omz_termsupport_preexec:10> [[ echo = fg ]]
+omz_termsupport_preexec:44> local CMD=echo
+omz_termsupport_preexec:45> local LINE='echo "duplication"'
+omz_termsupport_preexec:47> title echo '%100>...>echo "duplication"%<<'
+title:1> setopt localoptions nopromptsubst
+title:4> [[ -n '' ]]
+title:8> : '%100>...>echo "duplication"%<<'
+title:10> case tmux-256color (cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* | foot* | contour*)
+title:10> case tmux-256color (screen* | tmux*)
+title:16> print -Pn '\ekecho\e\'
echo+_zsh_highlight_preexec_hook:2> typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=''
+_zsh_highlight_preexec_hook:3> typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=''
+prompt_starship_preexec:1> __starship_get_time
+__starship_get_time:1> ((  STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000))  ))
+prompt_starship_preexec:1> STARSHIP_START_TIME=1712771172103
+/usr/bin/zsh:2> echo duplication
duplication
+_omz_async_request:1> local -i ret=0
+_omz_async_request:2> typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
+_omz_async_request:5> local handler
+omz_termsupport_precmd:1> [[ '' != true ]]
+omz_termsupport_precmd:2> title '%15<..<%~%<<' '%n@%m:%~'
+title:1> setopt localoptions nopromptsubst
+title:4> [[ -n '' ]]
+title:8> : '%n@%m:%~'
+title:10> case tmux-256color (cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* | foot* | contour*)
+title:10> case tmux-256color (screen* | tmux*)
+title:16> print -Pn '\ek%15\<..\<%~%\<\<\e\'
~+omz_termsupport_cwd:2> local URL_HOST URL_PATH
+omz_termsupport_cwd:3> URL_HOST=+omz_termsupport_cwd:3> omz_urlencode -P wexer
+omz_urlencode:1> emulate -L zsh
+omz_urlencode:2> local -a opts
+omz_urlencode:3> zparseopts -D -E -a opts r m P
+omz_urlencode:5> local in_str=wexer
+omz_urlencode:6> local url_str=''
+omz_urlencode:7> local spaces_as_plus
+omz_urlencode:8> [[ -z -P ]]
+omz_urlencode:9> local str=wexer
+omz_urlencode:12> local encoding=UTF-8
+omz_urlencode:13> local safe_encodings
+omz_urlencode:14> safe_encodings=( UTF-8 utf8 US-ASCII )
+omz_urlencode:15> [[ -z UTF-8 ]]
+omz_urlencode:26> local i byte ord LC_ALL=C
+omz_urlencode:27> export LC_ALL
+omz_urlencode:28> local reserved=';/?:@&=+$,'
+omz_urlencode:29> local mark='_.!~*()-'
+omz_urlencode:30> local dont_escape='[A-Za-z0-9'
+omz_urlencode:31> [[ -z '' ]]
+omz_urlencode:32> dont_escape+=';/?:@&=+$,'
+omz_urlencode:35> [[ -z '' ]]
+omz_urlencode:36> dont_escape+='_.!~*()-'
+omz_urlencode:38> dont_escape+=']'
+omz_urlencode:42> local url_str=''
+omz_urlencode:43> i = 1
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=w
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=w
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=e
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=e
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=x
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=x
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=e
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=e
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:44> byte=r
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=r
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 5
+omz_urlencode:59> echo -E wexer
+omz_termsupport_cwd:3> URL_HOST=wexer
+omz_termsupport_cwd:4> URL_PATH=+omz_termsupport_cwd:4> omz_urlencode -P /home/wixur
+omz_urlencode:1> emulate -L zsh
+omz_urlencode:2> local -a opts
+omz_urlencode:3> zparseopts -D -E -a opts r m P
+omz_urlencode:5> local in_str=/home/wixur
+omz_urlencode:6> local url_str=''
+omz_urlencode:7> local spaces_as_plus
+omz_urlencode:8> [[ -z -P ]]
+omz_urlencode:9> local str=/home/wixur
+omz_urlencode:12> local encoding=UTF-8
+omz_urlencode:13> local safe_encodings
+omz_urlencode:14> safe_encodings=( UTF-8 utf8 US-ASCII )
+omz_urlencode:15> [[ -z UTF-8 ]]
+omz_urlencode:26> local i byte ord LC_ALL=C
+omz_urlencode:27> export LC_ALL
+omz_urlencode:28> local reserved=';/?:@&=+$,'
+omz_urlencode:29> local mark='_.!~*()-'
+omz_urlencode:30> local dont_escape='[A-Za-z0-9'
+omz_urlencode:31> [[ -z '' ]]
+omz_urlencode:32> dont_escape+=';/?:@&=+$,'
+omz_urlencode:35> [[ -z '' ]]
+omz_urlencode:36> dont_escape+='_.!~*()-'
+omz_urlencode:38> dont_escape+=']'
+omz_urlencode:42> local url_str=''
+omz_urlencode:43> i = 1
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=/
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=/
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=h
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=h
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=o
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=o
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=m
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=m
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=e
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=e
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=/
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=/
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=w
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=w
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=i
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=i
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=x
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=x
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=u
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=u
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:44> byte=r
+omz_urlencode:45> [[ "$byte" -regex-match "$dont_escape" ]]
+omz_urlencode:46> url_str+=r
+omz_urlencode:43> ++i
+omz_urlencode:43> i <= 11
+omz_urlencode:59> echo -E /home/wixur
+omz_termsupport_cwd:4> URL_PATH=/home/wixur
+omz_termsupport_cwd:7> [[ -z '' && -z '' ]]
+omz_termsupport_cwd:10> printf '\e]7;file://%s%s\e\' wexer /home/wixur
+_zsh_highlight_main__precmd_hook:3> setopt localoptions
+_zsh_highlight_main__precmd_hook:4> eval '[[ -o warnnestedvar ]]'
+(eval):1> [[ -o warnnestedvar ]]
+_zsh_highlight_main__precmd_hook:8> _zsh_highlight_main__command_type_cache=( )
+prompt_starship_precmd:2> STARSHIP_CMD_STATUS=0 STARSHIP_PIPE_STATUS=( 0 )
+prompt_starship_precmd:5> ((  1  ))
+prompt_starship_precmd:6> __starship_get_time
+__starship_get_time:1> ((  STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000))  ))
+prompt_starship_precmd:6> ((  STARSHIP_DURATION = STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME  ))
+prompt_starship_precmd:7> unset STARSHIP_START_TIME
+prompt_starship_precmd:15> STARSHIP_JOBS_COUNT=0
+/usr/bin/zsh:3> /usr/local/bin/starship prompt '--terminal-width=143' '--keymap=' '--status=0' '--pipestatus=0' '--cmd-duration=7' '--jobs=0'
+/usr/bin/zsh:3> /usr/local/bin/starship prompt --right '--terminal-width=143' '--keymap=' '--status=0' '--pipestatus=0' '--cmd-duration=7' '--jobs=0'

output of set +xv:

set +xv
+omz_termsupport_preexec:1> [[ '' != true ]]
+omz_termsupport_preexec:3> emulate -L zsh
+omz_termsupport_preexec:4> setopt extended_glob
+omz_termsupport_preexec:7> local -a cmdargs
+omz_termsupport_preexec:8> cmdargs=( set +xv )
+omz_termsupport_preexec:10> [[ set = fg ]]
+omz_termsupport_preexec:44> local CMD=set
+omz_termsupport_preexec:45> local LINE='set +xv'
+omz_termsupport_preexec:47> title set '%100>...>set +xv%<<'
+title:1> setopt localoptions nopromptsubst
+title:4> [[ -n '' ]]
+title:8> : '%100>...>set +xv%<<'
+title:10> case tmux-256color (cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* | foot* | contour*)
+title:10> case tmux-256color (screen* | tmux*)
+title:16> print -Pn '\ekset\e\'
set+_zsh_highlight_preexec_hook:2> typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=''
+_zsh_highlight_preexec_hook:3> typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=''
+prompt_starship_preexec:1> __starship_get_time
+__starship_get_time:1> ((  STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000))  ))
+prompt_starship_preexec:1> STARSHIP_START_TIME=1712771183067
+/usr/bin/zsh:3> set +xv

output of locale:

localeLANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=ro_RO.UTF-8
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=ro_RO.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=ro_RO.UTF-8
LC_NAME=ro_RO.UTF-8
LC_ADDRESS=ro_RO.UTF-8
LC_TELEPHONE=ro_RO.UTF-8
LC_MEASUREMENT=ro_RO.UTF-8
LC_IDENTIFICATION=ro_RO.UTF-8
LC_ALL=

output of locale -a:

localeC
C.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
ro_RO.utf8

OK nice, we found the issue:

echo "duplication"
+omz_termsupport_preexec:1> [[ '' != true ]]
+omz_termsupport_preexec:3> emulate -L zsh
+omz_termsupport_preexec:4> setopt extended_glob
+omz_termsupport_preexec:7> local -a cmdargs
+omz_termsupport_preexec:8> cmdargs=( echo '"duplication"' )
+omz_termsupport_preexec:10> [[ echo = fg ]]
+omz_termsupport_preexec:44> local CMD=echo
+omz_termsupport_preexec:45> local LINE='echo "duplication"'
+omz_termsupport_preexec:47> title echo '%100>...>echo "duplication"%<<'
+title:1> setopt localoptions nopromptsubst
+title:4> [[ -n '' ]]
+title:8> : '%100>...>echo "duplication"%<<'
+title:10> case tmux-256color (cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* | foot* | contour*)
+title:10> case tmux-256color (screen* | tmux*)
+title:16> print -Pn '\ekecho\e\'
echo
+_zsh_highlight_preexec_hook:2> typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=''
+_zsh_highlight_preexec_hook:3> typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=''
+prompt_starship_preexec:1> __starship_get_time
+__starship_get_time:1> ((  STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000))  ))
+prompt_starship_preexec:1> STARSHIP_START_TIME=1712771172103
+/usr/bin/zsh:2> echo duplication
duplication

Above we see that this happens on the title function, which is supposed to print the command on the terminal tab, varying the sequence based on the value of $TERM or $TERM_PROGRAM.

Since you have set TERM=tmux-256color when not inside tmux, the sequence gets printed to the terminal, and not on the tmux panel tab as it should.

Changing the value of TERM outside of tmux will fix it.

Awesome, thanks a lot @mcornella & @carlosala !!!