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(bindings)!: enable bindings through configuration #1558

Merged
merged 18 commits into from
Oct 23, 2023

Conversation

xiyaowong
Copy link
Collaborator

@xiyaowong xiyaowong commented Oct 22, 2023

This PR aims to help users customize keyboard shortcuts more easily. Additionally, it makes maintenance easier by using scripts to generate keybindings.

Breaking changes:

Due to the changes in the "when" expression, the previous method of removing the keybinding will not work. e.g.

{
    "command": "-vscode-neovim.send",
    "key": "ctrl+a",
    "when": "editorTextFocus && neovim.ctrlKeysInsert && neovim.mode == 'insert'"
  }

Configuration

Deprecated:

  • useCtrlKeysForNormalMode
  • useCtrlKeysForInsertMode

New:

  • ctrlKeysForNormalMode
  • ctrlKeysForInsertMode
  • editorLangIdExclusions
  1. Automatically generate the same "when" clause.
  2. Predefine all ctrl-* shortcuts and enable them through configuration.
    e.g. vscode-neovim.ctrlKeysForNormalMode: ["a", "b", "up"], this enables <C-a> <C-b> <C-up> in non-insert mode

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
scripts/keybindings/util.cjs Outdated Show resolved Hide resolved
@xiyaowong xiyaowong changed the title feat(bindings): enable bindings through configuration feat(bindings)!: enable bindings through configuration Oct 23, 2023
@xiyaowong
Copy link
Collaborator Author

I want to complete the restart feature and handle viewport synchronization in the 1.0.0 release. Currently waiting for this PR 😄

"uniqueItems": true,
"items": {
"type": "string",
"enum": [
Copy link
Member

Choose a reason for hiding this comment

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

There are a lot of other possibilities here, like :1234567890,.\ and space/pgup/pgdown/esc. Do you think it is worth it to include more?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We only need to define the relatively common ones. This configuration option itself is for auxiliary purposes, so it’s fine to have a little more.

Copy link
Member

@theol0403 theol0403 left a comment

Choose a reason for hiding this comment

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

Is the purpose of this PR to simplify passing through additional bindings to nvim? Then we might want to consider ALT bindings too.

@xiyaowong
Copy link
Collaborator Author

The Ctrl shortcut key is the most commonly used and many users will customize it. As for the Alt shortcut key, I believe very few people will use it. If someone needs it, they can honestly define their own keybindings.

package.json Outdated Show resolved Hide resolved
Copy link
Member

@theol0403 theol0403 left a comment

Choose a reason for hiding this comment

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

While you're here, can you remove the space in the script file names. Just do 2_normal_mode.cjs etc.

@xiyaowong
Copy link
Collaborator Author

@theol0403 By the way, may I ask how you make this kind of commit? It seems like you are just correcting previous commits.

image

@theol0403
Copy link
Member

@xiyaowong I made a mistake when merging your API PR, and release-please didn't pick up that change, to put into the changelog. So I just created an empty commit so that release-please would see the change.

@xiyaowong
Copy link
Collaborator Author

I’ve learned something new.

@theol0403 theol0403 merged commit 222a131 into vscode-neovim:master Oct 23, 2023
8 checks passed
@xiyaowong xiyaowong deleted the feat/convenient-keybindings branch October 23, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turn off option for Additional Key Bindings Edamagit support Turn off for specific filetypes (draw.io)
2 participants