Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Often I want to delete something in Vim without moving it to a register. Is there a method of doing this? I find that having to explicitly specify the register "a to be a little much sometimes.

share|improve this question

It sounds like you're actually asking two related questions here:

  1. You want to delete text without it appearing in any registers
  2. You want to be able to specify a default register other than "

The first one can be done, just use the _ register, which is called the "black hole" register, instead of something like the a register. For example: "_dd

The second one can't be done, as far as I know.

See :help registers.

share|improve this answer
That still adds two more characters to the repeated task, I wanted to change the default register to _ so I shave two keystrokes off of a delete-paste cycle. – Evan Carroll Jul 30 '12 at 17:38
@EvanCarroll: You don't need to specify a register for a delete-paste cycle. Both operations use the default register (") by default. – garyjohn Jul 30 '12 at 18:09
Right, but I don't want the delete to clobber what is in the default register because I want to paste it without specifying a non-default register for the paste, or the delete. – Evan Carroll Jul 30 '12 at 18:12
Got it. In that case, and as Heptite wrote, I don't see a way to do that. – garyjohn Jul 30 '12 at 18:34

You can always do something like this:

nnoremap d "_d
vnoremap d "_d

But I wouldn't recommend it: Vim's default should stay the way they are.

Instead of "_d, I use these mappings to delete into the black hole register:

nnoremap <leader>d "_d
vnoremap <leader>d "_d

That's only shorter by one key but it's better than overwriting a Vim default.

I use this mapping when I need to paste something several times:

vnoremap <leader>p "_dP

Which goes like this:

10 yank something
20 select something else
30 paste over it
40 GOTO 20
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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