From c43e37553e0f64eb20101fe8119bb1681643a3e0 Mon Sep 17 00:00:00 2001 From: 0xadk <0xadk@users.noreply.github.com> Date: Wed, 19 Nov 2025 14:33:02 -0800 Subject: [PATCH] add vim keybindings --- README.md | 4 ++-- src/keybinds.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b9727fb..2c08c2a 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/src/keybinds.rs b/src/keybinds.rs index b4c0452..88a4599 100644 --- a/src/keybinds.rs +++ b/src/keybinds.rs @@ -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')) }