Why i’m choosing coding in VIM?
- It looks cool, super cool.
- Think a coding Jedi you are some will. —- Master Yoda.
- It allows you to code anywhere, since all you need is SSH/MOSH.
- Yes, that being said, you can even be coding on your iPad, and you will not feel any difference.
Difficulties I need to overcome:
- Memorize tons of commands.
- Forget my mouse/trackpad, be thinking without mouse.
- The fact that VIM lacks many modern features which other GUI text editors have.
- Luckily, there are tons of plugins helping us to solve this problem, and this is what I will document in this article.
Without further do…
Firstly, I need a plugin manager, and they said Pathogen is the best choice.
What does Pathogen do?
They said it’s a runtime manager or something… well, I don’t know what is runtime.
But what it does is:
Allowing you to simply put plugins in a certain folder, then Pathogen will load it automatically.
- Which means, all you need to do is cloning a plugin from github.
- by default, this directory is
- Of course, writing some configuration in
~/.vim/.vimrcwill make your life even better.
In VIM, auto completion, a feature comes by default in other GUI editors, is a plugin which need to be installed manually.
And they said, to make this works better, you need to install something called tern.
I don’t what does tern do. I didn’t feel that it changed anything.
Not. A. Clue.
- You will need to compile YCM.
- You will need to install dependencies for tern.
- You will need a config file for tern.
For more info, see their documentation.
You can enable syntax highlight by write
syntax on in
For instance, in
splice will not be highlighted.
Weird, but we have a solution, which is
Simply install it by pathogen, then you are all set.
Been using Atom for a long time, I’m accustomed to the syntax color scheme of Atom.
Luckily, someone made a color scheme based on Atom, which is
placing colors/onedark.vim in your ~/.vim/colors/ directory and autoload/onedark.vim in your ~/.vim/autoload/ directory.
Then put some configuration in
syntax on colorscheme onedark
Since my linux only support 256 colors, I also added
I don’t know what would happen if I delete it, don’t ask me, I’m too lazy to try that.
This plugin gives you a tree show your directories on the left.
To use it, you need to memorize more commands.
So far, those commands I find useful are as follows:
Ctrl + nto toggle the display of NerdTree.
- this is because I added a line to change the hot key for this feature, will explain later.
qto hide NerdTree
tto open a file in a new vim tab
gtto jump to next vim tab
To change the shortcut for toggling NerdTree, add this line in
Also, this line will help you to close vim if you just closed the last file.
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
This is a powerful tool, too powerful for me to fully utilize it. I will keep learning.
Ladies and gentleman, this is —-
I love this statement, which is on their Github page.
It’s easy to use
syntastic. However, don’t forget to instal
npm -i -g jshint
And be cautious, the name is Jshint not Jslint
What I’m gonna do but I haven’t.
- Auto close syntax.
- Check if my syntax is valid automatically.