Code Monkey home page Code Monkey logo

vspacecode's Introduction

VSpaceCode

image

» Spacemacs-like keybindings for Visual Studio Code


Table of Contents


TL;DR

This repository contains a configuration for VSCodeVim that tries to mimic Spacemacs key bindings in VSCode. There is nothing to install but two configuration files to merge in your settings. See Installation for more details.

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 C-d leader b n leader b p leader b s leader b u 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 Close other editors Next editor Previous editor Scratch buffer Reopen closed editor List errors / problems Next error Previous error

Open terminal effectively

leader f e leader f f leader f r leader f s leader f S leader f t leader f T

Show your settings file Open file Open recent (show recent files) Save file Save all Show explorer view Select file in the explorer

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 g 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 file from editor group 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 J leader w k leader w K leader w l leader w L leader w m leader w s 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 editor group down Move window focus up Move editor group up Next editor group Move editor group to right Toggle maximized panel (layout unpreserved) Split window below 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

Tips

Go back to code

The key bindings work only when you are inside the code. For example, if you are inside the file explorer window they don't work. Press Ctrl + 1 to focus the first editor group and you will be able to use spacemacs key bindings again.

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.

In order to see all available VSCode commands press SPC h d and mouse over the command name.

Contributors

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

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

vspacecode's People

Contributors

adrianstaniec avatar danielpza avatar dependabot[bot] avatar duchainer avatar emmanueltouzery avatar fabrik42 avatar jamrizzi avatar joefiorini avatar juancaicedo avatar marcoieni avatar ossoso avatar steelsojka avatar stormpat avatar streakycobra avatar thanhvg avatar wabilin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.