Fundamentals 24 min read

Boost Your Productivity: Master Vim Shortcuts in IntelliJ IDEA

This guide explains why and how to use Vim inside IntelliJ IDEA, covering essential commands, practical exercises, plugin installation, configuration tips, and custom action mappings to streamline coding and reduce mouse reliance.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Boost Your Productivity: Master Vim Shortcuts in IntelliJ IDEA

Vim is a highly configurable text editor that works on most UNIX systems and macOS, offering stability and continuous improvements. Integrating Vim with IntelliJ IDEA via the IdeaVim plugin combines the strengths of both tools, making coding more efficient.

Why Use Vim in IntelliJ IDEA?

Learning Vim alongside a new language or workflow can increase motivation by solving concrete pain points, especially for backend developers who frequently edit configuration files on Linux servers.

Installation

IdeaVim
IdeaVim-EasyMotion
IdeaVimExtension

Basic Exercises

Direction keys: practice hjkl instead of arrow keys.

Copy & paste: yy to copy a line, p to paste.

Additional commands: f, t, ciw, di", etc.

GIF demonstrations illustrate each step (images omitted for brevity).

Advanced Movements

[n]f{char}

– find character forward. $ / ^ – jump to end/start of line. % – jump between matching brackets. G / gg – go to last/first line. H, M, L – move to top, middle, bottom of screen. [n]w, e, b – word navigation.

Configuration

Open ~/.ideavimrc from the Vim icon in the lower‑right corner of IntelliJ and add common settings:

" Enable syntax highlighting
syntax on
" Show relative line numbers
set number relativenumber
" Show cursor position
set ruler
set wrap
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set smartindent
set backspace=2
set nobackup
set noswapfile
set keep-english-in-normal
set showmatch
set clipboard^=unnamed,unnamedplus
set cursorline
set fdm=marker

Key points are relativenumber for easier line navigation and keep-english-in-normal to auto‑switch to English input mode when entering command mode.

Custom Action Mappings

Map frequently used IntelliJ actions to Vim keys using the nnoremap command:

let mapleader = "\<space>"
" Rename element
nnoremap <Leader>re :action RenameElement<CR>
" Go to implementation
nnoremap <Leader>gi :action GotoImplementation<CR>
" Implement methods
nnoremap <Leader>im :action ImplementMethods<CR>
" Introduce variable
nnoremap <Leader>rv :action IntroduceVariable<CR>
" Copy reference
nnoremap <Leader>cr :action CopyReference<CR>
" Extract method
nnoremap <Leader>em :action ExtractMethod<CR>
" Surround with
nnoremap <Leader>sw :action SurroundWith<CR>

These mappings let you invoke powerful IntelliJ refactoring and navigation features directly from Vim mode.

Additional Tips

Use Ctrl+Alt+V (or a custom shortcut) to toggle the Vim emulator.

Set set so=5 to keep five lines of context while scrolling.

Leverage registers ( "0, "+) for system clipboard integration.

Visual mode selections ( v, V, Ctrl+v) enable block editing.

Repeat the last change with ., repeat the last :s with &, and replay macros with @@.

References

Bilibili Vim tutorial: link

Simple Vim guide: coolshell

Learn Vim repository: GitHub

Vim configuration tips: ruanyifeng

ConfigurationproductivityIntelliJ IDEAVimeditor shortcutsIdeaVim
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

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.