【vim】save part of file to a seperate new file

来源:互联网 发布:阿里云潘爱民 编辑:程序博客网 时间:2024/05/28 18:45

(1)

:230,$w newfile

Saves from line 230 to end of file in newfile.
:.,600w newfile

Saves from the current line to line 600 in newfile.


(2)

:1,10w newfile
and then:
:340,$w >>newfile
newfile would contain lines 1–10 and from line 340 to the end of the buffer.