Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Vim (neovim) cursor shape does not change (BLOCK to VLINE shape). #270

Closed

Description

@henryoliver

On the terminal itself the cursor works fine and changes to BLOCK shape to VLINE shape but inside VIM its simple does not work.

Follow my configuration for the cursor shape on my .zshrc file:

        vicmd)      print -n -- "\E]50;CursorShape=0\C-G";;  # block cursor
        viins|main) print -n -- "\E]50;CursorShape=1\C-G";;  # line cursor

I've try all different bellow configurations on VIM without success:
http://stackoverflow.com/questions/6488683/how-do-i-change-the-vim-cursor-in-insert-normal-mode
http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes

For example, I can change the shape on iTerm2/VIM with the follow setup:

let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"

Appreciate any help at all.

Thanks!

Activity

  1. szhu commented on Jul 19, 2016

    @szhu
    Contributor

    Btw for whoever submits a pull request to fix this, here's some CSS that will make the cursor a vertical line:

        // custom css to embed in the terminal window
        termCSS: '\
        .cursor-node {\
            background: none !important;\
            border: none !important;\
            border-left: 1px solid rgba(255, 255, 255, 0.7) !important;\
        }',
  2. jamo commented on Jul 22, 2016

    @jamo
  3. added
    🤯 Type: Compatibility
    help wanted
    on Jul 26, 2016
  4. colepeters commented on Sep 11, 2016

    @colepeters
    Contributor

    Not sure if this is helpful, but it looks like something is causing the app to not recognise the cursor style (which is evaluating to 5):

    image

    Interestingly, I’m not able to find the code shown in the above bundle.js anywhere in Hyperterm’s source code, and it’s not coming from any of my plugins. 🤔

    This is the relevant section of my init.vim for Neovim (running on macOS), which accomplishes the same thing as @henryoliver’s setup above (see here for documentation from Neovim):

    let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 " Cursor is pipe in Insert, block in Normal
  5. tbodt commented on Dec 20, 2016

    @tbodt
    Contributor

    It's in the hterm-umdjs dependency.

  6. tbodt commented on Dec 20, 2016

    @tbodt
    Contributor

    It looks like there are actually two different sets of cursor changing escape codes. The first is ^[[50;CursorShape=1. That's what many people configure their Vim to use. The other one, which Neovim uses, is ^[[5 q. I think the reason Neovim uses this one is because it lets you specify that the cursor should blink. However, hterm only partially supports it. Block and underline cursors are supported, both blinking and not blinking, but I-beam cursors are not.

    Fixing this would require fixing hterm, and should be as easy as a quick pull request. Unfortunately, hterm is part of the Chromium OS codebase, and Google does not make anything that easy when it comes to their open-source projects. If someone else can figure out how to contribute code to Chromium, they'd just have to add a few cases here.

  7. tbodt commented on Dec 20, 2016

    @tbodt
    Contributor

    Here's the iTerm2 pull request that added these escape sequences:

    gnachman/iTerm2#92

  8. tbodt commented on Dec 20, 2016

    @tbodt
    Contributor

    Interestingly, the neovim special cursor for replace mode does work. It's an underline which hterm does support.

  9. colepeters commented on Dec 20, 2016

    @colepeters
    Contributor

    Nice detective work, @tbodt! Hope this helps for future improvements. 🕵🏻

  10. tbodt commented on Dec 20, 2016

    @tbodt
    Contributor

    It looks like hterm is such a pain in the ass to contribute to that Hyper is already monkey patching it. I'm gonna pull request this.

  11. tbodt commented on Dec 21, 2016

    @tbodt
    Contributor

    Fixed in pull request #1286.

  12. added a commit that references this issue on Dec 24, 2016
    ccf818d
  13. guiltyred commented on Mar 16, 2018

    @guiltyred

    Having this issue in the latest version of canary, is it a regression from the change to xterm?

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

    help wanted🤯 Type: Compatibility

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions