Skip to content

Spacemacs' like keybindings for Visual Studio Code

License

Notifications You must be signed in to change notification settings

hookercookerman/VSpaceCode

 
 

Repository files navigation

VSpaceCode

resources/logo.png

» Spacemacs-like keybindings for Visual Studio Code



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)

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.normalModeKeyBindings section of your settings.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.

To enable Ctrl + h, Ctrl + j, Ctrl + k, Ctrl + l bindings to navigate in some widgets outside the editor, merge the content of keybindings.json into your keybindings.json.

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"

The following keybindings are configured in the editor through VSCodeVim:

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 4 Focus forth editor group  
leader 5 Focus fifth editor group  
leader 6 Focus sixth editor group  
leader 7 Focus seventh editor group  
leader 8 Focus eighth 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 e n Next error  
leader e p Previous error  
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 - Split window below  
leader w / Split window to right  
leader w d Close editors in group  
leader w h Previous editor group  
leader w H Move editor group to left  
leader w j Move window focus down  
leader w k Move window focus up  
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  

The following keybindings are configured globally in VSCode in some modes:

Key bindings Description Remark
Ctrl+h Left In: ListFocus
Ctrl+j Down In: QuickOpen, SuggestWidget, ListFocus
Ctrl+k Up In: QuickOpen, SuggestWidget, ListFocus
Ctrl+l Right In: ListFocus

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:

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.

Thanks to the following people for sharing their configurations and contributing to this project:

  • IntelliSpace - Spacemacs' like key bindings for IntelliJ platform.
  • Spaceclipse - Spacemacs' like key bindings for Eclipse.

About

Spacemacs' like keybindings for Visual Studio Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%