Fundamentals 20 min read

Master IdeaVim: Essential Tips and Shortcuts for IntelliJ Power Users

This guide provides a comprehensive collection of practical IdeaVim shortcuts and techniques for IntelliJ, covering emulator toggling, scrolling, navigation, editing commands, visual selection, registers, macros, and known limitations to boost coding efficiency.

Programmer DD
Programmer DD
Programmer DD
Master IdeaVim: Essential Tips and Shortcuts for IntelliJ Power Users

In a previous article we briefly introduced the IdeaVim plugin; here we present a detailed summary of useful everyday tricks for developers who want to use this plugin without being Vim experts.

1. Switching Vim emulator state

The plugin allows assigning a shortcut to enable or disable the emulator, automatically switching the keymap. The default key is Ctrl+Alt+V, which conflicts with "Extract Variable"; it is recommended to reassign it in Settings → Keymap under "Vim Emulator".

Both the enabled and disabled keymaps should be configured. You can use the same key for both states or different keys to clearly indicate the current mode. If you close the emulator while in insert mode, reopening it will keep insert mode, which can be confusing.

It is advisable to set the "Exit Insert Mode" key in the Vim keymap to the same shortcut used to enter the emulator, e.g.:

Default keymap → Vim Emulator : Ctrl+;   (enable Vim emulator)
Vim keymap → Vim Emulator : Ctrl+,   (disable Vim emulator)
Vim keymap → Vim Emulator : Ctrl+;   (exit insert mode, return to normal mode)

Now pressing Ctrl+; twice guarantees you are in normal mode.

2. ScrollOff parameter

In the Vim emulator, run the command: set so=5 This keeps five lines of context above and below the cursor while scrolling, which is handy when the code window is narrow (e.g., during step‑by‑step debugging). It works only when the Vim emulator is active.

3. Line number navigation

In normal mode, typing {line}G or :{line}<Enter> jumps directly to a specific line. The former provides no on‑screen prompt, while the latter shows the command in the Vim command line.

4. Entering insert mode

Common ways to start insert mode include:

o  – insert a new line below and auto‑indent
O  – insert a new line above and auto‑indent
i  – insert before the current character
a  – insert after the current character
I  – move to line start and insert
A  – move to line end and insert
s  – delete the character under the cursor and insert
S  – delete the whole line and insert
c{range} – delete a range and insert (e.g., caw, ciw, ci" , c$, ct{char})
C  – delete to end of line and insert (same as c$)
r  – replace the character under the cursor and return to normal mode
R  – enter replace mode

5. Range operations

Many normal‑mode commands accept a range specifier to act on a larger area:

d{range} – delete
c{range} – delete and enter insert mode
y{range} – yank (copy) to register 0
v{range} – start visual selection
={range} – auto‑indent
gU{range} – uppercase
gu{range} – lowercase
>{range} – indent one level
<{range} – unindent one level

Common range specifiers include space (current character), $ (to end of line), ^ (to first non‑blank), 0 (to line start including blanks), gg, G, %, f / F, t / T, regex searches, word/object motions ( aw, iw, a", i", a<, etc.). Note that the it text‑object does not work in IdeaVim.

6. Text selection (Visual mode)

Enter visual mode with v (character), V (line), or Ctrl+v (block). Move the cursor to select text; press o to swap the cursor between the two ends of the selection. In block mode, after selecting multiple lines, I or A followed by text inserts the same text at the start or end of each line.

7. Copy‑paste registers

Vim uses named registers (identified by a single character) instead of the system clipboard. Common practices:

After y, use p to paste; the default register ("") is overwritten by the most recent delete. Use "0p to paste the last yanked text.

On Windows, registers + and * map to the system clipboard (e.g., "+yy copies a line to the OS clipboard).

Registers 19 store the last nine multi‑line deletions; single‑line deletions go to the - register.

Lowercase p pastes after the cursor, uppercase P before. :regs lists all registers.

8. Common insert‑mode shortcuts

Ctrl+h – delete character left of cursor
Ctrl+w – delete word left of cursor
Ctrl+y – copy character above cursor
Ctrl+e – copy character below cursor
Ctrl+r 0 – insert content of register 0
Ctrl+r * – insert system clipboard content
Ctrl+r {reg} – insert specified register
Ctrl+a – insert last inserted text
Ctrl+o – execute one normal‑mode command then return to insert mode (e.g., Ctrl+o A = End, Ctrl+o I = Home)

9. Exiting insert mode

Press Esc (far away) or Ctrl+[. You can also use the custom Ctrl+; shortcut from section 1, though it deviates from standard Vim and is not recommended.

10. Repeating operations

Press . in normal mode to repeat the last change. Additional repeat commands:

& – repeat last :s substitution
@@ – repeat last macro

11. Jumping

Ctrl+] – go to definition of identifier
Ctrl+o – go back
Ctrl+i – go forward
`. – jump to last edit location
`` – toggle between last two jump locations
{line}G or :{line}<Enter> – jump to line
gg – file start
G – file end
H – top of screen (or set so=n to jump n lines down)
L – bottom of screen (or set so=n to jump n lines up)
M – middle of screen
f/F – find character forward/backward on the line; ;/, to repeat
t/T – find character before forward/backward; ;/, to repeat
/{regex} – search forward; ?{regex} – search backward; n/N to move between matches

12. Bookmarks

In normal mode, m{a‑z} defines a local bookmark; `{a‑z} jumps to the exact position, '{a‑z} jumps to the line start. Common letters are mm, mn, mj, mk, ml. Global bookmarks ( m{A‑Z}) are not supported in the current IdeaVim version; use IntelliJ's F11 + number instead.

13. Text replacement

:s/{pattern}/{replacement}/      – replace first match on the current line
:s/{pattern}/{replacement}/g   – replace all matches on the current line
:%s/{pattern}/{replacement}/g  – replace all matches in the file
:'<,'>s/{pattern}/{replacement}/g – replace in visual selection (range limited to whole lines)

14. Code folding

zo – open fold
zc – close fold

15. Macro definition

Start recording with q{reg} in normal mode, stop with q. Replay with @{reg}. Macros share the same registers as copy‑paste, so avoid using a register for both purposes. Registers persist across IDE restarts, but IdeaVim cannot export macros separately.

When recording, align the cursor (using 0, ^, T, F, etc.) before the action to make the macro independent of the exact cursor position.

16. Common combo tricks

Select all: ggVG
Swap two characters: xp
Duplicate line: yyp
Swap two lines: ddp
Insert to end of line from insert mode: Ctrl+o A
Insert to start of line from insert mode: Ctrl+o I
Jump to class definition (public/protected): ?^p<Enter>

17. Known missing Vim features in IdeaVim

The following Vim capabilities are not yet implemented: :let command (cannot import/export registers or macros) :g command (global command) ! command (shell execution)

Most regex flags (e.g., \%V, \v)

Double‑tap commands for line‑wise actions (e.g., gUU)

Window management commands ( Ctrl+w series, :split, etc.)

Vim script plugins

Undo with u, redo with Ctrl+r works as expected.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

code editingIntelliJIDE TipsIdeaVimVim shortcuts
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.