hookercookerman / VSpaceCode

Spacemacs' like keybindings for Visual Studio Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VSpaceCode

image

» 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.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.

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 configured in the editor through VSCodeVim:

Key bindings Description Remark

leader space leader tab leader ; ;

Run command Next editor Comment line

leader ' leader /         leader 1 leader 2 leader 3 leader 4 leader 5 leader 6 leader 7 leader 8 leader b b leader b d leader b n leader b p leader b s leader e l leader e n leader e p

Toggle terminal Find in files Focus first editor group Focus second editor group Focus third editor group Focus forth editor group Focus fifth editor group Focus sixth editor group Focus seventh editor group Focus eighth editor group Quick open (show current buffers) Close active editor Next editor Previous editor Scratch buffer List errors / problems Next error Previous error

Open terminal effectively

leader f e leader f f leader f r leader f s leader f t

Show your settings file Open file Open recent (show recent files) Save file Show explorer view

Shorter binding (by 'd')

leader f y leader g b leader g c leader g d leader g f leader g i leader g m leader g p leader g s leader g S leader g U leader h d leader i s

Copy current file path Git checkout Git commit Git delete branch Git fetch Git init Git merge Git publish Show source control view Git stage Git unstage Help describe keybindings Insert snippet

Doesn't show the path

leader j = leader j j leader j l leader j w leader l d leader p f leader p l leader p p leader p t leader q f leader q q leader q r leader r s

Format document Easymotion to character Easymotion to line Easymotion to word Close folder Quick open (allow to open any project file) Open folder project Open recent (show recent folders) Show explorer view Close window Close window Reload window Find in files

Better than Spacemacs

leader s e leader s j leader s p leader s P leader T F leader T m leader T s leader T t

Rename symbol Go to symbol in file Find in files Find in files with selection Toggle fullscreen Toggle menu bar Select color theme Toggle activity bar

Works only on symbols

leader v Expand region No transient state

leader V leader w - leader w / leader w d leader w h leader w H leader w j leader w k leader w l leader w L leader w m leader w v leader w w leader w W leader x s leader x w

Shrink region Split window below Split window to right Close editors in group Previous editor group Move editor group to left Move window focus down Move window focus up Next editor group Move editor group to right Maximize Split window Next editor group Previous editor group Sort lines Trim whitespace

No transient state

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

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:

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:

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

About

Spacemacs' like keybindings for Visual Studio Code

License:MIT License


Languages

Language:JavaScript 100.0%