The Essential IdeaVim Plugins. A curated plugin list to enhance your… | by Amine Elhattami | Feb, 2022

A curated plugin checklist to reinforce your IdeaVim expertise

Picture by Justin Morgan on Unsplash

This submit is just not a copy-paste of the documentation of each plugin. As a substitute, with the mindset that you shouldn’t add a plugin simply because it’s well-liked, I attempted to clarify what each does or what downside it tries to resolve. Then, present you precisely find out how to set it up. After that, clarify find out how to use it with some examples.

Simple Movement is considered one of my favourite plugins. It emulates vim-easymotion, and its objective is fairly easy: it allows you to soar to the place you need in your supply code with the least quantity of keystrokes potential.

Picture by the writer.
Picture by the writer

Setup

First, set up the IdeaVim-EasyMotion and AceJump plugins from the IDE plugin settings. Then, add the next snippet to your .ideavimrc file.

Plug 'easymotion/vim-easymotion'
map <chief>F <Plug>(easymotion-s)
map <chief>f <Plug>(easymotion-f)

Utilization

After you hit one of many shortcuts you mapped and began typing, the plugin will add labels as an overlay to all of the phrases that match the characters you typed (see GIF above). These labels are distinctive, and when you sort them, your cursor will soar to the situation marked by the label.

The NERDTree plugin allows you to navigate the undertaking pane utilizing vim-style key bindings. It emulates NERDTree.

Picture by the writer

Setup

For a fundamental setup, add the next snippet to your .ideavimrc file:

Plug 'preservim/nerdtree`
map <c-t> :NERDTree<CR>
  • :NERDTreeClose : To shut the undertaking pane from the editor.
  • :NERDTreeFind : To set off the fuzzy search within the undertaking pane. Nonetheless, it’s value understanding that typing whereas on the undertaking pane begins the search. Nonetheless, since a number of keys like j, ok, and o are mapped to completely different instructions, you possibly can’t use this methodology to seek out information or folders that begin with these letters, and that is the place you have to to make use of :NERDTreeFind.
  • :NERDTreeRefreshRoot : To refresh the basis folder to mirror the most recent adjustments on disk.

Utilization

As soon as the undertaking pane expands (if it was closed) and acquires focus, you need to use a number of shortcuts to do all the things. I take advantage of the next shortcuts frequently, however you possibly can try the documentation for the entire checklist.

  • q: Shut the undertaking pane.
  • P: Soar to the basis node.
  • o: Open file or listing.
  • go: Open file however deal with the undertaking pane.
  • s: Open chosen file in a brand new vertical cut up.

The {surround} plugin emulates vim-surround, and, because the title suggests, helps take care of surrounding phrases or traces. It makes including, altering, or eradicating environment straightforward.

Picture by the writer.
Picture by the writer.

Setup

The setup is easy, and also you solely want so as to add the plugin to your ideavimrc. The plugin provides the instructions routinely.

Plug 'tpope/vim-surround'

Utilization

This plugin provides 4 primary instructions in regular mode

  • ds: To delete the surroundings.
  • ys: So as to add surroundings.
  • S: To {surround} the at present chosen textual content.
  • ds”: Delete the closest double-quotes environment.
  • ysiw<b>: Encompass the present phrase with <b> tag (iw means internal phrase.)

The multiple-cursors emulates vim-multiple-cursor plugin, and because the title suggests, it permits utilizing a number of cursors in a vim vogue.

Picture by the writer.

Setup

To make use of this plugin, add the next to your ideavimrc file.

Plug 'terryma/vim-multiple-cursors'

Utilization

This plugin provides three primary instructions in regular mode

  • <ALT-x>: deselect the present incidence and go to the following one.
  • <ALT-p>: deselect the present incidence and go to the earlier one.
  • C-c/Esc: to exit the mode

The commentary plugin emulates vim-commentary, and allows commenting code with vim motions.

Picture by the writer.

Setup

The setup is easy, and also you solely want so as to add the plugin to your ideavimrc. The plugin provides the instructions routinely.

Plug 'tpope/vim-commentary'

Utilization

This plugin provides three primary instructions in regular mode

  • gc + movement: Remark utilizing the movement.
  • gc: Remark chosen textual content.
  • gc2k: Remark the present line and the 2 traces above.
  • gcap: Remark the present paragraph.
  • gcii: Remark the present indent part (requires indent-object plugin).
  • gcae: remark your entire file (requires textobj-entire plugin).

The trade plugin emulates vim-exchange and makes it simpler to swap blocks of textual content round.

Picture by the writer.

Setup

The setup is easy, and also you solely want so as to add the plugin to your ideavimrc. The plugin provides the instructions routinely.

Plug 'tommcdo/vim-exchange'

Utilization

This plugin provides three primary instructions in regular mode

  • cxx : Much like cx however for the present line.
  • X: Much like cx however for the choose textual content.
  • cxc: Cancel pending trade.

This plugin emulates the vim-indent-object and defines a textual content object primarily based on the indentation ranges.

Picture by the writer.

Setup

The setup is easy, and also you solely want so as to add the plugin to your ideavimrc:

Plug ‘michaeljsmith/vim-indent-object’

Utilization

This plugin provides three textual content objects:

  • ai: Indent degree plus one line above
  • aI: Indent degree plus one line above and beneath.
  • cxii: Trade an indent degree.
  • dai: To delete an if assertion and all its directions.

This plugin emulates argtextobj.vim, and much like the indent object, it provides a brand new textual content object for arguments.

Picture by the writer.

Setup

To make use of this plugin, add the next to your ideavimrc file.

Plug 'vim-scripts/argtextobj.vim'
let g:argtextobj_pairs="[:],(:),<:>"

Utilization

This plugin provides three textual content objects:

  • ia: The parameter solely.
  • cia: Change an argument
  • vai: Choose an argument

This plugin emulates vim-textobj-entire, and much like the indent object, it provides a brand new textual content object for your entire file.

Setup

To make use of this plugin, add the next to your ideavimrc file.

Plug 'kana/vim-textobj-entire'

Utilization

This plugin provides three textual content objects:

  • ie: The parameter with out main and trailing clean traces.
  • dae: Delete all of the file content material.

This plugin emulates ReplaceWithRegister, and allows you to use the content material of the registers to exchange any textual content.

Setup

To make use of this plugin, add the next to your ideavimrc file.

Plug 'vim-scripts/ReplaceWithRegister'

Utilization

This plugin defines two instructions:

  • Visible[“x]gr: Exchange the choice with the contents of register x.

This plugin emulates vim-highlightedyank and acts as visible suggestions if you copy (yank) one thing.

Setup

To make use of this plugin, add the next to your ideavimrc file.

Plug 'machakann/vim-highlightedyank'

Utilization

As you copy a bit of textual content (y command), the textual content will get highlighted for the set period.

This submit shared the checklist of plugins that I frequently use with IdeaVim on any JetBrains IDE.

Need to Join?Observe me on Twitter, the place I frequently tweet about software program growth and machine studying.

More Posts