The Vim Editor
Written on March 17, 2015
Estimated reading time :
3 mins
A long time back, I had conducted an interview in which I had asked “What tool do you use to edit PHP files ?”. The candidate had replied “vim”. I was impressed with his answer. However at that point in time, I didn’t know how powerful vim actually could be. This research is dedicated to vim.
About
- The Vim editor started as “Vi IMitation” on the Amiga family of computers in 1988, but was later relabeled “Vi IMproved”
- Since its first release for Unix systems in 1992, Vim has effectively eclipsed the original Vi, having won several awards and has been referred to as one of the most popular text editors.
Basics : Modes
Basics : Commands
- Mode Switching :
- Esc
- i
- Search :
- / & ? & \c
- n - Search as per cmd order
- N - Seach Backward as per cmd order
- Search & Replace :
- %s/old/new/gc
- Delete
- d
Some Popular Plugins
- Plugin Manager
- Plugin managers have evolved as : Pathogen -> Vundle -> NeoBundle
- The plugin managers listed above are all active & have legions of followers. For my part - I adopted the one which I found to be most active : Neobundle.
- Not necessary to install it but makes things easier to manage.
- Creates the directory ~/.vim/bundle, with a separate subdirectory for all the files of each extension. This structure allows users to easily and thoroughly delete extensions, either manually or via a file manager, and helps minimize potential conflicts when you have a couple of dozen extensions.
- Installation :
- Follow steps here : https://github.com/Shougo/neobundle.vim
- Themes
- Gives themes to the Vim Editer & makes it more easy on the eye
- Installation via NeoBundle :
/* save below line in .vimrc file */ NeoBundle 'bling/vim-airline' /* Enter vim via the shell */ vim /* Install desired bundles*/ :NeoBundleInstall
- Install powerline-fonts repository
- For more details : https://github.com/bling/vim-airline
- Syntastic
- Syntax Checking after saving the file via the Vim Editor
- Installation via NeoBundle :
/* save below line in .vimrc file*/ NeoBundle 'scrooloose/syntastic' /* Enter vim via shell */ vim /* Install desired bundles */ :NeoBundleInstall
- For more details : https://github.com/scrooloose/syntastic
- Fugitive
- Ability to execute git commands on the file via the Vim Editor
- Installation via NeoBundle :
/* save below line in .vimrc file*/ NeoBundle 'tpope/vim-fugitive' /* Enter vim via shell */ vim /* Install desired bundles */ :NeoBundleInstall
- For more details : https://github.com/tpope/vim-fugitive
- Nerd Tree
- Allows parallel browsing of folders from inside the Vim Editor
- Installation via NeoBundle :
/* save below line in .vimrc file*/ NeoBundle 'scrooloose/nerdtree' /* Enter vim via shell */ vim /* Install desired bundles */ :NeoBundleInstall
- For more details : https://github.com/scrooloose/nerdtree
References
- Learn Vim :
- Plugins :
- Installing Plugins manually : http://superuser.com/questions/404686/installing-plugins-in-vim
- Themes :
- Fly with vim airline - A Coding Monkey’s Blog http://www.banquise.org/software/bye-bye-vim-powerline-hello-airline/
- Syntax Checking :