aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBenoît Cortier2022-07-15 13:59:00 +0000
committerGitHub2022-07-15 13:59:00 +0000
commit333ab278374863296ebef5154340f33482e13edb (patch)
tree72b7d305e0d27da468b65fb9c4b81203236197d9 /helix-term/src/ui
parent8681fb6d9ee06610fac2baafb4ca34f93f9c7f4d (diff)
feat(term): uniformize word-wise movement and deletion (#2500)
Ctrl-based shortcuts are common in numerous applications. This change: - Adds Ctrl+{Left/Right/Backspace/Delete} for word-wise movement/deletion in prompt, picker, … - Removes Alt-Left and Alt-Right in prompt, picker, … - Adds Alt-Delete in insert mode for forward word deletion In some terminals, Alt-Backspace might not work because it is ambigous. See: https://github.com/helix-editor/helix/pull/2193#issuecomment-1105042501 Hence, Alt alternative is not removed.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/prompt.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 55b08032..36ee62c3 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -477,14 +477,14 @@ impl Component for Prompt {
(self.callback_fn)(cx, &self.line, PromptEvent::Abort);
return close_fn;
}
- alt!('b') | alt!(Left) => self.move_cursor(Movement::BackwardWord(1)),
- alt!('f') | alt!(Right) => self.move_cursor(Movement::ForwardWord(1)),
+ alt!('b') | ctrl!(Left) => self.move_cursor(Movement::BackwardWord(1)),
+ alt!('f') | ctrl!(Right) => self.move_cursor(Movement::ForwardWord(1)),
ctrl!('b') | key!(Left) => self.move_cursor(Movement::BackwardChar(1)),
ctrl!('f') | key!(Right) => self.move_cursor(Movement::ForwardChar(1)),
ctrl!('e') | key!(End) => self.move_end(),
ctrl!('a') | key!(Home) => self.move_start(),
- ctrl!('w') => self.delete_word_backwards(cx),
- alt!('d') => self.delete_word_forwards(cx),
+ ctrl!('w') | alt!(Backspace) | ctrl!(Backspace) => self.delete_word_backwards(cx),
+ alt!('d') | alt!(Delete) | ctrl!(Delete) => self.delete_word_forwards(cx),
ctrl!('k') => self.kill_to_end_of_line(cx),
ctrl!('u') => self.kill_to_start_of_line(cx),
ctrl!('h') | key!(Backspace) => {