broot icon indicating copy to clipboard operation
broot copied to clipboard

Verb precedence

Open 9999years opened this issue 2 years ago • 4 comments

In my conf.toml, I have an edit verb defined to open files in Neovim:

[[verbs]]
key = "enter"
invocation = "edit"
shortcut = "e"
apply_to = "file"
external = "nvim {file}"
leave_broot = false

In my broot.nvim plugin, I load up another configuration file as well to override the edit verb to edit the file in the current Neovim session instead:

[[verbs]]
key = "enter"
invocation = "edit"
shortcut = "e"
apply_to = "file"
external = "broot.nvim edit +{line} {file}"
from_shell = true

(Other editor integrations use :print_path instead, but the concept is the same.)

Unfortunately, this doesn't work; the first matching verb is used, so the broot.nvim definition never gets triggered.

I'd really like the last matching verb to be used, or to otherwise have some notion of "more important" and "less important" verbs.

9999years avatar Oct 14 '23 00:10 9999years

Why not reverse the order, and load the nvim broot config first?

AndydeCleyre avatar Oct 11 '25 04:10 AndydeCleyre

Why not reverse the order, and load the nvim broot config first?

Everything other than verbs have later loaded configs take precedence, so verbs being the other way around is inconsistent. It's also a little confusing in the UI seeing both versions of the verb appear, but only the one loaded first is actually usable. Personally, I'd expect the later-loaded verbs to override the specific fields of the earlier-loaded verbs that were defined in the later config.

boomshroom avatar Oct 28 '25 02:10 boomshroom

I agree the verb precedence is confusing and hard to manage alongside the other settings.

AndydeCleyre avatar Oct 28 '25 03:10 AndydeCleyre

Yes, overriding should be the norm. I'll review that.

Canop avatar Oct 28 '25 05:10 Canop