mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-19 23:01:36 +03:00
feat: enable arrow keys by default
This commit is contained in:
parent
8b7f72afaa
commit
ed53ea6efb
@ -6,11 +6,11 @@ keymap = [
|
||||
{ on = [ "<C-q>" ], exec = "close" },
|
||||
|
||||
# Navigation
|
||||
{ on = [ "j" ], exec = "arrow 1" },
|
||||
{ on = [ "k" ], exec = "arrow -1" },
|
||||
{ on = [ "j" ], exec = "arrow 1" },
|
||||
|
||||
{ on = [ "J" ], exec = "arrow 5" },
|
||||
{ on = [ "K" ], exec = "arrow -5" },
|
||||
{ on = [ "J" ], exec = "arrow 5" },
|
||||
|
||||
{ on = [ "h" ], exec = "leave" },
|
||||
{ on = [ "l" ], exec = "enter" },
|
||||
@ -18,6 +18,11 @@ keymap = [
|
||||
{ on = [ "H" ], exec = "back" },
|
||||
{ on = [ "L" ], exec = "forward" },
|
||||
|
||||
{ on = [ "<Up>" ], exec = "arrow -1" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1" },
|
||||
{ on = [ "<Left>" ], exec = "leave" },
|
||||
{ on = [ "<Right>" ], exec = "enter" },
|
||||
|
||||
# Selection
|
||||
{ on = [ "<Space>" ], exec = "select --state=none" },
|
||||
{ on = [ "v" ], exec = "visual_mode" },
|
||||
@ -71,8 +76,11 @@ keymap = [
|
||||
{ on = [ "<Esc>" ], exec = "close" },
|
||||
{ on = [ "w" ], exec = "close" },
|
||||
|
||||
{ on = [ "j" ], exec = "arrow 1" },
|
||||
{ on = [ "k" ], exec = "arrow -1" },
|
||||
{ on = [ "j" ], exec = "arrow 1" },
|
||||
|
||||
{ on = [ "<Up>" ], exec = "arrow -1" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1" },
|
||||
|
||||
{ on = [ "x" ], exec = "cancel" },
|
||||
]
|
||||
@ -84,11 +92,14 @@ keymap = [
|
||||
{ on = [ "<Esc>" ], exec = "close" },
|
||||
{ on = [ "<Enter>" ], exec = "close --submit" },
|
||||
|
||||
{ on = [ "j" ], exec = "arrow 1" },
|
||||
{ on = [ "k" ], exec = "arrow -1" },
|
||||
{ on = [ "j" ], exec = "arrow 1" },
|
||||
|
||||
{ on = [ "J" ], exec = "arrow 5" },
|
||||
{ on = [ "K" ], exec = "arrow -5" },
|
||||
{ on = [ "J" ], exec = "arrow 5" },
|
||||
|
||||
{ on = [ "<Up>" ], exec = "arrow -1" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1" },
|
||||
]
|
||||
|
||||
[input]
|
||||
@ -110,6 +121,9 @@ keymap = [
|
||||
{ on = [ "H" ], exec = "move -999" },
|
||||
{ on = [ "L" ], exec = "move 999" },
|
||||
|
||||
{ on = [ "<Left>" ], exec = "move -1" },
|
||||
{ on = [ "<Right>" ], exec = "move 1" },
|
||||
|
||||
{ on = [ "b" ], exec = "backward" },
|
||||
{ on = [ "w" ], exec = "forward" },
|
||||
{ on = [ "e" ], exec = "forward --end-of-word" },
|
||||
|
@ -94,10 +94,10 @@ rules = [
|
||||
"*.wav" = ""
|
||||
|
||||
# Movies
|
||||
"*.mp4" = ""
|
||||
"*.mkv" = ""
|
||||
"*.avi" = ""
|
||||
"*.mov" = ""
|
||||
"*.mp4" = ""
|
||||
"*.mkv" = ""
|
||||
"*.avi" = ""
|
||||
"*.mov" = ""
|
||||
|
||||
# Images
|
||||
"*.jpg" = ""
|
||||
|
@ -178,27 +178,28 @@ impl Executor {
|
||||
return false;
|
||||
};
|
||||
|
||||
match exec.cmd.as_str() {
|
||||
"close" => return cx.input.close(exec.named.contains_key("submit")),
|
||||
"escape" => return cx.input.escape(),
|
||||
|
||||
"move" => {
|
||||
let step = exec.args.get(0).and_then(|s| s.parse().ok()).unwrap_or(0);
|
||||
return cx.input.move_(step);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match cx.input.mode() {
|
||||
InputMode::Normal => match exec.cmd.as_str() {
|
||||
"close" => cx.input.close(exec.named.contains_key("submit")),
|
||||
"escape" => cx.input.escape(),
|
||||
|
||||
"insert" => cx.input.insert(exec.named.contains_key("append")),
|
||||
"visual" => cx.input.visual(),
|
||||
|
||||
"move" => {
|
||||
let step = exec.args.get(0).and_then(|s| s.parse().ok()).unwrap_or(0);
|
||||
cx.input.move_(step)
|
||||
}
|
||||
|
||||
"backward" => cx.input.backward(),
|
||||
"forward" => cx.input.forward(exec.named.contains_key("end-of-word")),
|
||||
"delete" => cx.input.delete(exec.named.contains_key("insert")),
|
||||
_ => false,
|
||||
},
|
||||
InputMode::Insert => match exec.cmd.as_str() {
|
||||
"close" => cx.input.close(exec.named.contains_key("submit")),
|
||||
"escape" => cx.input.escape(),
|
||||
"backspace" => cx.input.backspace(),
|
||||
_ => {
|
||||
if let KeyCode::Char(c) = code {
|
||||
|
Loading…
Reference in New Issue
Block a user