helix icon indicating copy to clipboard operation
helix copied to clipboard

Configurable labels for custom menus and typable commands

Open MattCheely opened this issue 2 years ago • 18 comments

I haven't done a ton of Rust development, and only a very little bit with Serde, so consider this an initial draft to see if the approach and proposed config format are sound. I'm happy to add docs as well if this looks reasonable.

MattCheely avatar Sep 25 '22 00:09 MattCheely

That's a very cool change, though you'll have to update the doc.

I'm in mobile so can't check, but does this work recursively or only one level deep ? (I don't expect to ever need more than one level deep personally but others may)

poliorcetics avatar Sep 28 '22 20:09 poliorcetics

It should work recursively. You can have have a labeled menu inside of another labeled menu. A very contrived version might look like:

[keys.normal.space.f]
label = "File"
f = "file_picker"
s = { label = "Save", command = ":write" }
c = { label = "Edit Config", command = ":open ~/.config/helix/config.toml" }

[keys.normal.space.f.e]
label = "Extra"
r = { label = "Reload", command = ":reload" }

I'm happy to update any docs, I just wanted to make sure the approach is sound and that label and command as terms in the configuration were OK before I started in on it.

MattCheely avatar Sep 28 '22 21:09 MattCheely

This looks great! I use backspace to bring up a menu of build commands for different languages, so it'd be nice to relabel everything to make it look a bit prettier

PeepNSheep avatar Oct 04 '22 02:10 PeepNSheep

It seems like there are no major objections to this approach, so I am going to try to start working on some documentation.

MattCheely avatar Oct 17 '22 23:10 MattCheely

I believe the latest changes should return errors in any cases where I was previously choosing some default behavior that could differ from user intent.

MattCheely avatar Nov 16 '22 02:11 MattCheely

What is the situation with this MR? @MattCheely are you still working on it?

bbodi avatar Feb 15 '23 17:02 bbodi

What is the situation with this MR? @MattCheely are you still working on it?

As far as I'm aware I've resolved all of the review comments. I'm just waiting for it to be merged or to get more feedback.

MattCheely avatar Feb 15 '23 23:02 MattCheely

As far as I'm aware I've resolved all of the review comments. I'm just waiting for it to be merged or to get more feedback.

Thanks for the update!

As I can see the situation, there is an open PR which contains this functionality and much more: https://github.com/helix-editor/helix/pull/5635, probably that one is more favourable.

bbodi avatar Feb 16 '23 07:02 bbodi

Not necessarily. I think smaller self contained PRS can also be preferable and are a lot easier to review.

Our review bandwith is limited and considering the amount of PRs we recive it might take a while until a PR is reviewed

pascalkuthe avatar Feb 16 '23 08:02 pascalkuthe

The merge in #5635 is honestly a complete rewrite as the Keymap API is basically re-written, I just wanted to give attribution to the PR author for the work he put in regardless. Sure, this PR is smaller (although the diff stat of the feature isn't). But you would have to put in at least twice the amount of time to review this PR and then mine, for basically the same feature implementations in the end.

(My extension to this feature on top of this PR is the added ability to give command sequences descriptions :) Possibly some documentation clarifications too.)

gibbz00 avatar Feb 16 '23 08:02 gibbz00

FWIW, I'm not too worried about attribution, so I don't mind what PR gets merged. I'm just keen to have the feature. 😁

MattCheely avatar Feb 18 '23 01:02 MattCheely

Not sure if anybody is still interested in the PR, but I've been using it locally. I just rebased on the latest from master, and it seems there were some changes that introduced runtime config parsing errors. Some string type wrangling seems to have resolved it though.

MattCheely avatar Jun 10 '23 23:06 MattCheely

I was testing it and could not make it work when it was a list of commands.

b = { label = "New Buffer", command = ":new" } work b = { label = "New Buffer", command = [":new"] } don't work

danillos avatar Apr 06 '24 19:04 danillos

I've updated this to work on master and got command sequences to work

Should i make a new pr, or try to push to this one, or is this not going to be merged

Vulpesx avatar Jun 06 '24 10:06 Vulpesx

@Vulpesx I've been meaning to get around to updating this for the latest helix changes, but haven't had a lot of free time lately. If you want to open a PR against the branch in my fork to piggyback on this PR, feel free and I'll try to find time to test and merge it. Or if the helix team would merge a new PR, I have no objections. I'm just keen to have the feature, and don't care too much about how it lands.

MattCheely avatar Jun 07 '24 00:06 MattCheely

I've updated this to work on master and got command sequences to work

Should i make a new pr, or try to push to this one, or is this not going to be merged

You can create a new PR against this repo so a wider audience is able to look at it :)

daedroza avatar Jun 08 '24 11:06 daedroza

@Vulpesx This PR should have your changes incorporated now. Feel free to double check my work on the rebase, but I never encountered any merge conflicts and my updated local build seems to be working correctly.

MattCheely avatar Jun 09 '24 04:06 MattCheely

I've been using the changes in this PR on my personal fork for a week now or so, and it works a treat <3

savente93 avatar Jun 14 '24 14:06 savente93