Skip to content

configure cursor shape #7151

Closed
Closed

Description

@Zaechus

Question

It looks like the new appearance for the cursor in vi_mode is a vertical line for insert mode and a block for normal mode. Is there a configuration option to revert to a block for all modes?

Additional context and details

nu --version
0.71.0

Activity

  1. added
    deprecated:question
    on Nov 16, 2022
  2. fdncred commented on Nov 16, 2022

    @fdncred
    Contributor

    There is no config option yet, but it's planned. Planned, meaning that no one has done it yet but we want it.

  3. KSXGitHub commented on Nov 29, 2022

    @KSXGitHub

    At least exiting nu should revert the cursor to normal. But if nu can't know what the original cursor is, then I think this behavior should be disabled by default.

  4. fdncred commented on Nov 29, 2022

    @fdncred
    Contributor

    FWIW, a PR has been started to make this configurable. nushell/reedline#515

  5. AmionSky commented on Jan 15, 2023

    @AmionSky

    The nushell/reedline#515 PR has been merged but I still couldn't find a way to configure it from nushell.
    Also I strongly think by default nu shouldn't change the cursor set by the terminal.

  6. fdncred commented on Jan 15, 2023

    @fdncred
    Contributor

    If you're on the latest main branch, you can configure it by adding this to your config.nu.

      cursor_shape: {
        vi_insert: underscore
        vi_normal: block
        emacs: line
      }
    

    IIRC, I believe it will overwrite the terminal setting with or without setting this information. Maybe someone should look at that in the future. I'm just glad to get rid of the friggin block finally.

  7. warpdesign commented on Jan 19, 2023

    @warpdesign

    Just stumbled upon this issue: I'm not sure where to add the cursor_shape config? config.nu is huge and there are lots of entries. I tried pasting this at the end of the file but this resulted in an error.

  8. warpdesign commented on Jan 19, 2023

    @warpdesign

    Btw why doesn't nu use the shape defined by the terminal app and overwrites it?

  9. fdncred commented on Jan 19, 2023

    @fdncred
    Contributor

    This change, I mentioned above, could go anywhere within the config section of the config.nu. You can identify this part of the config by finding let-env config = {. Anywhere before the last } would work.

    So, you'd want something like, if you wanted it as the first thing in your config.nu.

    let-env config = {
      cursor_shape: {
        vi_insert: underscore
        vi_normal: block
        emacs: line
      }
    ... all the rest of your config
    }
    

    You could also look at the default_config.nu in the repo, which shows where it goes.

    But why doesn't ...

    It probably should but it doesn't yet. Of course, this gives you a different option too. With this config option, you can different cursors depending on editing mode. Since that mode is specific to nushell, I doubt any terminal configuration would recognize it.

  10. ahirner commented on Apr 7, 2023

    @ahirner

    Btw why doesn't nu use the shape defined by the terminal app and overwrites it?

    Reedline supports not modifying the cursor:

    If any of the fields is None, the cursor won’t get changed by Reedline for that mode.

    I guess nushell should allow null in addition to 'line', 'block', or 'underscore'.

  11. tomboland commented on Jun 22, 2023

    @tomboland

    Hi, I have this in the default, generated config:

      cursor_shape: {
        emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default)
        vi_insert: block # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default)
        vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
      }
    

    In vim, my cursor is a very fine line, and it's very difficult for me to see. I'm using version 0.81.0, installed with homebrew on MacOS.

  12. amtoine commented on Jun 22, 2023

    @amtoine
    Member
      cursor_shape: {
        emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default)
        vi_insert: block # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default)
        vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
      }
    

    yes this is available now, i think we can close this issue as the question has been answered with time 😌

    In vim, my cursor is a very fine line, and it's very difficult for me to see. I'm using version 0.81.0, installed with homebrew on MacOS.

    this might have to do with your font? 🤔
    my underscore is quite big enough!

  13. tomboland commented on Jun 22, 2023

    @tomboland

    Hi,

    Should I raise a new issue? Using the same terminal emulator, but with bash, I see a large, bold, black cursor block, instead of this very thin vertical line. See my screenshot; can you see the cursor at a glance? It's on the vi_insert line:
    image

  14. amtoine commented on Jun 22, 2023

    @amtoine
    Member

    @tomboland
    mm i'd say this is a Vim issue 🤔

    when i run Neovim i have a completely different cursor, it's not even switching from large to thin underscore, but rather between a vertical bar in Nushell and a block in NORMAL mode in Neovim 😕

  15. amtoine commented on Jun 22, 2023

    @amtoine
    Member

    what's strange is that Nushell should not have anything to do with the cursor inside either Vim or Neovim, which is what i see on my side...

  16. mb21 commented on Aug 31, 2023

    @mb21

    @tomboland @amtoine I have the same and opened an issue: #10169

  17. added a commit that references this issue on Sep 9, 2023
  18. nazmulidris commented on Sep 19, 2023

    @nazmulidris

    On Windows, w/ nu v0.84.0, I had to add the following to my config.nu file

    export-env { load-env {
    
        # https://github.com/nushell/nushell/issues/7151
        config: ($env.config? | default {} | merge {
            render_right_prompt_on_last_line: true,
            cursor_shape: {
                vi_insert: block
                vi_normal: block
                emacs: block
            }
        })
    
    }}
  19. dedguy21 commented on Oct 17, 2023

    @dedguy21

    I see that there are the two vi_insert & vi_normal. Is there also an option for vi_visual & vi_replace. I don't see it on the documentation.

  20. mb21 commented on Oct 17, 2023

    @mb21

    @dedguy21 the cursor_shape vi_insert and vi_normal configs are not for inside vi/vim. They are for when nushell's prompt itself is set up to be in vim-like-mode (edit_mode: vi) – and that doesn't have visual or replace mode AFAIK.

  21. dedguy21 commented on Oct 17, 2023

    @dedguy21

    @mb21 too bad, I was hoping it would be more like zsh/bash where the vi mode has VISUAL and REPLACE modes as well.

  22. mb21 commented on Oct 17, 2023

    @mb21

    Yeah, you can like the upstream issue: kkawakam/rustyline#335

  23. fdncred commented on Oct 17, 2023

    @fdncred
    Contributor

    We don't use rustyline anymore.

  24. itzmesonic commented on Sep 9, 2024

    @itzmesonic

    I want to change it anywhere, how do i do??

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

    deprecated:question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions