First of all you need to understand that use Vim is not about only the editor, it's about telling your friends that Vim is cool and they probably should use it too.
You suffered to learn and practice this editor and it's very fun and evil to see other people struggle at it. Ok, it's a joke. Anyway, I'm here to help !
When I first picked Git I read on some blog post that all of that was a Linus joke, in fact he was using CVS at home and laughing at us.
But why I'm telling you this ? Because when I picked Vim for the first time I thought the same. Here's some of my phrases while I was learning it:
- How can someone use this ?!
- Letters to navigate ? What the actual f*** ?
- Can I just edit this file, PLEASE ?!
- Ok, I'm done, I will just code this app with my default editor.
If you are blaming me for bad words it's because you never tried to learn this ... thing, ok ?! *cries in the corner*
But before you start I will answer a very common question:
Do I need to learn Vim ?
The short answer: No. But if you are reading this post it's because you probably already realized it has some advantages that worth a try.
Vim will not make you a better Engineer. A lot of awesome coders don't use Vim neither Emacs, don't worry. But you will probably edit faster and will be less tired after long sessions of programming.
One of the most important things when you are learning something new is the mindset. I will not lie to you, Vim is an advanced editor, it's not an easy thing to master. I use it for about 3 years now and I still consider myself a noob on it.
You need to understand that learn Vim is an investment. You are shaping a editor to you. But in the beginning the struggle is real, you will look like an idiot trying to type fast and failing. Don't worry, everyone failed a lot to learn it too, just chill and practice.
- Hey, wait. Neo what ?
Neovim is a project started by @tarruda that is refactoring a large portion of Vim's code to provide a better extensibility. I'm using it since it's beginning and even using HEAD build I had no problems at all, definitely recommend it. Since you trust me, let's install it using this instructions:
After you install it, go to your terminal and type:
You should see a screen like this one:
Yey ! You got it. If you don't wanna use Neovim and already have the Vim installed, no problem, your path will be basically the same.
First of all
Before start to poke around I will give to you the best advice of this tutorial: remap your ESC key.
And now the question:
- Do I really need to remap my ESC key ?
Short answer: YES.
Long answer: Vim is a editor which has modes (Ex: visual mode). So, you will have to change mode constantly through your editing process and we all know that ESC is not the most comfortable key in the keyboard for sure.
I suggest you to remap it for CAPS LOCK. Because it's a key that everytime you press it was not on purpose.
Now, I will use my talent on drawing to give to you a super simple scheme of keys to you begin :) ! Take a look:
So, you can see two groups: L and R. The L is where you will keep your left hand. The R group is for your right.
Now let's see what this buttons do. But, keep in mind that I will just resume what you need to know for now ok ? The very basic to begin:
|Ctrl + R||Redo|
Vundle is a plugin manager for Vim, which for me is the best right now. You will just need one single line to add a plugin and a command to use.
First you need to install it. Follow this instructions:
Now let's start to see some plugins to get things easier you in the beginning. All this plugins are compatible with Vundle, so it's a easy and fast setup.
A lot of expert users will tell that you don't need the project structure tree. It's true, but since you are coming for more light editors, let's get the things in your head first, so I think it's ok to use Nerdtree.
And if you like the plugin, just use it forever. No problem at all.
Everyone needs a fuzzy search nowadays right ? CtrlP is really amazing, I think it's one of the best plugins I ever used on Vim. You can install it with this instructions:
And learn about the basic usage here:
Syntactic will give to you all the syntax check that you need. Their instructions are not detailed for Vundle, but you just need to use the github url in your plugin list, run it and you are done. The docs are pretty detailed with question and tips:
Powerline is not totally required, but come on, it has style. It gives to you a nice color related to the current mode, it's a very useful feature mainly for beginners which are not very experienced with mode changes. Oh, and it's has themes !
Don't give up !
If you think that Vim is too hard for you and the struggle is too real to handle, don't give up. I gave up on Vim two times before I really got it.
If you need to get things done and think that Vim is slowing you down, use your mouse, stay on edit mode a lot, doesn't matter, just don't close the editor and back to your non modal buddy. With the time and practice you will get comfortable enough to not need to change editors anymore.
I will make more posts about Vim setup and tips in the future. But you can take a look at my vim configs already at my dot files repo here, you actually use it if you think that it fits well:
Good luck on your Vim journey. See you soon ! :)