Skip to content

vim/neovim support #2

Description

@anakojm

even if your terminal correctly supports ucsur sp, vim/neovim will not. however, even if your terminal does not support ucsur sp, but vim/neovim does, everything will work fine inside vim/neovim (afaics)
here is a simple patch to neovim that should work with vim too that makes ucsur sp double width:

diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 4d4c299423..28cc3c962f 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -458,6 +458,10 @@ int utf_char2cells(int c)
     return 1;
   }

+  if ((c >= 0xF1900ul) && (c <= 0xF19FFul) && !((c >= 0xF1990ul) && (c <= 0xF199Bul) && (c != 0xF1993ul))) {
+    return 2;
+  }
+
   if (!vim_isprintc(c)) {
     assert(c <= 0xFFFF);
     // unprintable is displayed either as <xx> or <xxxx>

(unlike this repo’s wcwidth, start and end of cartouche are not set as doublewidth, as it looks weird in kitty otherwise)

you can then compile normally

with the terminal not supporting double width ucsur sp:
neovim with dw ucsur sp

with both supporting double width ucsur sp:

Image

the difference seems to only be visual

there are also patches/compilation flags for vim/neovim and other programs (alacritty, iterm2, zsh, tmux) to use the system’s wcwidth https://emonkak.pages.dev/articles/wcwidth/ which, with the LD_PRELOAD env variable like used in this repo would make ucsur sp work directly (haven’t tested it though)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions