broot icon indicating copy to clipboard operation
broot copied to clipboard

open editor at line number of first occurance if performing text/regex/composit search

Open JoshuaPostel opened this issue 2 months ago • 2 comments

Is there a way to have broot execute $EDITOR +{line_number_of_first_occurcance} {file} when opening a file after performing a text search i.e. c/some_text_im_looking_for:e?

JoshuaPostel avatar Oct 17 '25 16:10 JoshuaPostel

It already works like this for me.

I have this verb defined:

    {
        invocation: edit
        key: enter
        shortcut: e
        execution: "/usr/local/bin/nvim +{line} {file}"
        apply_to: text_file
        leave_broot: false
        refresh_after: false
    }

Canop avatar Oct 17 '25 18:10 Canop

Thanks, that did the trick!

My confusion sprung from the website documentation https://dystroy.org/broot/common-problems/#edit

It works by executing "$EDITOR +{line} {file}" which assumes that the $EDITOR variable is defined and that your editor takes the line number as argument.

not matching the defaults

https://github.com/Canop/broot/blob/e3de4a6955ea583430618b742d536407898fc03d/resources/default-conf/verbs.hjson#L27-L34

JoshuaPostel avatar Oct 17 '25 19:10 JoshuaPostel