Skip to content

Spacemacs' like key bindings for IntelliJ platform.

License

Notifications You must be signed in to change notification settings

MarcoIeni/intellimacs

Repository files navigation

Intellimacs

https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg

docs/preview.gif

Presentation

This project tries to mimic Spacemacs key bindings in IDEs based on the IntelliJ platform, i.e. IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.

For instance, SPC f f in Spacemacs opens a file, so it makes sense to map it to the “GotoFile” IntelliJ action.

How it works

This project can be seen as a set of configuration files for the IdeaVim plugin, which enables vim emulation inside IntelliJ platform. ~/.ideavimrc is the file where IdeaVim lets you add Vim initialization commands, i.e. this file is like ~/.vimrc for vim.

IdeaVim parses the most common vim commands, together with the custom :action {name} command, used to execute arbitrary IDE actions. To list all IDE actions use the command :actionlist [pattern].

Intellimacs provides different files, which can be included individually in your own .ideavimrc, in order to get only the functionalities you want.

Key bindings

Intellimacs is composed of three modules:

spacemacs
Contains Spacemacs settings and key bindings that can be replicated with a similar behaviour in the IntelliJ platform.
extra
Contains settings and key bindings not present in Spacemacs, but that may be useful in the IntelliJ platform.
major
Contains key bindings that start with SPC m, that may or may not be present in some Spacemacs major mode.

Furthermore, Intellimacs provides some of the features of Spacemacs hybrid mode, which may be enabled by sourcing the file ~/.intellimacs/hybrid.vim.

Read KEYBINDINGS.org to see all 200+ available key bindings.

Installation

  1. Go to the IDE’s plugin manager (File -> Settings -> Plugins) and install the following plugins:
    • IdeaVim: vim emulation
    • (Optional) Which-Key: menu that shows the available commands as you type
  2. Clone this repository in your home directory:
    git clone https://github.com/MarcoIeni/intellimacs ~/.intellimacs
        
  3. In your home directory, create the file .ideavimrc and edit it in order to include the modules you want by sourcing the relative source files. In the following there is an example of .ideavimrc file that includes all the functionalities offered by Intellimacs. In this file you can also include your own vim commands.
    source ~/.intellimacs/spacemacs.vim
    
    " (Optional) Enable other Intellimacs modules
    source ~/.intellimacs/extra.vim
    source ~/.intellimacs/major.vim
    source ~/.intellimacs/hybrid.vim
    
    " (Optional) Enable which-key plugin
    source ~/.intellimacs/which-key.vim
    
    " (Optional) My own vim commands
    nnoremap Y y$
    
    " (Optional) Comma for major mode
    nmap , <leader>m
    vmap , <leader>m
    
    " (Optional) Add/edit actions
    nnoremap <leader>gl    :action Vcs.Show.Log<CR>
    vnoremap <leader>gl    :action Vcs.Show.Log<CR>
        
  4. (optional) source your vimrc file by adding the line source ~/.vimrc in .ideavimrc (you may break something).

Update

In order to update run git pull inside the intellimacs directory.

Read CHANGELOG.org to see what changed.

Suggested plugins

PLUGINS.org contains a list of useful plugins that help to replicate the Spacemacs experience.

Tips

Go back to code

The key bindings work only when you are inside the code. For example, if you are inside the project window they don’t work. Press <Esc> to focus the last visited code window and you will be able to use spacemacs key bindings again.

Scroll menus without arrow keys

In order to scroll menus without using arrow keys, press SPC f e d to go to IDE’s settings and set a custom shortcut for the actions Down and Up in the menu Keymap -> Editor Actions. For example, you can bind them respectively to Ctrl + j and Ctrl + k. If you have some conflicts, search the editor action the key is assigned to, right click and remove the binding.

Open a file in Emacs with keyboard shortcut

In order to open a file in Emacs with a keyboard shortcut follow this guide.

Resources

Contributions

Intellimacs needs you to keep it up to date and propose great and useful key bindings.

Before contributing, be sure to read CONTRIBUTING.org first!

Related projects

  • Spaceclipse - Spacemacs’ like key bindings for Eclipse
  • SpaceVim - A community-driven modular vim distribution
  • VSpaceCode - Spacemacs’ like key bindings for Visual Studio Code (thanks for the inspiration)

Related projects (No Spacemacs keys)

  • Glimpse - Mnemonic key bindings for VSCode commands