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 mode: 's' key not working in visual mode #865

Open
deephbz opened this issue Dec 31, 2024 · 0 comments · May be fixed by #867
Open

Vi mode: 's' key not working in visual mode #865

deephbz opened this issue Dec 31, 2024 · 0 comments · May be fixed by #867
Labels
bug Something isn't working

Comments

@deephbz
Copy link

deephbz commented Dec 31, 2024

Platform Linux x86_64
Terminal software Terminal independent. I've tried Alaritty and Ghostty

Describe the problem you are observing:

Steps to reproduce

  1. Standard nulshell, with $env.config.edit_mode = vi
  2. Press following keys starting from empty command line under insert mode, type foo123bar, then press keys: ESC, 6, h, v, l, l, s. This enters normal mode, move cursor on "1" and enter visual mode to select "123". The **bug behavior" is when pressing s key it only deletes character "3" but it should delete "123" altogether.

Recording

out

asciicast

Claude Sonnet's analysis, FYI

The problem is that while the 's' key is properly handled in normal mode through the Command::SubstituteCharWithInsert command, there's no special handling for it in visual mode.

Here's what I found:

In vi/command.rs, the 's' key is parsed into Command::SubstituteCharWithInsert in normal mode
In vi/mod.rs, visual mode is entered when 'v' is pressed in normal mode
However, when in visual mode (ViMode::Visual), the code doesn't have special handling for the 's' command to delete the selection and enter insert mode
The fix would need to:

Add visual mode handling for the 's' key in the command parser
Make it behave similar to 'c' in visual mode (change/delete selection and enter insert mode)

@deephbz deephbz added the bug Something isn't working label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant