VIM for beginners (Part III)

VIM for beginners (Part III)

This is the last post about VIM for beginners. You are on the way to become a VIM master. As you may found, this is not so easy to learn VIM and this is also talking about previous posts (part 1 and part 2). When you feel the power in your hands using VIM, you will want something more and this is what this post about. We’ll speak about some useful things you have to know before you can go by yourself. All topics will be discovered superficially in order to let you decide what you want.

VIM is not an IDE

Yeah, VIM is not an IDE despite that you can setup it to perform almost all IDE functions. I am sure you won’t leave your favorite Visual Studio or WebStorm and that is why I prepared the list of plugins for your IDE and not only IDE. Go ahead:

  • VSVim for VisualStudio
  • VS VIM for VSCode
  • IdeaVim for WebStorm, IntelliJ IDEA (and other Jetbrains products)
  • Sublime text has Vintage mode out of the box
  • Vim mode for Atom
  • XVim for XCode
  • Hardcore! Do not repeat this at home! Google Chrome also has extensions for VIM-like navigation. (find it in Chrome Store)

Still, you have to keep in mind that the maximum performance can achieved by using just VIM. Basically, it is suitable for small js/html/css projects, editing configuration files or just as replacement of your notepad++ :)

VIM plugins

VIM has thousands of plugins for any caprice. Here you can found almost everything from file explorer and git integration to build systems.

One of my favorite plugins is EasyMotion. It was created to speed up your navigation in VIM. EasyMotion is very sophisticated and deeply integrated within VIM philosophy. For example if you just want to navigate to a specific line behind the current one, you can do this by pressing j key several times. In comparison, with EasyMotion you can press leader key (in my case TAB) and j to highlight all the lines behind with different letters. All that has left to do is to press the letter which represents the line you need.

EasyMotion

In my case I pressed TAB key and ju to navigate to the appropriate line. It was the easiest example and as usual, in the world of VIM you can craft almost any command according to your needs.

Mappings

This feature I decided to consider separately. You may think about mapping as key bindings for all modes. That is to say, you can bind some pattern to perform some actions in different modes. I know, nothing is understandable.

So let’s look at the easy and real example. Almost every person who works in VIM does not change mode from insert to normal by pressing ESC. We are doing it by pressing jj because we have the following mapping: :imap jj<ESC>. imap stands for insert mode mapping and means that it works only in insert mode.

You can map everything you want to do and this will save your time in future. Read more about mapping here.

VIM features

There are a lot things to learn in VIM besides the features mentioned above. You definitely should pay attention to the following list:

  • global commands
  • search and replace
  • macros and registers
  • buffers
  • tabs
  • indents and foldings
  • autocommands

They may exist in other development tools, but this is VIM. All things considered, it means that you will wonder how brilliant all this things are constructed. Check it out to make sure.

Configuration

There are a lot of VIM settings which have to be stored somewhere in order to use the same settings for all editors with VIM plugin. And this is the responsibility of .vimrc file. By default, in Windows 10 this file is located in C:\Users\Current_User. Here you can setup all mappings, autocommands, plugins, colorscheme and all other settings. I’ve found pretty good article how to setup your own .vimrc file so you can practice by yourself.

Note: Don’t put any lines in your .vimrc that you don’t understand

Awesome VIM courses:

Master Yoda

May the VIM be with you.

If you enjoyed the post, please follow up and thank you for reading my blog.

UPDATED
Level up your vim skills in the next post.

Advertisements

6 thoughts on “VIM for beginners (Part III)

  1. Excellent article! I have heard about VIM, but didn’t think it has so many features. I suppose I should start learning VIM to increase my productivity.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s