Difference between revisions of "Vi"

From FOG Project
Jump to: navigation, search
(Quick reference for basic editing in Vi)
Line 35: Line 35:
  
 
<pre>[root@localhost ~]# cat /README.txt
 
<pre>[root@localhost ~]# cat /README.txt
this is my first readme file, wrote with vi!</pre>
+
This is my first readme file, wrote with vi!</pre>

Revision as of 00:20, 26 April 2015

Quick reference for basic editing in Vi

go into insert mode, here you may use arrows to navigate text, and edit it with the keyboard as normal:

i

exit insert mode:

Esc (the escape key)


WHEN NOT in insert mode you may use:

write changes:

:w   (then enter)

exit vi:

:q   (then enter)

exit vi without saving changes:

:q!   (then enter)


Example of usage...

[root@localhost ~]# vi README.txt
i
This is my first readme file, wrote with vi!
(Esc key)
:w
:q
[root@localhost ~]# cat /README.txt
This is my first readme file, wrote with vi!