Skip to content

Configurable push_jumps per command #14592

@Smithx10

Description

@Smithx10

I went down the remap keys but it lead to my menus no longer having descriptions. It did work, but had side effects. We could resolve the side effects or perhaps introduce a new configuration.

I looked at the commands code and it appears each command will call "push_jump".

fn goto_file_start(cx: &mut Context) {
    if cx.count.is_some() {
        goto_line(cx);
    } else {
        let (view, doc) = current!(cx.editor);
        let text = doc.text().slice(..);
        let selection = doc
            .selection(view.id)
            .clone()
            .transform(|range| range.put_cursor(text, 0, cx.editor.mode == Mode::Select));
        push_jump(view, doc);
        doc.set_selection(view.id, selection);
    }
}

I imagine we could have a new configuration that allows for:

  • all movements are added to the jump_list
  • a range of predefined levels that have less and more. The least wide being "default". "moderate", "aggressive"
  • explicit configuration via a list of commands.

I'd be fine with just the explicit list giving the user the most control over it.

@thomasschafer wrote in issue #4815

I know this is a closed issue, but I find myself also wanting more movements to push to the jumplist, such as pretty much any commands prefixed with m or [/]. Would we consider adding a config option to widen the jump criteria in this way? The alternative seems to be to add a massive number of keymaps to my config which just add save_selection alongside the existing command, but I would imagine that sufficiently many people would prefer a widened criteria (more similar to that of Neovim) to make it a desirable feature to add.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions