Wednesday, January 6, 2016

Learning the terminal text editors: vi/vim, emacs...

#Create a text file
vi /tmp/download.txt
#vim is improved vi

#To switch backup creation, add to the vimrc
set nobackup
set nowritebackup

#Create a directory in your home directory called vimtmp 
set backupdir=~/vimtmp
set directory=~/vimtmp

i: to start typing (inserting)

Esc: to move from insert mode to normal mode
#The following commands work in Esc or normal mode
x: to remove current character
X: to remove character to the left
A: to insert text at the end of line
u: undo action
0: cursor goes to start of the line
$: cursor goes to end of the line
^: cursor goes to first non-blank line
w: start
b: end

h: go left
l: go right
k: go up
j: go down
R: overwrites
:w Enter: save
:q Enter: quit

No comments:

Post a Comment