-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add :write-without-auto-format commands #4909
Add :write-without-auto-format commands #4909
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation wise this looks fine, though I think the command names are very long. I also wonder if it wouldn't make sense to make this an argument of the command using something like a CLI switch. I think kakoune does this if I'm not mistaken. What do you think @archseer @the-mikedavis?
Yeah I like kakoune's flags for this. It could be done as |
Personally, I don't have a problem with the length of the commands, because the prompt autocomplete works really nice. Are there precedents of commands that accept args/flags as proposed (I don't see any)? |
Not yet; this would be a first. But other commands could benefit from it (existing commands and future commands probably)
See #1288 (comment), sort/rsort could be turned into one command.
A completer could provide them as options
Kakoune has a nice way of showing these: |
It's very possible switches are out of scope for this PR (at least in a general way) so consider the following somewhat off topic, but I have thought it might make sense to pull in a CLI arg parsing lib to make use of in commands. I know there was resistance to this in the past for the main binary, but I think it would be a stronger justification to pull in a lib if it were used throughout the command palette. |
I like it!
Definitely :) In overall I'm still on the fence about switches in commands but I see how they could be useful. I suggest you to open separate issues/discussions to iron out details how they should look like in UI and to build a vision for the feature as a whole. Also I'm thinking if there will be some kind of scripting language in the future, will it cover this usecase? For example, we could have a method The question about this PR: do we close it or I can continue with it to fix the CI error to be ready for the merge? |
I'd like to see these commands merged, but I'd wait for @archseer's input for this PR and what we should do for names and/or switches. |
By the way, be sure to run |
I don't think it's necessary to add commands for this since there's a workaround: you can |
Yeah, I know, thanks! I was just waiting for the final decision. |
Disappointed that this didn't get merged. Many editors have this in their command palette and the |
With #4423, it could be done. However, it would depend on if the maintainers are okay with bundling some command sewuences. |
@the-mikedavis this to my config, but it doesn't work. I have to run the 3 commands manually... [keys.select]
S = [':set auto-format false', ':write', ':set auto-format true'] |
Was just looking for just this, and discovered as @andradei that the three-command approach wasn't working, auto-format continued. I don't need it often but when adding a new package to a Go project, lsp complains and removes the import line. I settled on another route: set a keybinding to ":toggle-option auto-format". |
@mwyvr That's the workaround I'm using. I think the next version of configuring helix will solve this and much more. Until then, it is what it is. |
This adds two commands to write and force write without auto format.
Closes #4853