When working with unix/linux, it is a good thing to know, at least, just a little of vi,
so here is the :
*** abolut shortest vim user guide ***
- to open a file
vi /var/tmp/prova.txt
0. vi has 2 mode: command mode (for command), and insert mode (for text insertion)
when starting vi, your are in the command mode of the editor vi
- to switch into command mode
<esc>
- to switch into insert mode
i
and then you can insert text
- to switch back into command mode
<esc>
A.
- to copy the current line
yy
- to delete the current line
dd
- to paste the buffer
p
B.
- to copy the 3 lines from the current line
3yy
- to delete the 3 lines form the current line
3dd
- to paste 3 time the current buffer
3p
C.
- to delete the current character
x
- to paste the buffer
p
D.
- to delete the 3 characters form the current position
3x
- to paste 3 time the current buffer
3p
E.
- to write the file
<esc>:w
- to write the file to /var/tmp/a.txt
<esc>:w /var/tmp/a.txt
- to quit
<esc>:q
- to write and to quit
<esc>:wq
- to quit without write the present modified file
<esc>:q!
enjoy
so here is the :
*** abolut shortest vim user guide ***
- to open a file
vi /var/tmp/prova.txt
0. vi has 2 mode: command mode (for command), and insert mode (for text insertion)
when starting vi, your are in the command mode of the editor vi
- to switch into command mode
<esc>
- to switch into insert mode
i
and then you can insert text
- to switch back into command mode
<esc>
A.
- to copy the current line
yy
- to delete the current line
dd
- to paste the buffer
p
B.
- to copy the 3 lines from the current line
3yy
- to delete the 3 lines form the current line
3dd
- to paste 3 time the current buffer
3p
C.
- to delete the current character
x
- to paste the buffer
p
D.
- to delete the 3 characters form the current position
3x
- to paste 3 time the current buffer
3p
E.
- to write the file
<esc>:w
- to write the file to /var/tmp/a.txt
<esc>:w /var/tmp/a.txt
- to quit
<esc>:q
- to write and to quit
<esc>:wq
- to quit without write the present modified file
<esc>:q!
enjoy