In Vim, what is the best way to select, delete, or comment out large portions of multi-screen text?

前端 未结 16 1142
醉话见心
醉话见心 2021-01-31 09:43

Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and de

16条回答
  •  时光说笑
    2021-01-31 10:33

    To insert comments select the beginning characters of the lines using CTRL-v (blockwise-visual, not 'v' character wise-visual or 'V' linewise-visual). Then go to insert-mode using 'I', enter your comment-character(s) on the first line (for example '#') and finally escape to normal mode using 'Esc'. Voila!

    To remove the comments use blockwise-visual to select the comments and just delete them using 'x'.

提交回复
热议问题