Cut and paste multiple lines in vim

前端 未结 5 1328
旧时难觅i
旧时难觅i 2021-01-30 03:03

I\'m running vim 7.3 on a Mac 10.7.2 and I\'m having some trouble cutting and pasting several lines.

On my old Linux setup (which was stolen so I don\'t know versions)

5条回答
  •  一向
    一向 (楼主)
    2021-01-30 03:33

    Have you considered using visual mode?

    You could just go:

    • Press V
    • Select everything you want to cut without counting
    • Press d
    • Go to where you want to paste
    • Press p

    This should yield approximately half as many keystrokes as the dd method since you press one key per line rather than two. Bonus points if you use 5j (or similar) to select multiple lines at a time.

提交回复
热议问题