vi - bash (set -o vi) - less/man
<ESC>..................command mode.................................................... vi bash
Moving:
¬..........................left.......................................................................... vi
h............................left ......................................................................... vi bash
<backspace>.......left ......................................................................... vi bash
®..........................right........................................................................ vi
l.............................right ....................................................................... vi bash
<space>...............right ....................................................................... vi bash
............................up........................................................................... vi
k............................up........................................................................... vi bash less
-.............................up........................................................................... vi bash less
¯............................down...................................................................... vi
j.............................down...................................................................... vi bash less
+............................down...................................................................... vi bash less
<CTRL> F............move forward one page....................................... vi less
<space>...............move forward one page....................................... less
<CTRL> B............move backward one page ................................... vi less
0............................move cursor left to the start of the line................ vi bash
$............................move cursor right to the end of the line ............. vi bash
1G.........................move to the first line of the document................. vi less
G...........................move to the last line of the document................. vi less
Insert modes:
a............................append text to the right of the cursor.................. vi bash
i.............................insert text to the left of the cursor........................ vi bash
A...........................insert after the end of the line.............................. vi bash
I.............................insert at the start of the line................................. vi bash
o............................open a blank line below the current cursor line.. vi
O...........................open a blank line above the current cursor line. vi
Deleting:
x............................delete character at current cursor position ........ vi bash
dd..........................delete the current cursor line .............................. vi
D...........................delete to end of line.............................................. vi bash
Replace:
r<character>........replace character at current cursor position....... vi bash
R...........................replace mode ....................................................... vi ba
Useful commands:
u............................undo the effect of the last command .................. vi bash
..............................repeat the last command to change the text ..... vi bash
cw.........................change the word to the right of the cursor.......... vi bash
yy..........................copy the current line into the buffer..................... vi
dd..........................cut the current line into the buffer ...................... vi
p............................paste cut buffer after current cursor ................... vi
P...........................paste cut buffer before current cursor ................ vi
J............................join this line to the next ........................................ vi
/<string>...............search forward for given string ........................... vi bash less
n............................search forward for next occurrence of string ..... vi bash less
N...........................search backward for next occurrence of string . vi bash less
<CTRL> L............refresh screen....................................................... vi bash less
<amount><command>.......................................................................
..............................repeat command several times........................... vi
v............................command line to the editor................................... bash
<tab>....................guess file name..................................................... bash
File operations:
:w..........................write editor contents to original file...................... vi
:w file....................write editor contents to named file...................... vi
:r file......................read file into editor after cursor line..................... vi
Quit:
:wq or :x or ZZ.....write file and quit editor........................................ vi
:q!..........................quit the editor aborting any changes made........ vi