Vim

Posted on October 2, 2012
Tags: hacksoft

1 Essentials

Alt+U | undo
Ctrl+R | redo

2 Multifile

:qall! | quit all without saving
:qallw | quit all with saving

2.1 Single screen

Vi can take multiple files as arguments called buffers.
THIS IS NOT split screen.


:ls ,list buffers

:bnext ,moves focus to next buffer
:bprevious, moves focus to previous buffer
:

2.2 Split screen

vi -o2 file1.txt file2.txt
Ctrl+W H | focus left window
Ctrl+W J | focus up window
Ctrl+W K | focus down window
Ctrl+W L | focus right window

Add another split

:split newfile.txt

3 Number lines

:set number