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