At line 3 changed one line |
The VI editor has three main modes: |
VI is the standard visual text editor available on all Unix, Linux, BSD, and other Unix-like computer systems. It also comes with Mac OS/X, and is available for Windows. |
At line 5 added 2 lines |
The VI editor has three modes: |
|
At line 6 changed one line |
* edit mode (insert or overtype text) |
* edit mode (insert or over-type text) |
At line 15 changed one line |
nothing so if you are confused just hit the Esc key and you'll know |
nothing. So if you are confused, just hit the Esc key and you'll know |
At line 37 changed 3 lines |
|:w|save file but don't quit |
|:w newname|save file to new file named newname |
|:r filename|read file filename into the current buffer after the current line |
|:w|write (save) file but don't quit |
|:w newname|write (save) file to new file named newname |
|:wq|write (save) and quit |
|:r filename|read (insert) file filename into the current buffer after the current line |
At line 41 changed one line |
!!Cursor Movement |
!!Cursor movement (in addition to possible cursor keys) |
At line 43 changed one line |
(The letters hjkl on the keyboard form a sort of arrow keys)\\ |
(The letters hjkl on the keyboard form a set of arrow keys)\\ |
At line 52 added 2 lines |
See Searching below. |
|
At line 54 changed one line |
|0| beginning of line |
|0| beginning of line (zero) |
At line 58 changed one line |
|15G| goto line 15 (basically you can preced G with any line number) |
|15G| goto line 15 (basically you can precede G with any line number) |
At line 63 changed one line |
!!Screen Movement (scrolling) |
!!Screen movement (scrolling) |
At line 72 changed one line |
!!Text editing (all text entry except r ends by hitting the Esc key) |
!!Text editing (Edit Mode - all text entry except "r" ends by hitting the Esc key) |
At line 76 changed 2 lines |
|r| replace a single character |
|R| replace or over-type (doesn't require Esc key to end) |
|r| replace a single character (doesn't require Esc key to end) |
|R| replace or over-type |
At line 79 changed 2 lines |
|o| add text after the current line (open a line) |
|O| add text before the current line |
|o| add text after the current line (open a line) (oh) |
|O| add text before the current line (capitol oh) |
At line 93 added one line |
|X| delete previous character |
At line 99 changed 2 lines |
|/xxxxx<return-key>| search forward for xxxxx |
|?xxxxx<return-key>| search backwards for xxxxx |
|/xxxxx<return-key>| search forward for regular expression xxxxx |
|?xxxxx<return-key>| search backwards for regular expression xxxxx |
At line 109 added one line |
Vi's regular expression syntax corresponds to grep's basic regular expression syntax. See [grep] |
At line 111 added one line |
|
At line 120 removed one line |
|.| repeat last text-changing command |
At line 129 added one line |
|.| repeat last text-changing command |
At line 134 added 2 lines |
|!cmd|run cmd in a separate shell |
|r!cmd|run cmd in a separate shell and insert result into buffer |
At line 137 added one line |
|
At line 209 added one line |
|:N|previous file is switched to |
At line 215 added one line |
---------------------------------------------------------------------- |
At line 217 added 58 lines |
!!!VIM Commands |
|
VIM, a popular version of VI, has the following additional commands available to it: |
|
!!Buffers |
|
|:ls|list buffers |
|:bn|next buffer |
|:bp|previous buffer |
|:bN|switch to buffer named N (with tab completion) |
|
|
!!Windows |
|
Window commands begin with ^w. The second letter can be either the letter by itself, or at can be used as a control letter (so you don't have to release the control key if you don't want to.) |
|
!Opening and closing windows |
|
|^ws|split window horizontally |
|^wv|split window vertically |
|^wn|edit a new file in an additional / new window |
|^wc|close the window you are in |
|^wo|close all other windows |
|
! Moving cursor to different windows |
|
Use ^w followed by h, j, k, l, up arrow, down, left, or right to move the cursor to the indicated window. |
|
! Controlling the window size |
|
|^w=|Make all windows equal size |
|^w-|Make current window smaller (also takes prefix argument) |
|^w+|Make current window larger (also takes prefix argument) |
|
|
!! Editing remote files |
|
vim scp://username@host.com/path/to/file |
|
:e scp://username@host.com/path/to/file |
|
!! VIM Startup |
|
When vim starts up, it reads the file ~/.vimrc |
|
You can put configuration commands in that file. |
|
! Stopping the colors |
|
Put the following in .vimrc |
|
{{{syntax off}}} |
|
|
|
|
|
|