zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

Cursor issues when using Tmux

Open Stianhn opened this issue 2 years ago • 9 comments

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

  • [x] I have read through the README page
  • [x] I have the latest version of zsh-vi-mode
  • [x] I have tested with another terminal program

Stianhn avatar Aug 03 '22 11:08 Stianhn

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

oopjot avatar Aug 12 '22 09:08 oopjot

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.

poetaman avatar Aug 13 '22 23:08 poetaman

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 

michal-cab avatar Aug 24 '22 11:08 michal-cab

try this command: export VI_MODE_SET_CURSOR=true

if it works, add it to the zshrc

RannyArcher avatar Sep 12 '22 01:09 RannyArcher

export VI_MODE_SET_CURSOR=true

That did not change anything for me.

Stianhn avatar Sep 15 '22 10:09 Stianhn

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

fpotter avatar Sep 22 '22 05:09 fpotter

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.

gilitos92 avatar Sep 22 '22 15:09 gilitos92

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

Hubro avatar Jan 21 '23 12:01 Hubro

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.

vcup avatar Oct 17 '23 07:10 vcup