How to delete (not cut) in Vim?

前端 未结 6 607
别那么骄傲
别那么骄傲 2021-01-29 17:52

How can I delete a line without putting it into my default buffer?

Example:

line that will be copied.

line that I want to be substitued with the previou         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-29 18:28

    Use the "black hole register", "_ to really delete something: "_d.
    Use "_dP to paste something and keep it available for further pasting.

    For the second question, you could use dw. is used to execute a normal command without leaving the insert mode.

    You can setup your own mappings to save typing, of course. I have these:

    nnoremap d "_d
    xnoremap d "_d
    xnoremap p "_dP
    

提交回复
热议问题