the key bindings is the last thing I hate vscode. the vim/emacs extentions can't work as expected.
@transtone All the keybindings can be customized via keybindings.json. Also, extensions can customize them.
Here is for example an extension that changes the default keybindings to be Sublime-Style: https://github.com/Microsoft/vscode-sublime-keybindings
IMHO this is a great opportunity to get started with writing an extension. More documentation on writing an extension at https://code.visualstudio.com/docs/extensions/overview
@alexandrudima Spacemacs's keybinding is very different from Sublime or others.
I have tried cmd+k cmd+k to catch something like space ss space sag but failed.
Keybindings allow only 2 sequential keys, why not to just extend quantity to 10 for example?
For example:
"key": "space s c", "command": "workbench.action.showCommands", "when": "!inQuickOpen && vim.mode != 'Insert Mode'"
@edvail If you want to capture keys that produce text (i.e. not ctrl+ something, alt+ something, etc), the correct way to do it (in the sense of different keyboard layouts) is not via keybindings which deal in terms of "keys" (not characters), but via overwriting the editor's type command and then interpreting the input and/or delegating back to default:type.
This is demonstrated in the vim sample extension we have created to show how one can do such type of input handling:
https://github.com/Microsoft/vscode-extension-samples/tree/master/vim-sample
https://github.com/Microsoft/vscode-extension-samples/blob/master/vim-sample/src/extension.ts
Now we can use
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": [
"<leader>",
"b",
"b"
],
"after": [],
"commands": [
{
"command": "workbench.action.quickOpen",
"args": []
}
]
}
],
"vim.leader": "<space>"
to get SPC bb in vscode with https://github.com/VSCodeVim/Vim.
๐ ๐ ๐
@CodeFalling I did the same for remapping a few already. Recreating spacemacs' complete mapping would be impossible, but it is certainly possible to already map the most important mappings to native vscode functionalities.
Here are some keys that I already have in my config:
space tabspace b dspace f rspace f fspace f sspace q qBut there are probably others that can be mapped to native vscode functionalities.
This is only possible through VSCodeVim though, so it would not be possible to recreate the Emacs mode, only the Vim mode.
I would be interested to collaborate and share on this topic. To get started we can elaborate a base configuration that can be included in user's settings.json. We would then be able to see if a community would gather around this.
What do you think?
@StreakyCobra I think it is a great idea and Spacecode can be a great name for this config.
Below is what I got so far and it already makes my config file harder to maintenance and some time make the editor unresponsible (if the config file contains invalid JSON token).
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": [
"leader",
"1"
],
"after": [],
"commands": [
{
"command": "workbench.action.focusFirstEditorGroup",
"args": []
}
]
},
{
"before": [
"leader",
"2"
],
"after": [],
"commands": [
{
"command": "workbench.action.focusSecondEditorGroup",
"args": []
}
]
},
{
"before": [
"leader",
"3"
],
"after": [],
"commands": [
{
"command": "workbench.action.focusThirdEditorGroup",
"args": []
}
]
},
{
"before": [
"leader",
"p",
"f"
],
"after": [],
"commands": [
{
"command": "workbench.action.quickOpen",
"args": []
}
]
}
],
By the way, would you mind share your keybinding config? Creating all these keybindings and test them through are going to take ages.
๐ ๐ ๐
Hi @li-xinyang,
I started a project to gather a community on this topic:
https://github.com/StreakyCobra/VSpaceCode
SpaceCode is a name already quite used on internet, so I chose VSpaceCode instead.
I already grouped all of our configurations (yours, @CodeFalling and mine) in the project, and created a README for presenting it and explaining how to use it.
The idea is now to try to gather interested people in https://github.com/StreakyCobra/VSpaceCode/issues/1 to discuss what direction the project should take (configuration, extensions, โฆ).
I love Spacemacs, and trying out to discover another great editors and IDEs, would be great if in the Visual Code were possible to recreate a full mix between Vim and Emacs keybinds, just like the intent of Spacemacs. I think this could be a great addon to the VSCode core itself, because this keymappings can improve the workflow for anyone. It's much more comfortable to input SPACE F S to save a file than CTRL+S and more friendly to memorize. SPACE Tab and quickly we are in another file, and so on. I have used for a while this project called Proton that brings the good from both worlds: Spacemacs and Atom. Take a look into it to get some inspiration. Something like this in VSCode would be awesome, definitively.
We try to keep VS Code lean and we think the functionality you're asking for is great for a VS Code extension. Maybe you can already find one that suits you in the VS Code Marketplace. Just in case, in a few simple steps you can get started writing your own extension. See also our issue reporting guidelines.
Happy Coding!
Most helpful comment
I love Spacemacs, and trying out to discover another great editors and IDEs, would be great if in the Visual Code were possible to recreate a full mix between Vim and Emacs keybinds, just like the intent of Spacemacs. I think this could be a great addon to the VSCode core itself, because this keymappings can improve the workflow for anyone. It's much more comfortable to input SPACE F S to save a file than CTRL+S and more friendly to memorize. SPACE Tab and quickly we are in another file, and so on. I have used for a while this project called Proton that brings the good from both worlds: Spacemacs and Atom. Take a look into it to get some inspiration. Something like this in VSCode would be awesome, definitively.