- Published on
Unleash The Power Of .ideavimrc: Enhance Your IntelliJ IDEA Experience With Advanced Features
- Authors

- Name
- Kiet
IntelliJ IDEA is undoubtedly a powerful integrated development environment (IDE) that offers a plethora of features to enhance your coding experience. However, if you’re a Vim enthusiast, you might find yourself missing some of the beloved Vim keybindings and functionality. Fear not! With the .ideavimrc file, you can unlock a whole new level of productivity and customization within IntelliJ IDEA. In this article, we’ll explore some of the key features and capabilities that .ideavimrc brings to the table.
Surround text with function
set surround
The ability to surround blocks of code with function declarations or other structures is a time-saver. With the built-in surround setting, you can effortlessly surround selected text with function templates.

Multi-Cursor edit
set multiple-cursors
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
nmap g<C-n> <Plug>NextOccurrence
xmap g<C-n> <Plug>NextOccurrence
xmap <C-x> <Plug>SkipOccurrence
xmap <C-p> <Plug>RemoveOccurrence
Vim’s multi-cursor feature is a game-changer when it comes to making repetitive edits. The built-in multiple-cursors setting allows you to harness this power within IntelliJ IDEA, enabling you to edit multiple occurrences simultaneously and accelerate your refactoring tasks.

Replace with register
set ReplaceWithRegister
Replacing text with content from a specific register is a nifty Vim feature. You can seamlessly replace the selected text with the contents of a register without overriding your register data.

Highlight yanked text
set highlightedyank
let g:highlightedyank_highlight_duration = "5000"
let g:highlightedyank_highlight_color = "rgba(57, 62, 65, 255)"
Keeping track of the last yanked (copied) text is essential for efficient editing. Enabling this setting will automatically highlight the last yanked text, ensuring that you have visual feedback on what was copied and aiding in subsequent paste operations. You can also set the color and highlight duration.

Rename current file
nmap <leader>rf <Action>(RenameFile)
The ability to rename files quickly is crucial for maintaining a well-organized project. This mapping allows you to rename the current file quickly without navigating to the file structure tree.

Move line(s) up and down
vmap <S-J> <Action>(MoveLineDown)
vmap <S-K> <Action>(MoveLineUp)
Moving lines up and down is a common operation during code rearrangement. This mapping grants you the power to effortlessly move one or more lines up or down within your codebase.

Comment
set commentary
I prefer the commentary package mapping, you can simply use the IDE comment shortcut.


Move Between Bookmarks (Global)
nmap ]b <Action>(GotoNextBookmark)
nmap [b <Action>(GotoPreviousBookmark)
Bookmarks are a handy tool for efficiently navigating through your codebase. These mappings help you move between bookmarks globally, enabling you to jump between different sections of your codebase with ease.

Move between changes in current file
nmap ]c <Action>(VcsShowNextChangeMarker)
nmap [c <Action>(VcsShowPrevChangeMarker)
Navigating through changes within a file is crucial for understanding code revisions or reviewing modifications. These mappings enable you to navigate between changes within the current file, making it simple to review and comprehend code alterations.

Move between issues in current file
nmap ]e <Action>(GotoNextError)
nmap [e <Action>(GotoPreviousError)
Dealing with errors is an essential part of the development process. With these mappings, you can navigate through errors within your codebase effortlessly, helping you locate and resolve issues more efficiently.

Split window
nmap sh :split <CR>
nmap sH <Action>(MoveTabDown)
nmap sv :vsplit <CR>
nmap sV <Action>(MoveTabRight)
nmap ss <Action>(MoveEditorToOppositeTabGroup)
Working with multiple files simultaneously is a common scenario in complex projects. These settings offer the ability to split the editor window, allowing you to view and edit multiple files side by side, enhancing your productivity and providing a better overview of your codebase.

Move between split windows
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
Efficiently switching between split windows is vital for seamless navigation and code editing. The below mappings enable you to move between split windows easily, providing a quick way to switch your focus between different code files.

Expand current split window
nmap so <Action>(MaximizeEditorInSplit)
Sometimes you need to focus on a particular file and maximize its editor window. This mapping allows you to maximize the editor window in a split view, offering a distraction-free environment for concentrated coding.
