Difference between revisions of "Vi"

From FOG Project
Jump to: navigation, search
(Just thought this was needed.... probably going to link to this a LOT.)
 
Line 9: Line 9:
 
:q (then enter) = exit vi
 
:q (then enter) = exit vi
 
:q! (then enter) = exit vi without saving changes.
 
:q! (then enter) = exit vi without saving changes.
 +
 +
 +
Examples of usage...
 +
 +
<pre>[root@localhost ~]# vi /README.txt</pre>
 +
 +
<pre>i
 +
This is my first readme file, wrote with vi!
 +
Esc
 +
:w
 +
:q</pre>
 +
[root@localhost ~]# cat /README.txt
 +
this is my first readme file, wrote with vi!</pre>

Revision as of 03:50, 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

w (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!</pre>