@@ -238,11 +238,13 @@ pub fn move_next_word_end(cx: &mut Context) {
238238}
239239
240240pub fn move_file_start(cx: &mut Context) {
241+ push_jump(cx);
241242 let doc = cx.doc();
242243 doc.set_selection(Selection::point(0));
243244}
244245
245246pub fn move_file_end(cx: &mut Context) {
247+ push_jump(cx);
246248 let doc = cx.doc();
247249 let text = doc.text();
248250 let last_line = text.line_to_char(text.len_lines().saturating_sub(2));
@@ -1027,9 +1029,21 @@ pub fn normal_mode(cx: &mut Context) {
10271029 }
10281030}
10291031
1032+// Store a jump on the jumplist.
1033+fn push_jump(cx: &mut Context) {
1034+ let jump = {
1035+ let doc = cx.doc();
1036+ (doc.id(), doc.selection().clone())
1037+ };
1038+ cx.view().jumps.push(jump);
1039+}
1040+
10301041pub fn goto_mode(cx: &mut Context) {
10311042 let count = cx.count;
1043+
10321044 if count > 1 {
1045+ push_jump(cx);
1046+
10331047 // TODO: can't go to line 1 since we can't distinguish between g and 1g, g gets converted
10341048 // to 1g
10351049 let doc = cx.doc();
@@ -1069,6 +1083,8 @@ pub fn exit_select_mode(cx: &mut Context) {
10691083fn _goto(cx: &mut Context, locations: Vec<lsp::Location>) {
10701084 use helix_view::editor::Action;
10711085
1086+ push_jump(cx);
1087+
10721088 fn jump_to(editor: &mut Editor, location: &lsp::Location, action: Action) {
10731089 let id = editor
10741090 .open(PathBuf::from(location.uri.path()), action)