Difference between revisions of "Vi"

From FOG Project
Jump to: navigation, search
m (Quick reference for basic editing in Vi)
m (Quick reference for basic editing in Vi: fixed a small error.)
Line 30: Line 30:
 
Example of usage...
 
Example of usage...
  
<pre>[root@localhost ~]# vi README.txt</pre>
+
<pre>[root@localhost ~]# vi /README.txt</pre>
  
 
<pre>i
 
<pre>i

Revision as of 16:49, 8 June 2015

Quick reference for basic editing in Vi

Vi is a very basic (yet incredibly powerful) text editor that comes with just about every single Linux Distribution. Using Vi allows you to avoid installing other text editors.


Basic Instructions:


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!