My Neovim cursor normally switches to a pipe symbol (|) when I'm in st, but it doesn't when tmux is open in st. Is there something special to do?


Neovim: v0.5.0-dev
Tmux: 2.9a

My config files:

I'm not very experienced with these three programs, so if you need more information feel free to ask me!

2 Answers 2


You need to tell Tmux how to translate the control sequences sent by Nvim to the outer terminal, here st.

This is done by setting the unofficial extensions to terminfo Ss and Se. From man tmux:

Ss, Se  Set or reset the cursor style.  If set, a sequence such as this
        may be used to change the cursor to an underline:

              $ printf '\033[4 q'

        If Se is not set, Ss with argument 0 will be used to reset the
        cursor style instead.

See also :h tui-cursor-tmux.

The Nvim documentation suggests this setting:

set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'

But it seems to contain 2 errors. First terminal-overrides is not a session option anymore, but a server option. So the -g flag is useless; instead you should pass the -s flag to set-option. Although, in practice, it should not matter because Tmux is able to infer the type of an option from its name (except if it's a user option).

Second, the control sequence \E[ q doesn't seem to match the Se capability of st, nor the one of xterm. At least on my machine, Se contains the sequence \E[2 q. You can check on yours by running the shell command:

$ infocmp -1x | grep Se

All in all, you could try to add this line to your tmux.conf:

set -as terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[2 q'
#                           │ ├┘ ├────────┘ ├┘ ├────┘
#                           │ │  │          │  └ override with this control sequence;
#                           │ │  │          │    restore the cursor shape to a block
#                           │ │  │          │
#                           │ │  │          └ `Se` capability in the terminfo database
#                           │ │  │
#                           │ │  └ override the current value with this new one;
#                           │ │    set the cursor shape to the one specified by
#                           │ │    the digit `%d`
#                           │ │
#                           │ └ `Ss` capability in the terminfo database
#                           │
#                           └ for all terminals (no matter the value of `$TERM`)

You may need to change the control sequences assigned to the Ss and Se capabilities; make sure they match whatever $ infocmp -1x | grep 'S[se]' outputs (ignore the trailing commas). You may also want to limit the assignments to the st terminal; in that case, replace the leading * terminal name pattern with something like st, st-256color or st-*. Check the value of $TERM in your st terminal, outside Tmux.

For the new value to take effect, you can:

  • restart the Tmux server after killing the current one ($ tmux kill-server)
  • start a new one ($ tmux -Lx)
  • detach your tmux client ($ tmux detach-client) and re-attach it ($ tmux attach-session)
  • That seems to be a lot more then I expected ^^ Simply adding the line to my tmux.conf worked perfectly! Thanks you a lot. Commented Dec 12, 2019 at 20:57

For Vim (not NeoVim), it all has to do with special terminal escape sequences (see :help terminal-options).

As far as I remember, tmux doesn't support the requisite codes out of the box (though apparently st does?). Most GUI versions do automatically.

If you want to monkey around with it, the relevant options are documented at :help termcap-cursor-shape.

  • is the :help terminal-options for nvim? because my nvim does not seems to find anything for terminal-options & termcap-cursor-shape Commented Dec 10, 2019 at 20:55
  • Ah, nuts, I missed that. Definitely vim there. Apologies @Crayzzit
    – D. Ben Knoble
    Commented Dec 10, 2019 at 20:57
  • Right ^^ no problem! Commented Dec 10, 2019 at 21:00
  • 3
    tmux supports it if the outside terminfo(5) entry has Ss and Se entries, which st usually does. But vim will need to be told to do it, it tends to decide based on TERM and probably won't do for screen*/tmux*. Commented Dec 10, 2019 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.