From 038201647c657b2b07fa7f87aae3c609c59c77ef Mon Sep 17 00:00:00 2001 From: Jan Hrastnik Date: Sun, 4 Oct 2020 23:47:37 +0200 Subject: started work on goto mode --- helix-view/src/commands.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'helix-view/src/commands.rs') diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs index 6dd1101c..eb9aaf6f 100644 --- a/helix-view/src/commands.rs +++ b/helix-view/src/commands.rs @@ -117,6 +117,24 @@ pub fn move_next_word_end(view: &mut View, count: usize) { view.state.selection = Selection::single(pos, pos); } +pub fn move_file_start(view: &mut View, count: usize) { + // TODO: use a transaction + view.state.selection = view + .state + .move_selection(Direction::Backward, Granularity::Line, count); + + view.state.mode = Mode::Normal; +} + +pub fn move_file_end(view: &mut View, count: usize) { + // TODO: use a transaction + view.state.selection = view + .state + .move_selection(Direction::Forward, Granularity::Line, count); + + view.state.mode = Mode::Normal; +} + // avoid select by default by having a visual mode switch that makes movements into selects pub fn extend_char_left(view: &mut View, count: usize) { @@ -292,6 +310,10 @@ pub fn normal_mode(view: &mut View, _count: usize) { } } +pub fn goto_mode(view: &mut View, _count: usize) { + view.state.mode = Mode::Goto; +} + // TODO: insert means add text just before cursor, on exit we should be on the last letter. pub fn insert_char(view: &mut View, c: char) { let c = Tendril::from_char(c); -- cgit v1.2.3-70-g09d2