Today i start learning VIM which it takes me scracth my head overtime. Need a full 1 day to know that VIM actually is a powerfull text editor on the earth. Here are the reason why i and you should move into VIM rather using IDE editor :
1. VIM is widely used by many TOP developers around the world.
There so many great developer using VIM as default editor. Also, this editor became as standard in many insitution, big company and community. I heard that Googlers also using VIM with their custom configuration to editing and integrate with Google System.
2. VIM is text-editor that can be programmed.
For example, you need to edit Phyton files and press Shift+E to execute this file immediatelly. Which you can programmed Shift+E equal with command “/usr/bin/python your-script.py”. In another tabs, you need to do same thing, which Shift+e equal with “/usr/bin/php your-script.php”. You need text-editor that doing different service as based on the file extension.
Or maybe, you want to press F4 to commit this file into Github repo. It’s can be programmed as long as what you wanted to. You can make custom text editor based on your standard programming.
3. There only one editor that can match with VIM, called Netbeans. And yes, i still using Netbeans for editing some projects. And it’s still okay dude.
4. VIM is kind of investment. Just like you are PHP programmer that look Python is great language in the future. We need to invest them to be able catch up need in the future.
When you start to learning VIM, i suggest to give one full day and use is as many time you have. Practice is one key to gain your skill on everything.
I use Ubuntu 11.04 and Macbook Pro here. So, what i share here is 100% working on Ubuntu.
I assume you’re newbies like me before knowing VIM. So, there are 2 things that you should know about VIM, that called .vimrc & .vim. This are located on your home directory ( ~/ ).
.vimrc is contain VIM configuration and .vim contain many plugins, syntax, documentation and many additional things that loaded by .vimrc when you opening VIM. So, start to search about .vimrc and .vim on Google.
Basic things to use VIM ( quotes not included ):
1. To editing file, press “i” or “Insert”
2. To back into command mode, press “CTRL+C” and press “:” for start execute command
3. To save, press “:w”
4. To save and quit, press “:wq”
5. When you see it’s meaning Backslash Button
6. Use “CTRL+F” for PAGE DOWN and “CTRL+B” for PAGE UP
7. In command mode, you can use UP and DOWN arrow to use same command before. Like in shell.
How to copy paste in VIM ?
1. Press “v” and using your arrow keys to block some text
2. Press “d” to cut or “y” for copy. Then press “p” to paste
How to search in VIM ?
1. Press “:/” and type what do you want to search. ex: :/hello
2. To next search, press “n”
How to execute this script on VIM ?
Use “:! %”. Example, execute this python script by “:!python %”
That’s for basic. Now, i am approaching how to make VIM like my Netbeans editor which it have autocomplete, file tree, tag / function list, auto indentation and many else!
Actually, i’m going crazy here. So, i start build my VIM. I suggest you to open vimrc and follow link and documentation there. It’s will helping you to customize VIM as what you want.
Here are some of my steps ( All explanation already in vimrc ) :
1. Editing .vimrc and make basic things.
syntax on " syntax highlighing
filetype on " try to detect filetypes
filetype plugin indent on " enable loading indent file for filetype
set number " Display line numbers
set numberwidth=1 " using only 1 column (and 1 space) while possible
set background=dark " We are using dark background in vim
set title " show title in console title bar
set wildmenu " Menu completion in command mode on
set wildmode=full " cycles between all matching choices.
2. NerdTree ( https://github.com/scrooloose/nerdtree )
After clone it, copy all files into ~/.vim by
cp -dR nerdtree/* ~/.vim/
To start using NerdTree, type :NERDTree in Vim. To move between windows, press “CTRL+w+w”
Why we should you Pathogen? Here is some cases. You have downloaded many plugins into VIM folder. In one day, some of your plugins updated. Then, what you should do? Deleting old files ? What happen if you delete wrong files?. Using Pathogen will ease our development which make each plugin run independently and updated from github.
Thank to https://github.com/tpope.
To install Pathogen :
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim \
Is TextMate on VIM. I use Snipmate from Tpope as maintainer
% cd ~/.vim
% mkdir bundle
% cd bundle
% git clone git://github.com/garbas/vim-snipmate.git
# Install dependencies:
% git clone https://github.com/tomtom/tlib_vim.git
% git clone https://github.com/MarcWeber/vim-addon-mw-utils.git
% git clone https://github.com/honza/snipmate-snippets.git
4. Installing Python Debugger like Pylint, Pyflakes and Pep8
sudo pip install pylint
sudo pip install pyflakes
sudo pip install pep8
Go to https://github.com/yodiaditya/vim-netbeans and clone it!