-
Notifications
You must be signed in to change notification settings - Fork 810
IdeaVim Plugins
IdeaVim plugins work like the original Vim plugins. If you want to turn any of them on, you have to enable it via this command in your ~/.ideavimrc:
Plug '<plugin-github-reference>'
If you reuse your existing .vimrc file using source ~/.vimrc, IdeaVim can parse and enable plugins that are defined
using vim-plug or vundle.
No additional set commands in ~/.ideavimrc are required.
If you'd like to disable some plugin that's enabled in .vimrc, you can use set no<extension-name>
in ~/.ideavimrc. E.g. set nosurround.
Available plugins:
Original plugin: vim-abolish.
Coercion mappings (crs/cr_, crm/crp, crc, cru/crU, cr-/crk, cr., cr<Space>, crt)
recase the word under the cursor between snake_case, MixedCase, camelCase, UPPER_SNAKE, kebab-case,
dot.case, space case and Title Case. :Subvert (alias :S) is a case-aware :substitute that
handles all case variants and {a,b,c} brace alternatives in a single command. With only a pattern
(:S/foo/ or :S?foo?) it does a case-aware forward or backward search instead.
- Add the following command to
~/.ideavimrc:Plug 'tpope/vim-abolish'Alternative syntax
Plugin 'tpope/vim-abolish'
Plug 'https://github.com/tpope/vim-abolish'
Plug 'vim-abolish'
set abolish
https://github.com/tpope/vim-abolish/blob/master/doc/abolish.txt
:Abolish (insert-mode auto-correcting abbreviations) is not supported.
By default each cr<x> mapping recases the inner word under the cursor.
To get tpope-style motion support (crsiw, crsap, crs2w, …) remap to the
per-style operator <Plug> mappings:
nmap crs <Plug>(abolish-coerce-snake)
nmap crm <Plug>(abolish-coerce-pascal)
nmap crc <Plug>(abolish-coerce-camel)
nmap cru <Plug>(abolish-coerce-upper_snake)
nmap cr- <Plug>(abolish-coerce-kebab)
nmap cr. <Plug>(abolish-coerce-dot)
nmap cr<Space> <Plug>(abolish-coerce-space)
nmap crt <Plug>(abolish-coerce-title)
To bind extra trigger characters, set g:abolish_coercions before enabling
the plugin. Each entry maps a single character to the name of a built-in case
style (case-insensitive: snake, pascal, camel, upper_snake, kebab,
dot, space, title).
let g:abolish_coercions = {'q': 'kebab', 'x': 'upper_snake'}
After this, crq recases to kebab-case and crx to UPPER_SNAKE.
An extension for IdeaVim plugin that adds useful text objects to improve your productivity on JetBrains IDEs.
Text objects allow a more efficient way of communicating edition or selection actions in the editor. Instead of thinking in terms of characters, words, lines, or paragraphs, use more advance text constructs like quoted text, text between brackets, items in a collection, or programming language constructs like arguments, classes, functions, loops, or comments.
By Ricardo Rodriguez
- Install Vim AnyObject
- Add
set anyobjectto your~/.ideavimrcfile, then run:source ~/.ideavimrcor restart the IDE.
Original plugin: argtextobj.vim.
This plugin provides a text-object 'a' (argument). You can d(elete), c(hange), v(select)... an argument or inner argument in familiar ways.
That is, such as 'daa'(delete-an-argument) 'cia'(change-inner-argument) 'via'(select-inner-argument). What this script does is more than just typing
F,dt,
because it recognizes inclusion relationship of parentheses.
- Add the following command to
~/.ideavimrc:Plug 'vim-scripts/argtextobj.vim'Alternative syntax
Plugin 'vim-scripts/argtextobj.vim'
Plug 'https://github.com/vim-scripts/argtextobj.vim'
Plug 'argtextobj.vim'
Plug 'https://www.vim.org/scripts/script.php?script_id=2699'
set argtextobj
By default, only the arguments inside parenthesis are considered. To extend the functionality
to other types of brackets, set g:argtextobj_pairs variable to a comma-separated
list of colon-separated pairs (same as VIM's matchpairs option), like
let g:argtextobj_pairs="(:),{:},<:>". The order of pairs matters when
handling symbols that can also be operators: func(x << 5, 20) >> 17. To handle
this syntax parenthesis, must come before angle brackets in the list.
Original plugin: CamelCaseMotion.
Adds w, b, e, ge style motions and iw/ib/ie/ige inner "word" text objects that move
and select by sub-word boundaries — uppercase letters in CamelCase and _/- delimiters in
snake_case/kebab-case — instead of whole words. For example, with the leader as the key,
<leader>w jumps Camel|CaseWord → Camel[C]aseWord, and ci<leader>w changes a single chunk of
an identifier. The motions honour [count], work in normal, visual and operator-pending modes, and
respect the 'iskeyword' option.
-
Add the following command to
~/.ideavimrc:Plug 'bkad/CamelCaseMotion'Alternative syntax
Plugin 'bkad/CamelCaseMotion'
Plug 'https://github.com/bkad/CamelCaseMotion'
Plug 'CamelCaseMotion'
set CamelCaseMotion -
No mappings are created until you choose a key. The most common setup is to add this to your
~/.ideavimrc(before thePlug/setline):let g:camelcasemotion_key = '<leader>'which creates
<leader>w,<leader>b,<leader>e,<leader>geand the inner objectsi<leader>w,i<leader>b,i<leader>e,i<leader>ge.
https://github.com/bkad/CamelCaseMotion/blob/master/README.markdown
With g:camelcasemotion_key set to <leader> (the default leader is \):
| Mapping | Description |
|---|---|
<leader>w |
Move forward to the next start of a sub-word |
<leader>b |
Move backward to the previous start of a sub-word |
<leader>e |
Move forward to the next end of a sub-word |
<leader>ge |
Move backward to the previous end of a sub-word |
i<leader>w |
Inner sub-word (e.g. ci<leader>w, vi<leader>w) |
i<leader>b |
Inner sub-word, extends backward with a count |
i<leader>e |
Inner sub-word, excludes a trailing delimiter |
i<leader>ge |
Inner sub-word, backward to the previous word end |
Instead of (or in addition to) g:camelcasemotion_key, you can map the motion <Plug> targets
directly, for example to replace the built-in w/b/e:
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
map <silent> ge <Plug>CamelCaseMotion_ge
Adds the ac text object that selects "a class definition" — the entire class declaration and body. Works in any language whose PSI tree provides a class element (Java, Kotlin, Python, JavaScript/TypeScript, Go, Dart, PHP, Ruby, Rust).
- Add the following command to
~/.ideavimrc:set classtextobj
| Mapping | Description |
|---|---|
ac |
A class definition (e.g. vac, dac, cac, yac) |
When classes are nested, the innermost enclosing class is selected.
By Daniel Leong
Original plugin: commentary.vim.
Comment stuff out. Use gcc to comment out a line (takes a count), gc to comment out the target of a motion (for example, gcap to comment out a paragraph), gc in visual mode to comment out the selection, and gc in operator pending mode to target a comment. You can also use it as a command, either with a range like :7,17Commentary, or as part of a :global invocation like with :g/TODO/Commentary. That's it.
- Add the following command to
~/.ideavimrc:Plug 'tpope/vim-commentary'Alternative syntax
Plugin 'tpope/vim-commentary'
Plug 'https://github.com/tpope/vim-commentary'
Plug 'vim-commentary'
Plug 'tcomment_vim'
set commentary
https://github.com/tpope/vim-commentary/blob/master/doc/commentary.txt
IdeaVim extension with advanced text increment and decrement functionality. It enhances the standard increment/decrement functionality found in Vim editors by adding support for complex text patterns beyond simple numbers.
Cycle through related values from various text elements, including numbers, dates, boolean values, operators, and programming language-specific keywords.
By Ricardo Rodriguez
- Install Vim Dial
- Add
set dialto your~/.ideavimrcfile, then run:source ~/.ideavimrcor restart the IDE.
Original plugin: vim-easymotion.
EasyMotion provides a much simpler way to use some motions in vim. It takes the <number> out of <number>w or <number>f{char} by highlighting all possible choices and allowing you to press one key to jump directly to the target.
- Install IdeaVim-EasyMotion and AceJump plugins.
- Add the following command to
~/.ideavimrc:Plug 'easymotion/vim-easymotion'Alternative syntax
Plugin 'easymotion/vim-easymotion'
Plug 'https://github.com/easymotion/vim-easymotion'
Plug 'vim-easymotion'
set easymotion
All commands with the mappings are supported. See the full list of supported commands.
By fan-tom
Original plugin: vim-exchange.
Easy text exchange operator for Vim.
- Add the following command to
~/.ideavimrc:Plug 'tommcdo/vim-exchange'Alternative syntax
Plugin 'tommcdo/vim-exchange'
Plug 'https://github.com/tommcdo/vim-exchange'
Plug 'vim-exchange'
set exchange
https://github.com/tommcdo/vim-exchange/blob/master/doc/exchange.txt
Inspired by vim-textobj-function.
Adds text objects for selecting methods/functions. Three variants distinguish what is included: the signature and body, the same with JavaDoc and annotations, or just the inner body content. Works in any language whose PSI tree provides a function/method element (Java, Kotlin, Python, JavaScript/TypeScript, Go, Dart, PHP, Ruby, Rust).
- Add the following command to
~/.ideavimrc:set functextobjAlternative syntax
Plug 'kana/vim-textobj-function'
Plug 'vim-textobj-function'
| Mapping | Description |
|---|---|
am |
A method definition (signature + body, excluding JavaDoc and annotations) |
aM |
A Method definition (same as am, but including JavaDoc and annotations) |
im |
Inner method definition (only the contents between the body braces) |
Use with operators (d, c, y) or in visual mode — e.g. dam, cim, vaM. When methods are nested, the innermost enclosing method is selected.
By Julien Phalip
An extension for IdeaVim that adds text objects for manipulating functions/methods in your code. Similar to how iw operates on words or i" operates on quoted strings, this plugin provides if and af to operate on functions
Add set functiontextobj to your ~/.ideavimrc file, then run :source ~/.ideavimrc
or restart the IDE.
https://plugins.jetbrains.com/plugin/25897-vim-functiontextobj
By KostkaBrukowa
Original plugin: vim-highlightedyank.
Make the yanked region apparent!
- Add the following command to
~/.ideavimrc:Plug 'machakann/vim-highlightedyank'Alternative syntax
Plugin 'machakann/vim-highlightedyank'
Plug 'https://github.com/machakann/vim-highlightedyank'
Plug 'vim-highlightedyank'
set highlightedyank
If you want to optimize highlight duration, assign a time in milliseconds:
let g:highlightedyank_highlight_duration = "1000"
A negative number makes the highlight persistent.
If you want to change background color of highlight you can provide the rgba of the color you want e.g.
let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"
If you want to change text color of highlight you can provide the rgba of the color you want e.g.
let g:highlightedyank_highlight_foreground_color = "rgba(0, 0, 0, 255)"
https://github.com/machakann/vim-highlightedyank/blob/master/doc/highlightedyank.txt
By Shrikant Sharat Kandula
Original plugin: vim-indent-object.
Vim text objects provide a convenient way to select and operate on various types of objects. These objects include regions surrounded by various types of brackets and various parts of language (ie sentences, paragraphs, etc).
- Add the following command to
~/.ideavimrc:Plug 'michaeljsmith/vim-indent-object'Alternative syntax
Plugin 'michaeljsmith/vim-indent-object'
Plug 'https://github.com/michaeljsmith/vim-indent-object'
Plug 'vim-indent-object'
set textobj-indent
https://github.com/michaeljsmith/vim-indent-object/blob/master/doc/indent-object.txt
Original plugin: vim-indentwise.
Adds motions that navigate by the indentation level of lines rather than by their content. You can
jump to the previous/next line of lesser, greater or equal indentation relative to the current line,
and jump to the beginning/end of the current indentation block. Blank and whitespace-only lines are
skipped, so the motions follow the visible structure of the code. The motions take a [count], and
work in normal, visual and operator-pending modes (e.g. d]-, v[%). Operator-pending and visual
moves are line-wise.
- Add the following command to
~/.ideavimrc:Plug 'jeetsukumaran/vim-indentwise'Alternative syntax
Plugin 'jeetsukumaran/vim-indentwise'
Plug 'https://github.com/jeetsukumaran/vim-indentwise'
Plug 'vim-indentwise'
set indentwise
https://github.com/jeetsukumaran/vim-indentwise/blob/master/doc/indentwise.txt
| Mapping | Description |
|---|---|
[- |
Move to the previous line of lesser indent |
]- |
Move to the next line of lesser indent |
[+ |
Move to the previous line of greater indent |
]+ |
Move to the next line of greater indent |
[= |
Move to the previous line of equal indent |
]= |
Move to the next line of equal indent |
[% |
Move to the beginning of the current indent block |
]% |
Move to the end of the current indent block |
For the block-scope motions, a [count] repeats outward through enclosing blocks (e.g. 2[%). The
absolute-indent motions ([_, ]_) from the original plugin are not currently supported.
By Martin Yzeiri Original plugin: matchit.vim.
In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a brace, bracket, or paren to its match. This can be configured with the 'matchpairs' option. The matchit plugin extends this in several ways...
- Add the following command to
~/.ideavimrc:packadd matchitAlternative syntax
Plug 'vim-matchit'
Plug 'chrisbra/matchit'
set matchit
https://github.com/adelarsq/vim-matchit/blob/master/doc/matchit.txt
Extend and create a/i textobjects
Provides additional text object motions for handling quotes and brackets. The following motions are included:
- aq: Around any quotes.
- iq: Inside any quotes.
- ab: Around any parentheses, curly braces, and square brackets.
- ib: Inside any parentheses, curly braces, and square brackets.
Original plugin: mini.ai.
- Add the following command to
~/.ideavimrc:set mini-ai
Original plugin: vim-multiple-cursors.
- Add the following command to
~/.ideavimrc:Plug 'terryma/vim-multiple-cursors'Alternative syntax
Plugin 'terryma/vim-multiple-cursors'
Plug 'https://github.com/terryma/vim-multiple-cursors'
Plug 'vim-multiple-cursors'
set multiple-cursors
The default key bindings match the original terryma/vim-multiple-cursors plugin:
| Action | Shortcut |
|---|---|
| Start / add next occurrence (whole word) | <C-n> |
| Start / add next occurrence (not whole word) | g<C-n> |
| Select all occurrences in file (whole word) | <A-n> |
| Select all occurrences in file (not whole word) | g<A-n> |
| Skip current and select next (during selection) | <C-x> |
| Remove current selection (during selection) | <C-p> |
These map to the following <Plug> mappings:
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
nmap g<C-n> <Plug>NextOccurrence
xmap g<C-n> <Plug>NextOccurrence
nmap <A-n> <Plug>AllWholeOccurrences
xmap <A-n> <Plug>AllWholeOccurrences
nmap g<A-n> <Plug>AllOccurrences
xmap g<A-n> <Plug>AllOccurrences
xmap <C-x> <Plug>SkipOccurrence
xmap <C-p> <Plug>RemoveOccurrence
To use your own mappings instead of the defaults, set g:multi_cursor_use_default_mapping to 0 and bind the
<Plug> mappings yourself. This is also how you restore the old IdeaVim <A-n> based mappings:
let g:multi_cursor_use_default_mapping = 0
" Note that the <A-n> and g<A-n> shortcuts don't work on Mac due to dead keys.
" <A-n> is used to enter accented text e.g. ñ
nmap <A-n> <Plug>NextWholeOccurrence
xmap <A-n> <Plug>NextWholeOccurrence
nmap g<A-n> <Plug>NextOccurrence
xmap g<A-n> <Plug>NextOccurrence
xmap <A-x> <Plug>SkipOccurrence
xmap <A-p> <Plug>RemoveOccurrence
Original plugin: NERDTree.
Adds NERDTree navigation to the project panel.
- Add the following command to
~/.ideavimrc:Plug 'preservim/nerdtree'Alternative syntax
Plugin 'preservim/nerdtree'
Plug 'https://github.com/preservim/nerdtree'
Plug 'nerdtree'
set NERDTree
Original plugin: vim-paragraph-motion.
Normally the { and } motions only match completely empty lines. With this plugin lines that only contain whitespace are also matched.
- Add the following command to
~/.ideavimrc:Plug 'dbakker/vim-paragraph-motion'Alternative syntax
Plugin 'dbakker/vim-paragraph-motion'
Plug 'https://github.com/dbakker/vim-paragraph-motion'
Plug 'vim-paragraph-motion'
Plug 'https://github.com/vim-scripts/Improved-paragraph-motion'
Plug 'vim-scripts/Improved-paragraph-motion'
Plug 'Improved-paragraph-motion'
set vim-paragraph-motion
https://github.com/dbakker/vim-paragraph-motion#vim-paragraph-motion
By Julien Phalip
Original plugin: vim-peekaboo.
Peekaboo extends " and @ in normal mode and in insert mode so you can see the contents of the registers.
Add set peekaboo to your ~/.ideavimrc file, then run :source ~/.ideavimrc
or restart the IDE.
Original plugin: quick-scope.
An always-on highlight for a unique character in every word on a line to help you use f, F, and family.
This plugin should help you get to any word on a line in two or three keystrokes with Vim's built-in f (which moves your cursor to ).
- Install IdeaVim-Quickscope plugin.
- Add the following command to
~/.ideavimrc:set quickscope
https://plugins.jetbrains.com/plugin/19417-ideavim-quickscope
By igrekster
Original plugin: ReplaceWithRegister.
This plugin offers a two-in-one command that replaces text covered by a {motion}, entire line(s) or the current selection with the contents of a register; the old text is deleted into the black-hole register, i.e. it's gone. (But of course, the command can be easily undone.)
- Add the following command to
~/.ideavimrc:Plug 'vim-scripts/ReplaceWithRegister'Alternative syntax
Plugin 'vim-scripts/ReplaceWithRegister'
Plug 'ReplaceWithRegister'
Plug 'https://github.com/inkarkat/vim-ReplaceWithRegister'
Plug 'inkarkat/vim-ReplaceWithRegister'
Plug 'vim-ReplaceWithRegister'
Plug 'https://www.vim.org/scripts/script.php?script_id=2703'
set ReplaceWithRegister
https://github.com/vim-scripts/ReplaceWithRegister/blob/master/doc/ReplaceWithRegister.txt
By Mikhail Levchenko
Original repository with the plugin: https://github.com/Mishkun/ideavim-sneak
Original plugin: vim-sneak.
Jump to any location specified by two characters.
- Add the following command to
~/.ideavimrc:Plug 'justinmk/vim-sneak'
- Type
sand two chars to start sneaking in forward direction - Type
Sand two chars to start sneaking in backward direction - Type
;or,to proceed with sneaking just as if you were usingfortcommands
Original plugin: vim-surround.
Surround.vim is all about "surroundings": parentheses, brackets, quotes, XML tags, and more. The plugin provides mappings to easily delete, change, and add such surroundings in pairs.
- Add the following command to
~/.ideavimrc:Plug 'tpope/vim-surround'Alternative syntax
Plugin 'tpope/vim-surround'
Plug 'https://www.vim.org/scripts/script.php?script_id=1697'
Plug 'vim-surround'
set surround
https://github.com/tpope/vim-surround/blob/master/doc/surround.txt
By Julien Phalip
Original plugin: switch.vim.
The purpose of the plugin is to switch some text under the cursor based on regex patterns. The main entry point is a single command, :Switch. When the command is executed, the plugin looks for one of a few specific patterns under the cursor and performs a substitution depending on it.
Add set switch to your ~/.ideavimrc file, then run :source ~/.ideavimrc
or restart the IDE.
Original plugin: targets.vim.
Targets.vim expands on the built-in text objects (di(, ci", …) to give you more targets to
operate on and the ability to reach them without moving the cursor there first. It adds text objects
for pairs (( ) { } [ ] < >, plus b for "any block"), quotes (' " \``, plus q for "any quote"), separators (, . ; : + - = ~ _ * # / | \ & $), arguments (a) and tags (t), each available with four modifiers and the n/l` next/last qualifiers:
-
i— inside the object (e.g.ci() -
a— a whole object, including its delimiters (e.g.da,deletes one list item and a separator) -
I— inside, excluding surrounding whitespace -
A— around, including adjacent whitespace -
in/il(andan,In,Al, …) — operate on the next / last object without moving there, e.g.cin)changes inside the next parentheses; a[count]skips further (c2in)).
When the cursor is not inside an object, the plain commands seek to the nearest one. Quotes are
paired by counting from the start of the line, so ci" skips the gap between two strings and changes
the real one. Re-issuing a text object in visual mode grows the selection outward (vi(i().
- Add the following command to
~/.ideavimrc:Plug 'wellle/targets.vim'Alternative syntax
Plugin 'wellle/targets.vim'
Plug 'https://github.com/wellle/targets.vim'
Plug 'targets.vim'
set targets
https://github.com/wellle/targets.vim/blob/master/README.md (see also the cheat sheet).
The settings (g:targets_aiAI, g:targets_nl, g:targets_seekRanges, targets#mappings#extend, …)
and forced motions (dVi-, d<C-V>i-) are not currently supported.
By Alexandre Grison
Original plugin: vim-textobj-entire.
vim-textobj-entire is a Vim plugin to provide text objects (ae and ie by default) to select the entire content of a buffer. Though these are trivial operations (e.g. ggVG), text object versions are more handy, because you do not have to be conscious of the cursor position (e.g. vae).
- Add the following command to
~/.ideavimrc:Plug 'kana/vim-textobj-entire'Alternative syntax
Plugin 'kana/vim-textobj-entire'
Plug 'vim-textobj-entire'
Plug 'https://www.vim.org/scripts/script.php?script_id=2610'
set textobj-entire
https://github.com/kana/vim-textobj-entire/blob/master/doc/textobj-entire.txt
Brings vim-style keyboard navigation to the rest of the IDE. Enabling VimEverywhere turns on three
behaviors:
-
Hints overlay. Press
Ctrl+Shift+\(Ctrl+Cmd+\on macOS) to display hint labels over interactive UI components — buttons, tool window tabs, tree nodes, text fields, scroll panes, and so on. Type the letters next to a target to focus or click it without touching the mouse. -
NERDTree-style mappings everywhere. NERDTree file-opening mappings (
o,t,T,s,i,go,gs,gi) work in any focused tree, not just the Project tool window. - Tool window navigation. Vim-style window-motion keys work inside tool windows, so you can move between split panes without leaving the keyboard.
- Install the AceJump plugin.
- Add the following command to
~/.ideavimrc:set VimEverywhere
Press Ctrl+Shift+\ (Ctrl+Cmd+\ on macOS) to toggle the hints overlay. Type the letters shown
next to a target to activate it, or press Esc to dismiss the overlay without activating anything.
NERDTree-style and window-nav mappings are active automatically whenever the corresponding
component has focus.
Original plugin: vim-which-key.
vim-which-key is vim port of emacs-which-key that displays available keybindings in popup.
- Install Which-Key plugin.
- Add the following command to
~/.ideavimrc:set which-key
https://github.com/TheBlob42/idea-which-key?tab=readme-ov-file#installation
Inspired by YouCompleteMe / SuperTab.
Makes <Tab> cycle through the IDE's code completion popup, SuperTab style. While the completion
popup (lookup) is open, <Tab> selects the next item and <S-Tab> the previous one — the same as
the native <C-N>/<C-P> insert-mode completion keys. When no popup is open, <Tab> falls back to
its normal behaviour (indentation), so ordinary tabbing is unaffected.
- Add the following command to
~/.ideavimrc:set youcompleteme
Enabling the plugin removes <Tab> and <S-Tab> from the lookupkeys
option so that IdeaVim — rather than the IDE — handles them while the completion popup is open. If
you want to keep Vim's default insert-mode completion keys as well, they continue to work alongside
Tab:
| Mapping | Description |
|---|---|
<Tab> |
Select the next item in the completion popup (or insert a tab when none is open) |
<S-Tab> |
Select the previous item in the completion popup |