From 7bcca791f21f95f183187493f7617a04d4c44eda Mon Sep 17 00:00:00 2001 From: gwenn <gtreguier@gmail.com> Date: Sat, 25 Feb 2017 13:01:15 +0100 Subject: [PATCH] Vi first print --- src/keymap.rs | 5 +++-- src/lib.rs | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/keymap.rs b/src/keymap.rs index 8bb04ced..ed9ff338 100644 --- a/src/keymap.rs +++ b/src/keymap.rs @@ -39,6 +39,7 @@ pub enum Cmd { Unknown, UpcaseWord, ViCharSearch(RepeatCount, CharSearch), + ViFirstPrint, ViYankTo(Movement), Yank(RepeatCount, Anchor), YankPop, @@ -291,8 +292,8 @@ impl EditState { KeyPress::End => Cmd::EndOfLine, KeyPress::Char('.') => self.last_cmd.clone(), // vi-redo // TODO KeyPress::Char('%') => Cmd::???, Move to the corresponding opening/closing bracket - KeyPress::Char('0') => Cmd::BeginningOfLine, // vi-zero: Vi move to the beginning of line. - KeyPress::Char('^') => Cmd::BeginningOfLine, // vi-first-print TODO Move to the first non-blank character of line. + KeyPress::Char('0') => Cmd::BeginningOfLine, + KeyPress::Char('^') => Cmd::ViFirstPrint, KeyPress::Char('a') => { // vi-append-mode: Vi enter insert mode after the cursor. self.insert = true; diff --git a/src/lib.rs b/src/lib.rs index 6d14493b..668d8053 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -888,6 +888,11 @@ fn readline_edit<C: Completer>(prompt: &str, // Move to the beginning of line. try!(edit_move_home(&mut s)) } + Cmd::ViFirstPrint => { + editor.kill_ring.reset(); + try!(edit_move_home(&mut s)); + try!(edit_move_to_next_word(&mut s, At::Start, Word::Big, 1)) + } Cmd::BackwardChar(n) => { editor.kill_ring.reset(); // Move back a character. -- GitLab