Curly Underlines in Kitty + Tmux + Neovim

Curly Underlines (or “undercurls”) started with Kitty1, but has been pulled into Neovim2 and looks especially good with the fancy new Language Server stuff.3

It’s only in tmux 3.x, so if you are on OS X you may need to brew uninstall tmux && brew install tmux --HEAD. The config is simple, but hard to find! I eventually found @yokenzan’s dotfiles on GitHub with the solution:

Put the following in your .tmux.conf:

set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # underscore colours - needs tmux-3.0

If your terminal supports it, and you have tmux 3.x, you should be able to see curly underlines when you paste printf '\e[4:3mUnderlined\n' into a terminal. 🙌


  1. Curly and colored underlines · Issue #1145 · xtermjs/xterm.js  

    > This is originally a feature of Kitty, now also adopted by VTE (GNOME Terminal and friends). Technically two separate features, but they mostly make sense together, e.g. for spell checking.
    > 
    > Apparently vim and neovim have already / are about to support these, see e.g. vim undercurl, vim color, neovim.
    

    Curly and colored underlines · Issue #1145 · xtermjs/xterm.js

  2. tui: handle Smulx extension capability (extended underline) (#9097) · neovim/neovim@42f492a  

    > tui: handle Smulx extension capability (extended underline) (#9097)
    > 
    > This was added to ncurses terminfo for vte and tmux.
    > 
    > Ref: tmux/tmux#1492 (comment)
    > 
    > Assumes color support is available when extended underline is supported.
    > 
    > Ref: tmux/tmux#1492 (comment)
    

    tui: handle Smulx extension capability (extended underline) (#9097) · neovim/neovim@42f492a

  3. Thank you @megalithic for helping me get it set up!