summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-01-02 11:11:18 -0500
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-01-02 11:11:18 -0500
commit48e9af84f2574ec647f71761314a692f076056b2 (patch)
tree51a4cc93531f5ce0f2731cd4b5b74ebc51a64bc5
parenta9f7f22d0655d473dcd718c815e8af475ebba37e (diff)
add vim keys for navigation
-rw-r--r--src/joshuto/keymap.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/joshuto/keymap.rs b/src/joshuto/keymap.rs
index 670dfb5..e79141c 100644
--- a/src/joshuto/keymap.rs
+++ b/src/joshuto/keymap.rs
@@ -47,26 +47,42 @@ impl JoshutoKeymap {
{
let mut keymaps: HashMap<i32, CommandKeybind> = HashMap::new();
+ // quit
+ let command = CommandKeybind::SimpleKeybind(
+ Box::new(command::Quit::new()));
+ keymaps.insert(Keycode::LOWER_Q as i32, command);
+
+ // up
let command = CommandKeybind::SimpleKeybind(
Box::new(command::CursorMove::new(-1)));
keymaps.insert(Keycode::UP as i32, command);
+ let command = CommandKeybind::SimpleKeybind(
+ Box::new(command::CursorMove::new(-1)));
+ keymaps.insert(Keycode::LOWER_K as i32, command);
+ // down
let command = CommandKeybind::SimpleKeybind(
Box::new(command::CursorMove::new(1)));
keymaps.insert(Keycode::DOWN as i32, command);
+ let command = CommandKeybind::SimpleKeybind(
+ Box::new(command::CursorMove::new(1)));
+ keymaps.insert(Keycode::LOWER_J as i32, command);
+ // left
let command = CommandKeybind::SimpleKeybind(
Box::new(command::ParentDirectory::new()));
keymaps.insert(Keycode::LEFT as i32, command);
-
let command = CommandKeybind::SimpleKeybind(
- Box::new(command::Quit::new()));
- keymaps.insert(Keycode::LOWER_Q as i32, command);
+ Box::new(command::ParentDirectory::new()));
+ keymaps.insert(Keycode::LOWER_H as i32, command);
+ // right
let command = CommandKeybind::SimpleKeybind(
Box::new(command::OpenFile::new()));
keymaps.insert(Keycode::RIGHT as i32, command);
-
+ let command = CommandKeybind::SimpleKeybind(
+ Box::new(command::OpenFile::new()));
+ keymaps.insert(Keycode::LOWER_L as i32, command);
let command = CommandKeybind::SimpleKeybind(
Box::new(command::OpenFile::new()));
keymaps.insert(Keycode::ENTER as i32, command);