3. Why VI editor?
1.Move your fingers not hands.
2.Fast editing and movement
3.Light weight
4.Many plugins
4. Vim Modes
Three Modes
1.Command Mode - ESC, Ctrl-c (We navigate, hit shortcuts)
2.Insert Mode - i, a, s (We write here)
3.Visual Mode - v, Ctrl-v (We select text here)
Visual Mode isn’t provided in ‘vi’ editor, its added
in vim.
5. Never Forget hjkl
In Command Mode
1.h - Left
2.j - Down
3.k - Up
4.l - Right
5.:w - save
6.:wq - save and quit
6. Insert Mode
1.i - insert where the cursor is
2.a - insert next position
3.s - delete current position and insert
7. Visual Mode
1.v - start selection
2.Ctrl-v - Vertical selection
3.Shift-v - Select by line
Try: ‘Shift-v’ and press ‘y’ then ‘p’
8. Common Shortcuts
1.Using numbers for navigation:
a.10l - position cursor after 10 letters (left direction)
b.99k - move up 99 lines (k is up)
c.33s - delete 33 letters and then insert
2. Ctrl-d = page down
3.Ctrl-b = page up
4.:%s/old_pat/new_pat/g = replace old_pat with new_pat
9. Vim as an IDE
1.Syntax highlighting = syntastic
2.Autocomplete = youcompleteme, jedi-vim, ctags
3.Browse files = nerdtree, ctrlp
4.Status = Vim airline
5.Git = fugitive
6.Code snippets = Ultisnips
7.Edit history = Gundo
10. Basic Vimrc
syntax on
filetype plugin indent on
set autoindent
set backspace=indent,eol,start
set expandtab " enter spaces when tab is pressed
set tabstop=4 " use 4 spaces to represent tab
set shiftwidth=4