VSpaceCode
» Spacemacs-like keybindings for Visual Studio Code
Table of Contents
Presentation
This project tries to mimic Spacemacs key bindings in VSCode.
Heavy Spacemacs users have trained their muscle memory around the mnemonic key bindings that Spacemacs provides, and usually they start missing them when using other text editors. The goal of this project is to provide a configuration that maps Spacemacs key bindings to VSCode functionalities. This will allow users to continue using their muscle memory and and the mnemonics they know in VSCode.
It is not possible to replicate the full Spacemacs experience within VScode, but it is at least possible to map some key bindings to functions offering the same features as Spacemacs does. For instance, SPC g s in Spacemacs opens git version control through Magit, so it make sense to map it to open the "Source Control" view in VScode. A list of the currently remapped key bindings is available in the Keybindings section.
The Installation can currently not be automated as it requires manual interventions, and updates have also to be resolved manually. This project is young and the direction it should take is not really clear yet. This is discussed in this issue. Feel free to participate in this discussion if you have insightful ideas.
Author: | Fabien Dubosson |
---|---|
License: | MIT (See LICENSE) |
Installation
First you will have to install VSCodeVim in order to make VSCode
vim-compliant. To do so, press Ctrl + P, enter ext install vscodevim
and then press Return. You can then press the Install
button, wait
for it to finish, and then Reload
the editor by clicking the associated
button.
To set up VSpaceCode, simply merge the content of the settings.json file with
your own settings. To do so, press Ctrl + Shift + P, enter user
settings
and then press Return:
- If you don't have any VSCodeVim configuration yet, you can simply copy/paste
the content of settings.json (without the top-level brackets) somewhere into
your
settings.json
. - If you already have some VSCodeVim configurations, you will have to manually
copy/paste the parts of settings.json into the corresponding
vim.otherModesKeyBindingsNonRecursive
section of yoursettings.json
.
In any case it is recommended to keep the configurations you take from here
grouped in your settings.json
so you can easily update them by just
copy/pasting the relevant parts.
Note for Mac users
On Mac, you will need to change the setting for <leader> f f
from:
"command": "workbench.action.files.openFile"
to:
"command": "workbench.action.files.openFileFolder"
Keybindings
The following keybindings are currently configured:
Key bindings | Description | Remark |
---|---|---|
leader space | Run command | |
leader tab | Next editor | |
leader ; ; | Comment line | |
leader ' | Toggle terminal | Open terminal effectively |
leader / | Find in files | |
leader 1 | Focus first editor group | |
leader 2 | Focus second editor group | |
leader 3 | Focus third editor group | |
leader b b | Quick open (show current buffers) | |
leader b d | Close active editor | |
leader b n | Next editor | |
leader b p | Previous editor | |
leader b s | Scratch buffer | |
leader e l | List errors / problems | |
leader f e | Show your settings file | Shorter binding (by 'd') |
leader f f | Open file | |
leader f r | Open recent (show recent files) | |
leader f s | Save file | |
leader f t | Show explorer view | |
leader f y | Copy current file path | Doesn't show the path |
leader g b | Git checkout | |
leader g c | Git commit | |
leader g d | Git delete branch | |
leader g f | Git fetch | |
leader g i | Git init | |
leader g m | Git merge | |
leader g p | Git publish | |
leader g s | Show source control view | |
leader g S | Git stage | |
leader g U | Git unstage | |
leader h d | Help describe keybindings | |
leader i s | Insert snippet | |
leader j = | Format document | Better than Spacemacs |
leader j j | Easymotion to character | |
leader j l | Easymotion to line | |
leader j w | Easymotion to word | |
leader l d | Close folder | |
leader p f | Quick open (allow to open any project file) | |
leader p l | Open folder project | |
leader p p | Open recent (show recent folders) | |
leader p t | Show explorer view | |
leader q f | Close window | |
leader q q | Close window | |
leader q r | Reload window | |
leader r s | Find in files | |
leader s e | Rename symbol | Works only on symbols |
leader s j | Go to symbol in file | |
leader s p | Find in files | |
leader s P | Find in files with selection | |
leader T F | Toggle fullscreen | |
leader T m | Toggle menu bar | |
leader T s | Select color theme | |
leader T t | Toggle activity bar | |
leader v | Expand region | No transient state |
leader V | Shrink region | No transient state |
leader w d | Close editors in group | |
leader w h | Previous editor group | |
leader w H | Move editor group to left | |
leader w l | Next editor group | |
leader w L | Move editor group to right | |
leader w m | Maximize | |
leader w v | Split window | |
leader w w | Next editor group | |
leader w W | Previous editor group | |
leader x s | Sort lines | |
leader x w | Trim whitespace |
Contributing
Contributions are welcome. Spacemacs has more than one thousand key bindings and it is very probably that the contributors of this project are not using them all. Feel free to open pull requests if you have some interesting mappings that do not exist yet. Please try to make the following changes in a single commit:
- Keep bindings sorted in settings.json
- Add the corresponding line in the Keybindings section of this README
- Include your name in the Contributors section of this README
If you are writing and testing some keybindings, and find the changes required
to update settings.json
too large, you can use npm run dev
to compile a
./scripts/settings.json
file which is a copy of ./settings.json
but with
a shorter syntax. Note: npm install
should be run the first time to install
the dependencies.
Contributors
Thanks to the following people for sharing their configurations and contributing to this project: