Difference between revisions of "Vi"

From FOG Project
Jump to: navigation, search
(Added video tutorial.)
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
Quick reference for basic editing in vi
 
  
 +
== 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
+
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.
  
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.
 
  
 +
'''Basic Instructions:'''
  
Examples of usage...
+
Note: Avoid using the number pad in Vi.
 +
 
 +
 
 +
Go into insert mode, here you may use arrows to navigate text, and edit it with the keyboard as normal:
 +
<pre>i</pre>
 +
 
 +
Exit insert mode:
 +
<pre>Esc (the escape key)</pre>
 +
 
 +
 
 +
'''WHEN NOT''' in insert mode you may use:
 +
 
 +
Write changes:
 +
<pre>:w  (then enter)</pre>
 +
 
 +
Exit vi:
 +
<pre>:q  (then enter)</pre>
 +
 
 +
Exit vi without saving changes:
 +
<pre>:q!  (then enter)</pre>
 +
 
 +
 
 +
Example of usage...
  
 
<pre>[root@localhost ~]# vi /README.txt</pre>
 
<pre>[root@localhost ~]# vi /README.txt</pre>
Line 18: Line 36:
 
<pre>i
 
<pre>i
 
This is my first readme file, wrote with vi!
 
This is my first readme file, wrote with vi!
Esc
+
(Esc key)
 
:w
 
:w
 
:q</pre>
 
:q</pre>
  
 
<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>
 +
 
 +
External Video Link:
 +
 
 +
[https://www.youtube.com/watch?v=1konvzseurI Linux Vi - Basic Tutorial ]
 +
 
 +
Video:
 +
 
 +
<embedvideo service="youtube">https://www.youtube.com/watch?v=1konvzseurI</embedvideo>

Latest revision as of 03:40, 29 May 2016

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:

Note: Avoid using the number pad 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!

External Video Link:

Linux Vi - Basic Tutorial

Video: