Neovim: Cursor shape not reflecting normal/insert mode changes state in tmux

Created on 9 Jun 2016  路  3Comments  路  Source: neovim/neovim

  • nvim --version:

%> nvim --version
NVIM 0.1.4
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/build/config -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/src -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include/luajit-2.0 -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/deps-build/usr/include -I/usr/local/opt/gettext/include -I/usr/include -I/usr/include -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/build/src/nvim/auto -I/tmp/neovim-20160524-59321-t0e87f/neovim-0.1.4/build/include
Compiled by [email protected]

Optional features included (+) or not (-): +acl +iconv +jemalloc
For differences from Vim, see :help vim-differences

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.1.4/share/nvim"

  • Vim (version: ) behaves differently? - yes

vim does not have the problem asn works as expected.

%> /usr/bin/vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 5 2016 14:53:37)
Compiled by [email protected]
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses

  • Operating system/version:

Darwin tmac.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64 i386 MacBookPro11,3 Darwin

  • Terminal name/version:
    iterm2 3.0.0
  • $TERM:
    screen-256color

Actual behaviour

When running under tmux, changing from normal mode to insert mode does not change the cursor shape.
I am using NVIM_TUI_ENABLE_CURSOR_SHAPE=1

Expected behaviour

Changing from normal mode to insert mode should change the cursor shape form a block to a bar.

It does work outside of tmux.

I have:

if exists('$TMUX')
let &t_SI = "Ptmux;]50;CursorShape=1\x7\"
let &t_EI = "Ptmux;]50;CursorShape=0\x7\"
else
let &t_SI = "]50;CursorShape=1\x7"
let &t_EI = "]50;CursorShape=0\x7"
endif

in my .vimrc

Steps to reproduce using nvim -u NORC

tmux attach
nvim -u NORC
press 'i' to insert, cursor remains a block instead of changing to a bar.

documentation

Most helpful comment

Adding this to my .tmux.conf does fix it:

set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'

However it'd be great if I didn't have to search through resloved PRs to find this https://github.com/neovim/neovim/pull/3165

Can a tmux section be added to the install docs?

All 3 comments

Adding this to my .tmux.conf does fix it:

set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'

However it'd be great if I didn't have to search through resloved PRs to find this https://github.com/neovim/neovim/pull/3165

Can a tmux section be added to the install docs?

Closing as I have a fix. Hopefully this is easier to find than https://github.com/neovim/neovim/pull/3165

@bedge Thanks for followup. Added to FAQ: https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreicristianpetcu picture andreicristianpetcu  路  3Comments

jdowd picture jdowd  路  3Comments

pencilcheck picture pencilcheck  路  3Comments

davidgranstrom picture davidgranstrom  路  3Comments

amiryal picture amiryal  路  3Comments