add vim keybindings

This commit is contained in:
0xadk 2025-11-19 14:33:02 -08:00
parent ebc1ce1225
commit c43e37553e
2 changed files with 7 additions and 7 deletions

View File

@ -33,9 +33,9 @@ There is one file for linux and one for windows (.exe).
- run the game: `./binbreak-linux`
## Controls
- use the arrow keys for navigation
- use the arrow or vim keys for navigation
- press Enter to confirm choices
- press Esc to exit a game mode or the game. CTRL+C also works to exit the game.
- press Esc or Q to exit a game mode or the game. CTRL+C also works to exit the game.
## Recommended terminals
The game should run fine in any terminal. If you want retro CRT effects, here are some recommendations:

View File

@ -1,19 +1,19 @@
use crossterm::event::{KeyCode, KeyEvent};
pub(crate) fn is_up(key: KeyEvent) -> bool {
matches!(key.code, KeyCode::Up)
matches!(key.code, KeyCode::Up | KeyCode::Char('k'))
}
pub(crate) fn is_down(key: KeyEvent) -> bool {
matches!(key.code, KeyCode::Down)
matches!(key.code, KeyCode::Down | KeyCode::Char('j'))
}
pub(crate) fn is_left(key: KeyEvent) -> bool {
matches!(key.code, KeyCode::Left)
matches!(key.code, KeyCode::Left | KeyCode::Char('h'))
}
pub(crate) fn is_right(key: KeyEvent) -> bool {
matches!(key.code, KeyCode::Right)
matches!(key.code, KeyCode::Right | KeyCode::Char('l'))
}
pub(crate) fn is_select(key: KeyEvent) -> bool {
@ -21,5 +21,5 @@ pub(crate) fn is_select(key: KeyEvent) -> bool {
}
pub(crate) fn is_exit(key: KeyEvent) -> bool {
matches!(key.code, KeyCode::Esc)
matches!(key.code, KeyCode::Esc | KeyCode::Char('q' | 'Q'))
}