Skip to content
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

"Normal" mod key in insert mode #1064

Closed
NNBnh opened this issue Nov 10, 2021 · 4 comments
Closed

"Normal" mod key in insert mode #1064

NNBnh opened this issue Nov 10, 2021 · 4 comments
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements

Comments

@NNBnh
Copy link
Contributor

NNBnh commented Nov 10, 2021

We often find ourself want to insert a few characters then quickly moving/editing around over and over... which we have to exhaustingly pressing i...Esc, i...Esc, i...Esc, ...

Both Vim and Kakoune address this issue have a key to escape to normal mode for a single command in insert mode:

From Kakoune keys doc:

<a-;>, <a-semicolon>: escape to normal mode for a single command.

This approach doesn't improve anything because it's still required 2 keys press ([ Alt + ;, cmd ] vs [ Esc, cmd, i ]) only escape to normal mode for a single command. This is helpless when i just want to move to the right 2-3 characters.

Therefore i suggesting a solution that i have been using at my Vim, Kakoune, Emacs (lost config) nearly-every-keys-remap and really like it:
The simple solution it's having Alt as a "Normal" mod key in insert mode, user can holding it to access normal mode's commands ([ Alt + cmd ]).

The "Normal" mod key can be config to any mod keys: Alt, Ctrl, Shift (?!), Super, Meta, ... (List of mod keys) This is for the GUI Helix #39 's user who want to config every keys...

Yes, i know as mentioned in keymap brainstorm wiki:

we prefer not to hold keys (shift, ctrl, alt)

But in this case:

Example

Cursor at beginning of file, fixing from this:

Th diting model is very heavily based on kakoune;
durin development I found myself agreeing with most of kakoune's design decisions.

to this:

The editing model is very heavily based on kakoune;
during development I found myself agreeing with most of kakoune's design decisions.
Approach Keys press Count
Mode switch approach llieEsclieEscjlig 13
Vim and Kakoune approach llieA-;leA-;jA-;lg 15
Normal mod key approach llieA-leAjlg 11

Ajl = Alt downjl {Alt release} = 3 keys press

This is just a small example, but if we're in a bigger scale situation, the keys press will add up.

The normal mod key is the most elegant approach.

Not to mention:

Accessibility

Many people just want to find a good terminal-based text editor but doesn't want to be forced using a module workflow of people want to get used to module workflow without feel so confused...
With this feature, user can mimic the non-module workflow by set insert as defaults mode (some how) then use the normal mod key for (as the noob usually call) shortcuts, Helix then slowly but surely introduced them to the amazing module workflow.

And also solved #334.

Support prompt mode as well

The current prompt's keymap is nothing like normal mode:

Normal Prompt Description
Esc Esc, C-c Close prompt
b A-b, A-Left Backward a word
h C-b, Left Backward a char
e A-f, A-Right Forward a word
w C-f, Right Forward a char
gl C-e, End Move prompt end
gh C-a, Home Move prompt start
d delete, C-d Delete previous char
i C-p, Up Select previous history
k C-n, Down Select next history

A "Normal" mod key in prompt mode would make the keymap consistent across all mode. Of course many keys that are too complex or lack of practicality will do nothing, any keys that prompt user will do nothing or just switch the current prompt to that prompt instead (A-/ in command mode prompt is equivalent to Esc/ which switch to search prompt).

Drawback

As many can point out: commands map with Alt won't be able to access via normal mod key. We can improve this by remap all defaults Alt-based commands to other keys which i have attempt here.

@NNBnh NNBnh added the C-enhancement Category: Improvements label Nov 10, 2021
@kirawi kirawi added A-helix-term Area: Helix term improvements A-keymap Area: Keymap and keybindings and removed A-helix-term Area: Helix term improvements labels Nov 11, 2021
@NNBnh NNBnh mentioned this issue Nov 26, 2021
@Omnikar
Copy link
Contributor

Omnikar commented Nov 26, 2021

I don't know about others but I personally like alt keymaps, and don't really find it as much of a hassle to repeatedly switch between normal and insert mode; but this is such a big change that I don't think the classic "make it configurable" would be much of an option…

@NNBnh
Copy link
Contributor Author

NNBnh commented Nov 27, 2021

After some consideration, I decided to scrap this idea because user could already achieved this by manually remapping even though it took a lot for work. On the bright side, because Helix using toml file to config, user could write a script to generate a toml file with all keybind remap to alt-... combo in Insert mode.

@NNBnh NNBnh closed this as completed Nov 27, 2021
@goyalyashpal
Copy link
Contributor

@goyalyashpal
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

4 participants