Vim is as an IDE (integrated development environment) is a pun on it as its really just an editor that was designed back in 1991. Perhaps “just” is a strong word. Vim evolved from VI and was one of the earliest editor along side EMACS.
Today, after a good 20 years, I believe it is still great, perhaps arguably one of the best development environments out there. You can find more information about it (https://en.wikipedia.org/wiki/Vim_(text_editor)). My experience of it starts from diving into it about 8 years before. Along the way I have swapped IDES from inteliJ, visual studio, sublime, dreamweaver? heck even notepad and its ++ derivatives. Vim has been probably one of the more interesting DE journeys I have done. and still learning every time.
Basics
You can install via homebrew
$ brew install vim
A standalone mac app can be installed as a cask from homebrew using
$ brew cask install macvim
You can proceed to start it. by typing in vim in the command line (terminal). One of the first questions definately raised by people who have never used vim is. How the heck do I quit out of vim!? .. this answer will save you. (1) hit escape key. (2) type in “:q” .. which stands for quit. There you go. your first vim command.
Vim commands
the following will be quite bland as I just type it all in as a reference. Vim is quite powerful, having to let you install additional packages to include spell checkers, linters, running bash cmds within vim, integrating git, enabling project drawers, syntax helpers for almost every language you can think of and most powerful of all which I think: is the ability to use this editor from within most VMs or cloud systems. Making it a breeze to editor or do some really funky stuff on the go.
to save and exit:
$ :wq [command mode]
to re-tab or re-space file:
$ gg=G [command mode]
to delete a line:
$ dd [command mode]
to go to top of page
$ gg [command mode]
to go to bottom of the page
$ G [command mode]
to copy line
$ yy [command mode]
to start editing (3 ways)
$ i [command mode]
$ a [command mode]
$ o [command mode:]
to search
$ / [command mode]
$ n [next / commmand mode]
$ N [previous / commmand mode]
moving using keys
$ h [left / command mode]
$ l [right / command mode]
$ j [up / command mode]
$ k [down / command mode]
to delete a character:
$ x [command mode]
to indent a number of lines:
$ >}
to change all the upper or lowercase, use visual mode to select all
$ u (for lowercase)
$ U (for uppercase)
Vim packages
some recommended packages you should start using is as follows:
- Plug
- Supertab
- vim-fugitive
- lightline.vim
- fzf
- vim-vinegar
- vim-gitgutter
- syntastic
- vim-colorschemes
- vim-sensible
Other packages which might help are as follows
- vim-javascript
- vim-markdown
- vim-ruby
- vim-less
If you are using Plug, you can update all your packages in one go using
$ :PlugUpdate
Have fun vim.