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

前端 未结 16 1217
醉话见心
醉话见心 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:07

    You should be aware of the normal mode command [count]CTRL-D. It optionally changes the 'scroll' option from 10 to [count], and then scrolls down that many lines. Pressing CTRL-D again will scroll down that same lines again.

    So try entering

    V     "visual line selection mode
    30    "optionally set scroll value to 30
    CTRL-D  "jump down a screen, repeated as necessary
    y      " yank your selection
    

    CTRL-U works the same way but scrolls up.

提交回复
热议问题