jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
3.13k stars 109 forks source link

Cursor issues when using Tmux #190

Closed Stianhn closed 7 months ago

Stianhn commented 2 years ago

General information

When working outside of tmux the cursor works fine, showing an beam style cursor when in insert mode. But when Im working inside tmux it`s always showing a block cursor.

Alactritty MacOS 12.4 oh-my-zsh zsh 5.8.1 zvm 0.8.5

Basic examination

oopjot commented 2 years ago

Could you provide your .zshrc file? Please make sure you load all your plugins before sourcing oh-my-zsh.sh script.

poetaman commented 2 years ago

It works fine on my end, you might also want to report $ infocmp $TERM both inside and outside tmux. Most such issues have something to do with the settings of terminfo.

michal-cab commented 2 years ago

also have this issue and can't change cursor type - it is still nonblinking beam (normal mode) and nonblinking block (insert mode) also it is not working even if i am outside of tmux...

ubuntudtudio 21.04 / konsole 21.12.3 zsh 5.8.1 oh-my-zsh zvm 0.8.5

.zshrc:

#                                                                                                                                                                                                                                            
export PATH=$HOME/.local/bin:/usr/local/bin:$PATH                                                                                                                                                                                            

export ZSH="$HOME/.oh-my-zsh"                                                                                                                                                                                                                

ZSH_THEME="gallois"                                                                                                                                                                                                                          

#plugine before sourcing                                                                                                                                                                                                                     
plugins=(git zsh-vi-mode)                                                                                                                                                                                                                    

source $ZSH/oh-my-zsh.sh                                                                                                                                                                                                                     

 if [[ -n $SSH_CONNECTION ]]; then                                                                                                                                                                                                           
   export EDITOR='nvim'                                                                                                                                                                                                                      
 else                                                                                                                                                                                                                                        
   export EDITOR='nvim'                                                                                                                                                                                                                      
 fi                                                                                                                                                                                                                                          

autoload -Uz compinit                                                                                                                                                                                                                        

compinit                                                                                                                                                                                                                                     

zstyle ':completion:*' auto-description 'specify: %d'                                                                                                                                                                                        
zstyle ':completion:*' completer _expand _complete _correct _approximate                                                                                                                                                                     
zstyle ':completion:*' format 'Completing %d'                                                                                                                                                                                                
zstyle ':completion:*' group-name ''                                                                                                                                                                                                         
zstyle ':completion:*' menu select=2                                                                                                                                                                                                         
eval "$(dircolors -b)"                                                                                                                                                                                                                       
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}                                                                                                                                                                                
zstyle ':completion:*' list-colors ''                                                                                                                                                                                                        
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s                                                                                                                                                   
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'                                                                                                                                        
zstyle ':completion:*' menu select=long                                                                                                                                                                                                      
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s                                                                                                                                                           
zstyle ':completion:*' use-compctl false                                                                                                                                                                                                     
zstyle ':completion:*' verbose true                                                                                                                                                                                                          

zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'                                                                                                                                                             
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'                                                                                                                                                              

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

#restore alsamixer status                                                                                                                                                                                                                    
#stored with alsactl --file ~/.config/asound.state store                                                                                                                                                                                     
alsactl --file ~/.config/asound.state restore                                                                                                                                                                                                

check_tmux.sh

and in zsh-vi-mode i added:

ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_UNDERLINE                                                                                                                                                                                        
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK                                                                                                                                                                                            
ZVM_OPPEND_MODE_CURSOR=$ZVM_CURSOR_UNDERLINE 
RannyArcher commented 2 years ago

try this command: export VI_MODE_SET_CURSOR=true

if it works, add it to the zshrc

Stianhn commented 2 years ago

export VI_MODE_SET_CURSOR=true

That did not change anything for me.

fpotter commented 2 years ago

@Stianhn Are you running over mosh by chance? Apparently mosh doesn't respect the updated cursor: https://github.com/mobile-shell/mosh/issues/1084

gilitos92 commented 2 years ago

I had this same problem and it was because I installed the plugin with Brew, so most likely you have installed it with an external package manager too. Re-install/run through OhMyZsh (by cloning into $HOME/.oh-my-zsh/custom/plugins) and then add "zsh-vi-mode" into your .zshrc in the plugins section of OMZ. I don't know what does Tmux do on init that messes with the loading of the cursors of the plugin.

Hubro commented 1 year ago

I've installed zsh-vi-mode using Antigen in my .zshrc file, and the cursor modes work fine in tmux.

vcup commented 11 months ago

I've installed zsh-vi-mode using Antigen in my .zshrc file, and the cursor modes work fine in tmux.

I am also, but the cursor not work in vim, it always show a block. if i escape tmux then cursor showed normal in vim.