-
-
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 refactor #1179
Comments
I think we should keep on mind to put the most frequency keymaps with the easiest to reach key. |
I think with the planned plugin system and remapping support we gain with it it should be fairly easy to implement whatever layout. For example, you can make a custom "NNBnh keymap" that is independent of the default helix mapping. See also: #165 (comment) and following comments. I believe that the default mapping of helix probably will not change by your proposal. On the flip side this means you can use more "agressive" remappings which deviate from the mainstream because you don't have to find a compromise with the existing mapping. |
I do agree on most of the stuff @NNBnh mentioned (I didn't look closely at every key). To make this contributor friendly it would be better to split this into multiple smaller issues and then use milestones to group them. So even if people disagree, other parts can still continue. Example scope for an issue, change goto mode to select text for those that make sense (E.g. |
I have this two on my todo list for a while, but currently doesn't have much time to sort it out. I think it's time to take this into action:
I will definitely focus on this next year on this repo. Here are some old/outdate idea and implement of this saga: Thank you guy for the support and feedback! |
I have always looking for a modal terminal editor that use caret style cursors,
Helix currently has implement Gap indexing #376 which mean the caret cursor dream is not far from becoming the reality.
So as Cessen said:
Let's discuss about refactor the keymap to take advantages of it (and more). Here is my attempt:
Note
Because of a defined Helix's goal from
vision.md
:I feel more confident making some brave decision that focus way more on consistency.
Also i found a lot of my idea have been implemented on Pepper editor
so some keys are take inspiration from it's key bindings:
The final results will look like this:
Current keymap
I thinks the movement will stay pretty much the same except for moving to the end of an object:
Because the implement Gap indexing, moving to the end of an object (e.g: a word) will place the cursor to the right of the last character of the object.
Text inserts
For consistency, any actions that insert text to the cursor will have the following behaviors:
Because insert text will replace the selection:
change_selection
from cchange_selection_noyank
from a-creplace_with_yanked
from R.copy_selection_on_next_line
,copy_selection_on_prev_line
from C, a-c to c, C.Because of the same reason, users don't need to different "insert" and "append" anymore:
append_mode
from a.prepend_to_line
from I.append_to_line
from A to I.paste_before
from P.paste_after
topaste
.shell_append_output
from a-!.And therefore we should make flipping selections as easy to press as possible:
flip_selections
from a-; to a.append_to_line
andprepend_to_line
.Movement key
Word movement
I found that
move_next_word_start
is just a legacy key that people get used to from Vi.Where
move_next_word_end
is much more superior in this navigation system,not to mention it's behavior is consistent with
move_prev_word_start
.I know this is a controversial decision but Pepper and literally all non Vim-like editors agree with me on this one:
move_next_word_start
,move_next_long_word_start
from w, W.move_next_word_end
,move_next_long_word_end
from e, E to w, W.Find and till
But after some consideration from my own experience and listen to @raphCode suggestion:
I decided to keep the find keys, but the till keys still need to go in order to make room for the "No Alt-based keys" section.
Movement behavior
As pointed out in keymap brainstorm wiki and #863, Helix currently need a bit more keypress to do some basic action than it's should.
To improve this, i suggest:
In normal mode, all movement keys (w, W, b, B, f, F) and goto mode key should do the following actions in order:
This will make most basic action in Helix have the keypress count as low as in Kakoune.
E.g
Deletes till the end of the line:
Changes behavior
In normal mode, if a <n> number is assigned, it will have an effect to <n> lines or the next <n> charaters base on each oporation type:
replace
switch_case
switch_to_lowercase
switch_to_uppercase
yank
delete_selection
delete_selection_noyank
format_selections
toggle_comments
No Alt-based keys
I have remap nearly every keys on Vim, Kakoune, Emacs
and i alway include a feature: a "normal" mod key in insert mode (which i explain in more detail at #1064).
To achieve this, we mustn't have any Alt-based keys by defaults.
Plus as mentioned in keymap brainstorm wiki:
Move
delete_selection_noyank
from a-d to D.Move
shell_pipe_to
from a-| to \.Move
split_selection_on_newline
from a-s to c-l.Move
switch_to_uppercase
from a-` to ^.Move
earlier
,later
from a-u, a-U to t, T.Move
rotate_selections_forward
,rotate_selections_backward
from ), ( to L, H.rotate_selection_contents_forward
,rotate_selection_contents_backward
from a-), a-( to ), (.Move
keep_primary_selection
from , to e.Move
remove_primary_selection
from a-, to E.Move
repeat_last_motion
from a-. to ,.Move
remove_selections
from a-K to R.Future keymap
The following keymaps are in
TODO.md
keys.md
:ensure_selections
(ensure selections are in forward direction) to A.join_selections_linebreak
(join selected lines and select spaces inserted in place of line breaks) to c-j.merge_selections
(merge contiguous selections together) to M.duplicate_selections
(duplicate each selection / generating overlapping selections) to +.merge_overlap_selections
(merge overlapping selections) to -.paste_all
(paste every yanked text) to P.play_macro
to q.record_macro
to Q.stop_record
to esc.jump_save
(save selection on jumplist) to c-s.Because as we stased: "we mustn't have any Alt-based keys by defaults", the following key need some more thought out placement.
Paragraph
As explained in #753:
paragraph_next
to }.paragraph_prev
to {.Jump mode
As discussed in
#274#510 (#1162):jump_mode
to '.The text was updated successfully, but these errors were encountered: