diff options
author | Bob | 2021-11-15 15:31:20 +0000 |
---|---|---|
committer | GitHub | 2021-11-15 15:31:20 +0000 |
commit | 46d9ae2b62f5b8494c527e0f8475509ce5fad095 (patch) | |
tree | bb17b6b0998fb7df248ed58384f6ad504a37146c /helix-term/src/ui | |
parent | c638b6b60e69697b7e7957ed1af1ac071c41974b (diff) |
Readline style insert mode (#1039)
* readline style insert mode
* update keymap.md
* don't save change history in insert mode
* Revert "don't save change history in insert mode"
This reverts commit cb47f946d7fb62ceda68e7d1692a3914d0be7762.
* don't affect register and history in insert mode
* add insert_register
* don't call exit_select_mode in insert mode
* avoid set_selection
* avoid duplicated current!
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/prompt.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index deed1609..e90b0772 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -231,6 +231,14 @@ impl Prompt { self.completion = (self.completion_fn)(&self.line); } + pub fn delete_word_forwards(&mut self) { + let pos = self.eval_movement(Movement::ForwardWord(1)); + self.line.replace_range(self.cursor..pos, ""); + + self.exit_selection(); + self.completion = (self.completion_fn)(&self.line); + } + pub fn kill_to_start_of_line(&mut self) { let pos = self.eval_movement(Movement::StartOfLine); self.line.replace_range(pos..self.cursor, ""); @@ -435,6 +443,7 @@ impl Component for Prompt { ctrl!('e') | key!(End) => self.move_end(), ctrl!('a') | key!(Home) => self.move_start(), ctrl!('w') => self.delete_word_backwards(), + alt!('d') => self.delete_word_forwards(), ctrl!('k') => self.kill_to_end_of_line(), ctrl!('u') => self.kill_to_start_of_line(), ctrl!('h') | key!(Backspace) => { |