romkatv / zsh4humans

A turnkey configuration for Zsh
MIT License
1.81k stars 116 forks source link

Shell integration "yes" causing terminal in nvim in tmux output mess content. #247

Closed towry closed 1 year ago

towry commented 1 year ago

I have this shell integration option set to "yes", and in the following steps:

  1. open kitty
  2. tmux new -s test
  3. nvim
  4. open the nvim terminal

You can see mess content:

截屏2022-12-07 12 31 35

If i set the option to "no", the mess content is gone, but fzf command history will causing mess content: 截屏2022-12-07 12 36 55

This is the output after I selected 'ls' command from the fzf command history completion.

towry commented 1 year ago

Seems I have to explicitly put zstyle ':z4h:' start-tmux no, now the $TERM variable is not 'tmux-256color' anymore which I think is correct.

towry commented 1 year ago

I am using below to disable shell integration in nvim terminal:

# .zshrc

if [ -n "$NVIM" ]; then
# disable shell integration
else
# enable
fi

For the fzf display issue, i don't know. what to do, maybe live with it for now. I think it's fzf issue.

edshamis commented 1 year ago

I am using below to disable shell integration in nvim terminal:

if [ -n "$NVIM" ]; then
# disable 
else
# enable
fi

For the fzf display issue, i don't know. what to do, maybe live with it for now. @towry Where does $NVIM come from?

towry commented 1 year ago

@edshamis

https://neovim.io/doc/user/deprecated.html

search "$NVIM"

edshamis commented 1 year ago

I had the same issue. Thanks for the solution. Btw you can do it with one line:

[[ -z $NVIM ]] && zstyle ':z4h:' term-shell-integration 'yes'

@romkatv I wonder if it's a proper way to solve the issue and it has no drawbacks

romkatv commented 1 year ago

This would be a bug in nvim: it's not discarding unrecognized CSI sequences. I cannot reproduce this with nvim v0.4.3 though. Which version are you using?

I've pushed a commit that disables terminal integration in shells that run under nvim. Please run z4h update, then close all shells, start a new one, and verify that it works.

towry commented 1 year ago

Just updated z4h and the issue in first picture is gone.

romkatv commented 1 year ago

Thanks for verifying.