0
votes

When I use vim in putty I change my cursor in insert mode.

These are my settings:

putty:

  • cursor appearance: vertical line
  • terminal: xterm-256color

.zshrc
added this the get a block cursor on login:

echo -en "\e[=2c"

.vimrc

" Insert Mode -> normal cursor (line)
let &t_SI .= "\e[=1c"
" Normal Mode -> block cursor
let &t_EI .= "\e[=2c"

This works, but it doesn't when I use vim inside tmux.

I use this in my .tmux.conf:

set -g default-terminal "xterm-256color"

Here are my complete dotfiles: https://github.com/r03/dotfiles

Any idea how I can use the putty escape code in tmux?

This command should change my cursor inside tmux:

echo -en "\e[=1c"
echo -en "\e[=2c"

1
You might want to check out the Vi and Vim Stack Exchange for questions on Vim!filbranden

1 Answers

0
votes

The solution is this in .vimrc:

if exists('$TMUX')
    let &t_SI .= "\ePtmux;\e\e[=1c\e\\"
    let &t_EI .= "\ePtmux;\e\e[=2c\e\\"
 else
    let &t_SI .= "\e[=1c"
    let &t_EI .= "\e[=2c"
 endif