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.
That’s it.
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…
Pathogen
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
~/.vim/bundle/
. - Of course, writing some configuration in
~/.vim/.vimrc
will make your life even better.
YouCompleteMe
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.
Note that:
- 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.
vim-javascript
You can enable syntax highlight by write syntax on
in ~/.vim/.vimrc
.
However, it doesn’t work well with javascript.
For instance, in array.splice(1,2);
, the splice
will not be highlighted.
Weird, but we have a solution, which is vim-javascript
.
Simply install it by pathogen, then you are all set.
color schemes
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 one dark
.
Quote:
placing colors/onedark.vim in your ~/.vim/colors/ directory and autoload/onedark.vim in your ~/.vim/autoload/ directory.
Then put some configuration in .vimrc
syntax on
colorscheme onedark
Since my linux only support 256 colors, I also added let g:onedark_termcolors=256
.
I don’t know what would happen if I delete it, don’t ask me, I’m too lazy to try that.
NERDTree
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 + n
to toggle the display of NerdTree.- this is because I added a line to change the hot key for this feature, will explain later.
q
to hide NerdTreet
to open a file in a new vim tabgt
to jump to next vim tab
To change the shortcut for toggling NerdTree, add this line in .vimrc
:
map :NERDTreeToggle
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.
Syntastic
Ladies and gentleman, this is —-
**Syntastic.
I love this statement, which is on their Github page.
It’s easy to use syntastic
. However, don’t forget to instal Jshint
by npm
afterward.
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.
0 Comments
Add Yours →