-
Notifications
You must be signed in to change notification settings - Fork 177
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
feat: added bindings from vim index #120
Conversation
Hi! Thank you for doing this. Some remarks:
Thanks again for the effort. I'll keep this open for now, but won't merge it as is. I also don't have the time to work on this, and it's also not something I would use myself, but I can imagine new users might be interested in more presets. |
Thanks for the fast reply. I think I'll move the changes to |
I had an issue merging and somehow ended up creating a new PR for this. Apologies. |
no problem :) I did notice you've been reformatting most source files. This repo uses |
Thanks for the update. I've switched to `style, which drastically reduced the number of changed lines. I also updated the summary with more information about what I did. It seems like I was able to get this PR working again, so I ended up deleting the other PR. 😐 sorry for the confusion. |
@folke I haven't made any updates since you were away. Would you look over what I have so I can make any required changes? Thanks. |
Nice this looks awesome! As a new which-key user, I was wondering myself why the builtin "keymap" listings weren't complete/exhaustive and I'd really love to see this implemented. I also don't like how |
Thanks, I couldn't figure out why the keymap listings are so incomplete, either. For someone using Vim for the very first time, the limited number of suggestions is welcome. For longtime users, this is a frustration. Rather than enabing "extra" mode, this should be about disabling "noob" mode! As for the Greek characters, this is a surefire way to make Neovim completely, bewilideringly confusing to first-time users. However, there's the grain of a very good idea here in educating users which commands are motions, register- or mark- based, etc. etc. |
This PR is stale because it has been open 60 days with no activity. |
Summary
The built-in bindings described in which-key aren't exhaustive, and I would like them to be. This PR changes the preset keybindings. Namely, it adds the
extra
(default is off) andmouse
options to the preset configuration.The
extra
option changes other plugin descriptions (including presets, marks, and registers).The
mouse
option only works withextra
turned on.Different from the current preset, entering visual mode does not count as an operator.
Some Greek characters are used to indicate some information about the commands, just like how
+
is used to indicate a prefix by default:The suffix symbols are added at the beginning of descriptions to indicate what the current command expects next. The shorthands follow these symbols with a
,
to indicate what type of command the current keybinding is. The shorthands (especiallyΔ
) are used to decrease the length of descriptions.For example,
["c"] = "ξ,ΛΨ_(change) delete text, start insert"
meansc
expects a motion afterward and is a command that has the optional register prefix and can be undone;["0"] = "Ξ_Δ to the first char of the line",
means0
is a motion and the description translates to "cursor to the first character of the line;["<C-a>"] = "Ψ_add N to number at/after Δ",
means<C-a>
is a normal keybind that can be undone, it translates to "add N to number at or after the cursor".For each mode, there are the following tables:
mapping
: keybindings that are shown ifextra
is true;same_as
: keybindings that are the "same as" a keybinding already inmapping
, these keybindings are not shown;mode
: keybindings with the<C-\>
prefix for switching modes, these keybindings are not shown;mouse
: keybindings involving the mouse, these are shown ifmouse
is true;not_included
: keybindings are not shown either because their descriptions are too long, or there are issues properly displaying them;when
: shows what keybindings' descriptions change should a setting change (e.g., ifwrap
is on or off);not_used
: keybindings that are described with "not used" in vim documentation, yet are still included.The following settings are relevant to
when
:The following keybindings are "not included":
<C-v>{char}
(note that<C-v>{number}
is included{count}%
{count}<Del>
z{height}<CR>
gV
{count}:
There are commands that share a prefix with triggers for the marks, registers, and spelling plugins. In the relevant plugin files are the commands that are missing. They are not shown anywhere, but I would like them to be shown.
Since entering visual mode is no longer considered an operator, typing
v
will not show the operator-pending keybindings. This was done because the keybindings between operator-pending and visual-mode are not exactly the same.However, a deep mapping was added to the operator pending keybindings
v
,V
, and<C-v>
where they are prefixes to the visual keybindings. In this waycvj
(change visual down) shows all keybindings each step, butv
switches to visual mode without showing keybindings.Notes
There can be the following additional configuration options (not implemented):
<c-s-o>
vs.<C-S-o>
vs.<C-S-O>
).setup
to add a list of renames for the descriptions for the preset built-in keybindings.operators
option in the setup, there could also be amotions
option.h
=<Left>
=<C-h>
=<BS>
),wrap
).This a snippet of my nvim config:
The
<C-S-h>
and<Leader>h
keybindings were used to test the descriptions. I was hoping that there is a way to show WhichKey automatically when no key is pressed, but I could not find a way.Updates
I switched to
stylua
, and in doing so, it seems I was still using this branch, so I removed the other PR.There are no longer keymap conflict warnings.
Issues
g?
is an operator, when typingg?
, all motions are shown next. This also includes the?
motion. However,g??
is a keybinding that encodes the whole line. In the current configuration, there is ag??
prefix andg??
command. This causes?
to be shown 2 times when pressingg?
, but check health does not show any issues.%, a, i, g
). To resolve this, I added a check insidekeys.lua
to not add the operator-pending keybindings to visual mode ifextra
is true.