added gg command

pull/3/head
Jan Hrastnik 4 years ago
parent 038201647c
commit b7ef7985ee

@ -117,20 +117,18 @@ pub fn move_next_word_end(view: &mut View, count: usize) {
view.state.selection = Selection::single(pos, pos); view.state.selection = Selection::single(pos, pos);
} }
pub fn move_file_start(view: &mut View, count: usize) { pub fn move_file_start(view: &mut View, _count: usize) {
// TODO: use a transaction // TODO: use a transaction
view.state.selection = view view.state.selection = Selection::single(0, 0);
.state
.move_selection(Direction::Backward, Granularity::Line, count);
view.state.mode = Mode::Normal; view.state.mode = Mode::Normal;
} }
pub fn move_file_end(view: &mut View, count: usize) { pub fn move_file_end(view: &mut View, _count: usize) {
// TODO: use a transaction // TODO: use a transaction
view.state.selection = view let text = &view.state.doc;
.state let last_line = text.char_to_line(text.len_lines().checked_sub(1).unwrap());
.move_selection(Direction::Forward, Granularity::Line, count); view.state.selection = Selection::single(last_line, last_line);
view.state.mode = Mode::Normal; view.state.mode = Mode::Normal;
} }

Loading…
Cancel
Save