Navigating through the Vim Changelist with Intellij

Featured image for sharing metadata for article

I'm a big fan of Vim - you can read about how I got started with it in my post Getting Started With Vim - but the reasons why are better left to another post.

Although I would prefer to be in Vim for most of the things I do, unfortunately there are a number of places that an IDE wins. While I was writing a lot of Ruby or Chef code, I was able to keep most of the resources and parameters in my head, but now I'm back to more Java code day-to-day, I need to use a full IDE for its autocomplete and intellisense.

The best choice for Java is IntelliJ, which fortunately has the IdeaVim plugin which makes it possible to use a pretty good Vim-mode.

A couple of years ago while working with core Vim, I discovered g; and g,, the two commands that allow you to cycle between the most recent changes in the file.

This has become part of my natural interactions with Vim since learning it, but became quite jarring when using IntelliJ and finding that IdeaVim doesn't support it, as evidenced in VIM-542, VIM-939 and VIM-1237.

However, thanks to Han Pei-Ru's comment on the issue go to last edit location using "g;", I finally have an answer!

We can add the following to the IdeaVim configuration file, ~/.ideavimrc:

nnoremap g; :action JumpToLastChange<Enter>
nnoremap g, :action JumpToNextChange<Enter>

And now, after years of just not looking into it, I can go back to a pleasant experience of being able to navigate more easily between changes in my files.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #intellij #vim #ideavim.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.