How can I save a text block in visual mode to a file in Vim?

后端 未结 8 2135
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 18:54

The title is very descriptive. Just in case, I will give an example:

START BLOCK1
something
END BLOCK1

START BLOCK2
something
somenthing...
END BLOCK2
         


        
8条回答
  •  执念已碎
    2020-12-23 19:17

    There's probably a simpler way to do this, but what I would do is create a new buffer (or tab) and then paste it in with p. You can create a new buffer with :new or a new tab with :tabnew. You can write the buffer/tab to a file as normal with :w filename.

提交回复
热议问题