Wednesday, November 29, 2006

Close and manage file with vim

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

to close vim
to close vim without recording the modifications
to write the modification
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
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.
display information about vim

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

No comments: