Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vi keybinds are wrong and/or inconsistent with readline #788

Open
Atemu opened this issue May 13, 2024 · 3 comments
Open

vi keybinds are wrong and/or inconsistent with readline #788

Atemu opened this issue May 13, 2024 · 3 comments
Labels
A-ViKeybinding Area: Vi(m) keybinding support

Comments

@Atemu
Copy link

Atemu commented May 13, 2024

Describe the bug

I've noticed a couple of issues with the vi keybinds:

  1. Exiting insert mode keeps the cursor position
  2. Some punctuation chars do not separate words and are jumped across with lower case inputs
  3. When jumping to the previous line/history item, the cursor is not reset to the start of the line
  4. You can navigate to the EOL char in normal mode
  5. Navigating downwards from a history item after navigating away from the EOL char navigates back to the EOL char of the same history item
  6. You cannot navigate away from an history item after navigating to any char but the EOL char
  7. You are jumped to the most recent history item when trying to navigate up from a history item after having jumped away from EOL

How to reproduce

  1. Enter some text into the prompt, navigate to the EOL and alternate i and <ESC>
  2. Navigate foo.bar:baz using e, w, b etc.
  3. Exit insert mode, k
  4. Enter some text and navigate to the end ($)
  5. <ESC> k h j
  6. <ESC> k h l j k
  7. <ESC> k h k

Expected behavior

  1. The cursor should jump one char backwards after <ESC>
  2. The cursor should stop before/after all punctuation
  3. The cursor should jump to the beginning of the line (bash does this but zsh doesn't? Perhaps this should be configurable.)
  4. The cursor should stop at the last non-EOL char
  5. It should just jump to the next history item
  6. You should be able to move in any history direction, no matter what you did previously
  7. You should go up in the history

Screenshots

No response

Configuration

key value
version 0.92.1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.1 (7cf61ebde 2024-03-27) (built from a source tarball)
cargo_version cargo 1.77.1
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which
installed_plugins

Additional context

No response

@kubouch kubouch transferred this issue from nushell/nushell May 13, 2024
@kubouch
Copy link
Contributor

kubouch commented May 13, 2024

I believe this belongs to reedline as the vi mode is a feature of reedline. The vi mode is not very developed, improvements are welcome.

@kubouch kubouch added the A-ViKeybinding Area: Vi(m) keybinding support label May 13, 2024
@Atemu Atemu changed the title vi keybinds are wrong and/or inconsistent with bash vi keybinds are wrong and/or inconsistent with readline May 14, 2024
@amtoine
Copy link
Member

amtoine commented May 14, 2024

yeah, i've seen some clear differences with Vim over the years...

the easiest has always been to hit <c-o> and drop inside Neovim, my $env.EDITOR 🤣

@jaredmontoya
Copy link

jaredmontoya commented Nov 16, 2024

What bugs me the most is the difference in behaviour of the caret when switching from insert to normal mode.

it's easier to see with

$env.config =
  cursor_shape: {
    vi_normal: block
    vi_insert: line
  }
}

when you press esc to go to normal mode the caret slips on to the right character, not the left one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ViKeybinding Area: Vi(m) keybinding support
Projects
None yet
Development

No branches or pull requests

4 participants