Difference between revisions of "Vi"
Line 2: | Line 2: | ||
− | i = go into insert mode, here you may use arrows to navigate text, and edit it with the keyboard as normal. | + | <pre>i</pre> = go into insert mode, here you may use arrows to navigate text, and edit it with the keyboard as normal. |
Esc (the escape key) = exit insert mode | Esc (the escape key) = exit insert mode | ||
WHEN NOT in insert mode you may use: | WHEN NOT in insert mode you may use: | ||
− | :w (then enter) = write changes. | + | <pre:w</pre> (then enter) = write changes. |
− | :q (then enter) = exit vi | + | <pre>:q</pre> (then enter) = exit vi |
− | :q! (then enter) = exit vi without saving changes. | + | <pre>:q!</pre> (then enter) = exit vi without saving changes. |
Revision as of 03:52, 11 April 2015
Quick reference for basic editing in vi
i= go into insert mode, here you may use arrows to navigate text, and edit it with the keyboard as normal.
Esc (the escape key) = exit insert mode
WHEN NOT in insert mode you may use: <pre:w</pre> (then enter) = write changes.
:q(then enter) = exit vi
:q!(then enter) = exit vi without saving changes.
Examples of usage...
[root@localhost ~]# vi /README.txt
i This is my first readme file, wrote with vi! Esc :w :q
[root@localhost ~]# cat /README.txt this is my first readme file, wrote with vi!