In traditional text editors, we have two distinct operations that remove text from a document:

  • Delete, which removes the text
  • Cut, which copies the text to the clipboard before deleting it (as above)

How can I perform these operations on the whole line where the cursor is?

2 Answers 2


Standard Solution

The command to delete the current line is "_dd (it cuts the line into the black hole (_) register).

The command to cut the current line is dd (it cuts the line into the default register).

If you want to use the content of the clipboard in another application (i.e. have the line copied into the system clipboard) it is helpful to have the following line into your init.vim or init.lua (in ~/nvim/ on Windows and in ~/.config/nvim/ on Linux or macOS).

On Windows:

" Make Vim/Neovim use the system clipboard (`*`) to copy (yank) and cut text:
set clipboard=unnamed

On Linux:

" Make Vim/Neovim use the system clipboard (`+`) to copy (yank) and cut text:
set clipboard=unnamedplus

Related Plugin

If you like to cut often you could be interested to the cut-cutlass plugin that introduce the distinction between the m move operation (the standard d) and the d delete operation.


One of the reason a delete operator could be needed is when we need to replace a part of a document by another already in the clipboard.

On other text editor the following pattern is used:

  1. copy the text to replace into the clipboard
  2. delete the text to be replaced
  3. past the text from the clipboard

On Vim where the delete operation is not so accessible ("_d) an alternative is:

  1. copy the text to replace in the default register
  2. select the text to be replace (in Visual mode)
  3. past the text from the default register
  • 1
    Or use "*dd/"+dd (depending on which clipboard register is appropriate for you).
    – D. Ben Knoble
    Commented May 26 at 11:58
  • "If you want to use the content of the clipboard in another application" we know it effectively needn't while the opposite is really needed ie we need to use the content of the Vim clipboard when working in another application Commented May 26 at 12:27

To delete a line, the operation dd (normal mode) or :delete (an Ex command) is used. Ignoring registers, this corresponds to a traditional delete operation.

Both commands take a register (["x]dd and :delete [x], using the notation in :help dd and :help :delete). In general, the default register is the unnamed register ("") and always holds the result unless you use the black-hole register ("_). Then, the result is also either in one of the numbered registers (deletes that span at least one line) or the small delete register ("-). Of course, in this case, the delete is a line, so "1 will hold the delete (and it will be pushed by subsequent deletes or yanks to "2, etc., until it is pushed out of "9 and lost). This does not change when specifying a lettered register (e.g., in "fdd, both "f and "1 contain the deleted line).

So, you can already see that for Vim all of these operations correspond to a traditional (but local to Vim) copy!

If you want to use some text in Vim from the OS clipboard or selection, you should use the "* (quotestar) and "+ (quoteplus) registers; see :help registers item number (8) and subsequent links. This is entirely orthogonal to which command puts the text in the register. In fact, it's possible to do :delete m | let @* = @m to affect the "1, "m, and "* registers all in one go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.