Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce jump_pattern option #5193

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

QiBaobin
Copy link
Contributor

@QiBaobin QiBaobin commented Jun 19, 2024

Sometime, we don't have line and column information in context, like fd output, log etc.
Let's extract an option jump_pattern to let other use cases can override it.

execute-keys ',xs^([^:\n]+):(\d+):(\d+)?<ret>'
# file
# file:line
# file:line:col
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be clear, file:line:col and file:line are already supported.
Whether we want to support file, maybe, I'm not sure.
Do you have a use case in mind?
Note that it should be possible to create a buffer-local jump alias to your preferred implementation.
The LSP plugin uses this technique for example.
Also, if you want to support file, you probably want to do the same to jump-select-next and jump-select-previous (also those can be customized by means of aliases).

Copy link
Contributor Author

@QiBaobin QiBaobin Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only support file:line: currently, it doesn't recognize the pattern without last :.

One of my use case is that finding some files using fd or rg -l, look at them and open some of them. I don't know if there is a better workflow.

define-command -params 1.. -docstring "find files" fd %{
    require-module fifo
    evaluate-commands -try-client %opt{toolsclient} %{
        fifo -name "*fd*" fd -tf %arg{@}
        require-module jump
        hook buffer NormalKey <ret> jump
    }
}

do you think it's a better idea if I extract an option jump_file_pattern so that I can override it in my command and jump-next/previous can also use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krobelus , I reverted the pattern and introduced an option instead, could you take another look?

@QiBaobin QiBaobin changed the title support three path styles in jump introduce jump_pattern option Jun 24, 2024
@QiBaobin QiBaobin requested a review from krobelus July 3, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants