IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform. IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
-
IdeaVim can be installed via
Settings | Plugins
. See the detailed instructions. -
Use
Tools | Vim Emulator
to enable or disable emulation. -
Use the
~/.ideavimrc
file as an analog of~/.vimrc
(learn more). The XGD standard is supported, as well. -
Shortcut conflicts can be resolved by using:
- On Linux & Windows:
File | Settings | Editor | Vim Emulation
&File | Settings | Keymap
, - On macOS:
Preferences | Editor | Vim Emulation
&Preferences | Keymap
, - Regular Vim mappings in the
~/.ideavimrc
file.
- On Linux & Windows:
Would you like to try new features and fixes? Join the Early Access Program and receive EAP builds as updates!
Or subscribe to EAP updates manually:
- Open
Settings | Plugins
- Click the gear icon ⚙️, select
Manage Plugin Repositories
, and add the following url:https://plugins.jetbrains.com/plugins/eap/ideavim
See the changelog for the list of unreleased features.
It is important to distinguish EAP builds from traditional pre-release software. Please note that the quality of EAP versions may at times be way below even usual beta standards.
You can always leave your feedback with:
- @IdeaVim in Twitter
- Bug tracker
Here are some examples of supported vim features and commands:
- Normal / insert / visual / select / etc. modes
- Motion / deletion / change / window / etc. commands
- Key mappings
- Marks / Macros / Digraphs / Registers
- Some set commands
- Full Vim regexps for search and search/replace
- Vim web help
~/.ideavimrc
configuration file
- vim-easymotion
- vim-surround
- vim-multiple-cursors
- vim-commentary
- argtextobj.vim
- vim-textobj-entire
- ReplaceWithRegister
- vim-exchange [To Be Released]
See also:
~/.ideavimrc
- Your IdeaVim-specific Vim initialization commands
Example (click to see)
""" Map leader to space ---------------------
let mapleader=" "
""" Plugins --------------------------------
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
""" Plugin settings -------------------------
let g:argtextobj_pairs="[:],(:),<:>"
""" Common settings -------------------------
set showmode
set so=5
set incsearch
set nu
""" Idea specific settings ------------------
set ideajoin
set ideastatusicon=gray
set idearefactormode=keep
""" Mappings --------------------------------
map <leader>f <Plug>(easymotion-s)
map <leader>e <Plug>(easymotion-f)
map <leader>d :action Debug<CR>
map <leader>r :action RenameElement<CR>
map <leader>c :action Stop<CR>
map <leader>z :action ToggleDistractionFreeMode<CR>
map <leader>s :action SelectInProjectView<CR>
map <leader>a :action Annotate<CR>
map <leader>h :action Vcs.ShowTabbedFileHistory<CR>
map <S-Space> :action GotoNextError<CR>
map <leader>b :action ToggleLineBreakpoint<CR>
map <leader>o :action FileStructurePopup<CR>
You can read your ~/.vimrc
file from ~/.ideavimrc
with this command:
source ~/.vimrc
Please note that IdeaVim currently parses ~/.ideavimrc
& ~/.vimrc
files via simple pattern-matching.
See VIM-669 for proper parsing
of VimL files.
Also note that if you have overridden the user.home
JVM option, this
will affect where IdeaVim looks for your .ideavimrc
file. For example, if you
have -Duser.home=/my/alternate/home
then IdeaVim will source
/my/alternate/home/.ideavimrc
instead of ~/.ideavimrc
.
Alternatively, you can set up initialization commands using XDG standard.
Put your settings to $XDG_CONFIG_HOME$/ideavim/ideavimrc
file.
IdeaVim adds two commands for listing and executing arbitrary IDE actions as
Ex commands or via :map
command mappings:
:actionlist [pattern]
- Find IDE actions by name or keymap pattern (E.g.
:actionlist extract
,:actionlist <C-D
)
- Find IDE actions by name or keymap pattern (E.g.
:action {name}
- Execute an action named
NAME
- Execute an action named
Examples:
" Map \r to the Reformat Code action
:map \r :action ReformatCode<CR>
" Map <leader>d to start debug
:map <leader>d :action Debug<CR>
" Map \b to toggle the breakpoint on the current line
:map \b :action ToggleLineBreakpoint<CR>
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ Platform,
so the behavior of the u
and <C-R>
commands may differ from the original
Vim. Vim compatibility of undo/redo may be improved in future releases.
See also unresolved undo issues.
Using <Esc>
in dialog windows remains problematic. For most dialog windows,
the Vim emulator is put into insert mode with <Esc>
not working. You
should use <C-c>
or <C-[>
instead. In some dialog windows, the normal mode is
switched by default. The usage of the Vim emulator in dialog windows is an area for
improvement.
See also unresolved escape issues.
The power of contributing drives IdeaVim 💪. Even small contributions matter!
See CONTRIBUTING.md to start bringing your value to the project.
See AUTHORS.md for a list of authors and contributors.
-
Use the power of IJ and Vim:
set ideajoin
to enable join via the IDE. See the examples.- Make sure
ideaput
is enabled forclipboard
to enable native IJ insertion in Vim. - Sync IJ bookmarks and Vim marks:
set ideamarks
- Check out more ex commands.
-
Use your vim settings with IdeaVim. Put
source ~/.vimrc
in~/.ideavimrc
.⚠️ Please note that IdeaVim currently parses~/.ideavimrc
&~/.vimrc
files via simple pattern-matching. See VIM-669 for proper parsing of VimL files. -
Control the status bar icon via the
ideastatusicon
option. -
Not familiar with the default behaviour during a refactoring? See the
idearefactormode
option.
Let’s relax and have some fun now! Here are a few things we've found interesting during development and would like to share with you.
-
There are no such commands as
dd
,yy
, orcc
. For example,dd
is not a separate command for deleting the line, but ad
command with ad
motion.
Wait, but there isn't ad
motion in Vim! That’s right, and that’s why Vim has a dedicated set of commands for which it checks whether the command equals to motion and if so, it executes_
motion instead.
_
is an interesting motion that isn't even documented in vi, and it refers to the current line. So, commands likedd
,yy
, and similar ones are simply translated tod_
,y_
, etc. Here is the source of this knowledge. -
x
,D
, and&
are not separate commands either. They are synonyms ofdl
,d$
, and:s\r
, respectively. Here is the full list of synonyms. -
Have you ever used
U
afterdd
? Don't even try. -
A lot of variables that refers to visual mode start with two uppercase letters, e.g.
VIsual_active
. Some examples. -
Other strange things from vi:
- ":3" jumps to line 3
- ":3|..." prints line 3
- ":|" prints current line
-
Vim script doesn't skip white space before comma.
F(a ,b)
=> E475.
IdeaVim is licensed under the terms of the GNU Public License version 2 or any later version.