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

feat: multimode keymap #603

Merged
merged 1 commit into from
Mar 31, 2023
Merged

feat: multimode keymap #603

merged 1 commit into from
Mar 31, 2023

Conversation

fecet
Copy link
Contributor

@fecet fecet commented Mar 31, 2023

I'm in the process of migrating my Neovim configuration and I have many nomode keymaps in VimL like:

noremap J=5j

This applies the keymap in "n", "v", and "o" modes. To achieve the same effect in bind.nvim_load_mapping, I currently have to write:

["n|J"] = map_cmd("5j"):with_silent():with_noremap():with_desc("long j"),
["v|J"] = map_cmd("5j"):with_silent():with_noremap():with_desc("long j"),
["o|J"] = map_cmd("5j"):with_silent():with_noremap():with_desc("long j"),

This appears to be very cumbersome and unnecessary. Therefore, I created this PR so we can write:

["nvo|J"] = map_cmd("5j"):with_silent():with_noremap():with_desc("long j"),

Please review this PR and let me know your thoughts.

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Mar 31, 2023

This is great! Similar to native neovim vim.keymap.set syntax, it can reduce lots of boilerplate. Will test soon.

Copy link
Collaborator

@CharlesChiuGit CharlesChiuGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Mar 31, 2023

Small reminder. It would be better to use feat/multimode-keymap instead of just multimode-keymap for the branch name.

@CharlesChiuGit CharlesChiuGit added the keymap Keymap related issues label Mar 31, 2023
@ayamir ayamir merged commit b57071b into ayamir:main Mar 31, 2023
1 check passed
kang8 added a commit to kang8/nvimdots that referenced this pull request Apr 1, 2023
kang8 added a commit to kang8/nvimdots that referenced this pull request Apr 1, 2023
kang8 added a commit to kang8/nvimdots that referenced this pull request Apr 1, 2023
kang8 added a commit to kang8/nvimdots that referenced this pull request Apr 1, 2023
kang8 added a commit to kang8/nvimdots that referenced this pull request Apr 3, 2023
@fecet fecet deleted the multimode-keymap branch April 3, 2023 11:04
boomker pushed a commit to boomker/uvcode-nvim that referenced this pull request Apr 4, 2023
feat: define multimode keymaps in one expression.
(cherry picked from commit b57071b)
YanTree pushed a commit to YanTree/nvim that referenced this pull request Apr 9, 2023
feat: define multimode keymaps in one expression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keymap Keymap related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants