Wednesday, November 29, 2006

Close and manage file with vim

Let's continue with the best practice of the vim software:

:q
to close vim
:q!
to close vim without recording the modifications
:w
to write the modification
:w [NEW_FILE]
to write the file you are editing in NEW_FILE
:w! [FILE]
it is the same action as before but you force the action
:n,mw [FILE]
save the lines from n to m in the file FILE
:n,mw >>[FILE]
add the lines from n to m at the end of the file FILE
:wq ou :x ou ZZ
Save the file and close vim
:e!
edit the file again but with the version on the disk
:e [FILE]
edit the file FILE rather than the current file (:e! to force the action)
:r [FILE]
insert the file FILE after the current line
:rn [FILE] ou :nr [FILE]
insert the file FILE after the line n
n is either a number, or . for the current line, or $ for the last line.
:version
display information about vim

it should be enough today to play a little and increase your productivity lol ;-)


No comments: