helix
helix copied to clipboard
Move default comment toggle binding to pound
This is a common rebind in both the helix and kakoune community. Some reasons this is desirable:
- Pound is a common symbol for commenting in many languages
- Pound is not bound to anything else, and it is not obvious what else it would be bound to
-
C-c
should really be reserved for cancelling subshells from:sh
,|
and friends
Most sensible alternatives are taken:
-
/
is search -
*
adds selection to search register -
-
is not common, and though not currently taken, may make sense as the opposite of_
, for another PR to implement. -
c
change selection -
A-c
change selection w/o yank -
C
copy selection down -
A-C
copy selection up
C-c does work for closing completion menus / signature help so I think it should work to have it cancel long-running subshell commands if there is one running.
I'm split on this. I think it would be really intuitive for languages with #
comments but less so for languages with other tokens. C-c as in comment feels easy to remember across languages
What's the appropriate way to move this forward?
I've been testing this out but I'd like to see more opinions. #
is a nicer key but I find it harder to type than ctrl-c
:/
I think it is a far better choice to use #
than ctrl-c
, and here is why:
-
ctrl-c
already has a well established meaning, and that is to to interrupt a process, not make a comment. I assume using it for comments is some abominable left over from VS Code and Microsoft. -
ctrl-c
is already used inside Helix to cancel things, I use it all the time for things like closing the file picker. This links nicely mentally to 'interrupt a process' in the terminal. - I also find
#
much easier to type, but maybe that is my keyboard. - This PR has 14 thumbs up and no thumbs down showing the idea is popular
Why not ctrl-/
like most editors? It does not seems to be bound to anything.
I think #
is better than C-c
, especially for non-so-common actions like commenting.
Given that, how about <Space>c
? I don't think is bound. Ideally <Space>c
for line-wise and <Space>C
for block-wise commenting.
In general I much prefer a home-row friendly approach, like gl
and gh
instead of 0
and $
.
I think this is a good choice since #
is used as comment for a lot of stuff ranging from programming languages to configuration, as compared to /**
or //
or ;
.
For context:
- vscode uses
C-/
, which we can use too - kate + vim keybinding uses
C-/
- online editor like play.rust-lang.org uses
C-/
- vim-commentary uses
gc<motion>
, have more power to know what to comment but translated to helix, that isgc
which is taken for goto window center - kakoune uses
#
, which is proposed here - doom emacs uses
C-x
C-j
, this is the worse since it conflicts with IME key and I have to typeC-j
twice
So I guess for non-modal editors or vim-based keybindings (#
was taken for backward search), C-/
is quite popular, but for modal editors, #
is a good choice too.
If we want to make it easy for anyone (including from the ones mentioned above), C-/
is better key it makes it easier to learn and at the same time allow extension for non-modal parts of helix like picker or search, that we can use this as second layer filter. But otherwise, #
is better since it is not used and it represents how most of the comments look like.
Given that this is type of comment is also quite widely used, I created a pull request to set it as default instead of //
in https://github.com/helix-editor/helix/pull/6470.
But for helix and kakoune case, #
is not suitable for any other keys, so might as well just use it.
Once the docs are updated, I guess this can be merged given that there is no one opposing here.
C-/ is not nice for keyboards with umlaut-keys -> have to press 3 keys (ctrl+shift+7)