-
-
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
Keymap discussion #165
Comments
I've been using helix for a day now, and I'm finding some bindings or lack of bindings a bit frustrating. I guess what I think would be valuable to know is if this project is aiming to augment the vim mappings or is planning to write its own set of mappings. Furthermore, I think that this quite important for the adoption of the project that the key mapping interface is clear whether it's copying the vim interface or making its own as vim mappings for vim users are second nature to most. I personally would hope that the project adopts the majority of the basic vim interface. I also understand that the project also has the potential to change some features where it's desirable for UX. By that I am referring to the multi cursor support. However, perhaps we could also implement options for users? For example, Emacs users could set a configuration setting to select an Emacs key mapping. Likewise for vim. I would imagine that would be quite time-consuming to implement. Does Helix want to be a post-modern vim? Or its own editor like atom or VS Code with its own key bindings? I personally believe building on top of vim is the better option as it would maintain portability in the keybinding interface for users. |
We're basing the keymappings quite heavily on Kakoune, so you might find this helpful: https://github.com/mawww/kakoune/wiki/Migrating-from-Vim The idea is that you always start by making a selection first (that way it's interactive and you see that you selected the right thing), then you operate on it. We're currently diverging from kakoune by introducing a selection mode (I've also called it the "extend mode") which is similar to vim's visual mode: In this mode movements extend the selection instead of moving it. So We're copying kakoune's goto mode (It's a lot easier to memorize Are there any specific keymaps you're missing? |
I heavily rely on the |
Yeah so the equivalent of vim's textobjects would be an object selection mode. Something like This still needs to be implemented but it's important so I'd like to focus on it soon. We're also looking at structural matching via tree-sitter so that you'd be able to select / move entire functions, etc. In the same vein as https://github.com/nvim-treesitter/nvim-treesitter-textobjects and similar libraries. |
@rieger-jared Maybe you should try out kakoune first to understand some of the concepts helix is based on. Helix currently is in a very weird keybinding state I would say, some is there some is not there, which I start writing and updating the wiki for stuff I find difficult. One issue I see helix have is we don't have the |
Quick opinion on And we get |
discussed on matrix (edited slightly to depend less on context):
|
No, we can't really do that. |
In line-wise extend mode you should not use |
i'd like to add that in my week or so using kakoune i've definitely missed |
I would like to see a plan for keybindings. To change editor is a big time investment, and adopters need to see if it is worth it in the end. |
Can you expand on your concerns about the keymap in more detail? You had a lot to say in the matrix chat, and I think it would be good to capture those specific concerns here. |
It all boils down to: I (and other adopters) want to know how all extra object bindings will end up without involving non intuitive non mnemonic characters and or alt/ctrl. If early adopters end up with bad bindings along the road, time and effort will be a bit wasted. |
If it's alright for you, I would really appreciate if you could provide additional samples and use cases on the wiki page. Especially, as you appears to be advocating for vim keybindings, I'm interested in samples where you think kakoune performs badly and VIM is good. |
I have an idea. What if we can make use of |
That's a very clever way to do it; the main issue I see with it is that they are harder to reach and selecting inside and around are very common operations. |
While not a bad alternative, I'm not very happy with
I may repeat myself, but I would map |
These are quite similar in action, how about have them on the same keybinding, as they are in different modes. If they are frequently used - on m - otherwise something less short. (I don't use matching bracket particularly often myself, and flip selection I don't know yet). m | Jump to matching bracket |
Alternatives to my text object inner
|
I just realized that helix is hard to change till end of line. |
It may be of interest to take a look at different keyboard layouts before deciding on a particular key. As an example the |
As someone who switched from vim to kakoune, my config includes a "vim habits" section that includes: One pain point in kakoune is that binding |
I think plugin should have the ability to fix this if the keymap and commands is part of the plugin. I just add a tag for plugin because I think it is slightly related to plugin. |
I want to bring up a change to the What I currently miss is a convenient way to extend the selection up as well as shrink the selection by one line up/down. This could be achievable with redefining the Select current line, if already selected, extend to next line Current behavior is to disable the flip, and extend the selection by one line regardless.
If selection starts in the same line, shrink to start, else shrink to previous line. |
RE: all the posts about linewise selections.The [keys.normal]
J = ["extend_to_line_bounds", "select_mode"] # Select whole line, then select lines downwards
K = ["extend_to_line_bounds", "select_mode", "flip_selections"] # Select whole line, then select lines upwards
"A-j" = "join_selections" # Join lines
"A-J" = "join_selections_space" # Join lines, selecting the space in between
X = "remove_primary_selection" # Remove primary selection
x = "keep_selections" # Keep selections that match regex
"A-x" = "remove_selections" # Remove selections that match regex
[keys.select]
J = ["extend_line_down", "extend_to_line_bounds"]
K = ["extend_line_up", "extend_to_line_bounds"]
"A-j" = "join_selections"
"A-J" = "join_selections_space"
X = "remove_primary_selection"
x = "keep_selections"
"A-x" = "remove_selections" In short, Upsides:
Downsides:
Side note: I've never used the |
After testing with your config, I can agree :)
After all I'd love these changes! |
Yes, that is one of the things I meant with downside no 2. I think it would be beneficial to have commands which do something like this but stay in normal mode. I.e. more like how the current x command works, but WITH a proper inverse and a sensitivity to the orientation of the selection. |
@chtenb So what's the common procedure in this community? |
I think the first step would be to introduce proper commands for J/K, as outlined in the previous post, such that people can use a good version of these bindings. After that I don't know. People generally don't like change they didn't ask for, but in the end it's up to the maintainers opinion. If enough people seem to like it, we can at least document the option somewhere more visible then, perhaps in a wiki entry or something. |
Is there a keymap for selecting an entire line then going upwards? Pressing Also trying to replicate block selection |
If you look 5 comments up, you'll read an entire post dedicated to this. |
Thanks, though I did check, and I only noticed the |
Hi, I have been checking helix for the first time as a [neo]vim lover. |
Hi. |
@mostafaqanbaryan I think this is kind of tangential to the issue of Helix's default key map. Zellij purposefully uses lots of key combos that conflict with many terminal applications, not just helix. It's a known issue which even the author is not happy with. Tmux does not have this problem with its default key binds because of the way it uses leader sequences ( |
This comment has been minimized.
This comment has been minimized.
I've had some weird issues with tabbing in insert mode, that I just realised is caused by |
The hardcoded bindings are the biggest problem (IMO), and the easiest to fix. After all, if the user can change the bindings, suboptimal defaults are far less of an issue. For example, we cannot configure Helix to use v for View Mode (with V for the sticky variant), as there's no Personally, I use Escape to switch to Normal Mode, except in Normal Mode, where it switches to Select Mode instead (toggling between Normal and Select modes). This leaves v spare, so naturally, I'd prefer to use that for View Mode. Likewise, I use Enter to move focus to the command line (so I don't need to hold Shift and enter a colon). This also allows me to double tap Enter to rerun the last command. This makes the colon redundant, as it cannot be rebound. I'd also like to rebind the comma and dot keys (along with their angle brackets), as it'll allow me to manage multiple cursors far more intuitively, but the dot key cannot be rebound. I could provide more examples, but you get the point. I can't see any reason to special-case and hardcode certain bindings. |
Why not adopt VIM's keymaps as they are. I tried hx today and it's really frustrating when I perform:
I believe there will be more to find myself. I strongly recommend to adopt VIM's default keymaps as they are, at least for the most frequently used ones for minimalist users. That way migrating from VIM to HX would be seamless for the future adopters. |
@crazyoptimist This has been discussed to death already and we've explained several times on why that won't happen. Helix is a different editor and the internals would have to be rewritten for this to work (in which case we're just rewriting vim). It's modal but that doesn't imply identical to vim. If you just want vim, why not use vim? This thread is very generic and various changes have been intermixed here. For a general discussion, github discussions are a better option. For an individual, actionable change or proposal a new issue should be created. |
This comment was marked as abuse.
This comment was marked as abuse.
@robclancy PR welcome! Let's see how easy it is to implement |
This comment was marked as abuse.
This comment was marked as abuse.
I closed the issue because "keymap discussion" is not an actionable issue with a resolution. Feel free to open a "vim keybindings" issue and I'll give you the same douchey response there giving you the opportunity to prove me wrong and show how easy it is to implement in helix ;) |
This comment was marked as abuse.
This comment was marked as abuse.
Alright then, please use a different editor. |
This comment was marked as abuse.
This comment was marked as abuse.
Yes and my point was we had 239 comments that weren't closely related and should be opened as separate issues. Again, I don't appreciate your tone and you're welcome to stop using helix and use something else. |
Since we take some keys from both vim and kakoune, we want to reduce the issues of taking the worse of both worse.
Currently I dumped some idea in https://github.com/helix-editor/helix/wiki/Keymap-brainstorm and will continue to update that for some time, putting in some painful edit operations in vim or kakoune or both. Then we may want to try addressing them in helix by picking the best of both worlds.
Maybe our next step is to move towards implementing some of the missing keys and re-iterate and see if we have any painful points while working with helix.
The text was updated successfully, but these errors were encountered: