Skip to content

Commit 72563ff

Browse files
committed
cli(new): add vim-style navigation keys to interactive menus
1 parent 70a754b commit 72563ff

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/commands/NewCommand.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,18 @@ int main()
505505
if (ch == L'q' || ch == L'Q')
506506
return Key::Quit;
507507

508+
if (ch == L'k' || ch == L'K')
509+
return Key::Up;
510+
511+
if (ch == L'j' || ch == L'J')
512+
return Key::Down;
513+
514+
if (ch == L'l' || ch == L'L')
515+
return Key::Enter;
516+
517+
if (ch == L'h' || ch == L'H')
518+
return Key::Escape;
519+
508520
// unknown key -> ignore
509521
return Key::None;
510522
}
@@ -545,6 +557,18 @@ int main()
545557
if (c == 'a' || c == 'A')
546558
return Key::ToggleAll;
547559

560+
if (c == 'k' || c == 'K')
561+
return Key::Up;
562+
563+
if (c == 'j' || c == 'J')
564+
return Key::Down;
565+
566+
if (c == 'l' || c == 'L')
567+
return Key::Enter;
568+
569+
if (c == 'h' || c == 'H')
570+
return Key::Escape;
571+
548572
if (c == '\n' || c == '\r')
549573
return Key::Enter;
550574

0 commit comments

Comments
 (0)