Skip to content

Vim support #1217

@chrisjust

Description

@chrisjust

Is your feature request related to a problem? Please describe.
A lot of TUI libraries support this, and I was wondering if there's made any thoughts towards implementing this?

Describe the solution you'd like
When scrolling through a selectable list, I'd love being able to use j / k to navigate it.

Since there's no search support on the selectors I figured it might as well make sense.

Describe alternatives you've considered
Using the arrow keys 👍

Additional context
If there's interest to implement it I'd be happy to look into it.

https://github.com/spectreconsole/spectre.console/blob/main/resources/scripts/Generator/Commands/AsciiCast/AsciiCastInput.cs#L44

My short research indicated that the switch statement could look like this:

          switch (input)
            {
                case 'k':
                case '↑':
                    PushKey(ConsoleKey.UpArrow, keypressDelayMs);
                    break;
                case 'j':
                case '↓':
                    PushKey(ConsoleKey.DownArrow, keypressDelayMs);
                    break;
                case '↲':
                    PushKey(ConsoleKey.Enter, keypressDelayMs);
                    break;
                case '¦':
                    _input.Enqueue((null, delay));
                    break;
                default:
                    var control = char.IsUpper(input);
                    _input.Enqueue((new ConsoleKeyInfo(input, (ConsoleKey)input, false, false, control), delay));
                    break;
            }

Unless it should be opt-in 👍


Please upvote 👍 this issue if you are interested in it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions