How could I go about changing which buffer Visual mode will empty to when I override text?
I've rec开发者_StackOverflow中文版ently stumbled upon this useful feature:
nnoremap D "_d
Allowing me to do "Dd" or "D$" in order to delete things without overriding the default buffer. However,
nnoremap V "_v
doesn't seem to do the trick when I try and replace text by selecting and pasting over it.
Any suggestions on how I accomplish that? Thanks in advance.
I don't quite understand what you are trying to achieve.
d
is an operator, so you can decide to put the result of the delete operation into a given register; the _
register in your case.
However v
is not an operator, it is only a command to switch from normal to visual mode. So I don't think that "_v
makes much sense.
You might be thinking of another operator like c
(change), y
(yank) or p
(paste)
To get the full list of operators, type :help operators
You should have a look at :help registers
, you might find what you want, it describes all the registers and how they behave.
short extract :
""
is the default register"0
always contains the content of the latest "yank""1
always contains the content of the latest "delete" or "change"
The other numbered registers are used to keep the history of your previous actions.
So rather than avoiding to delete the default register when you are deleting you might use :
"0p
when pasting to be sure to paste the last yanked text and not what you have just deleted.
Edit : Add some Vim speak
A buffer is the in-memory text of the file you are editing. It contains the whole file. :ls
will display a list of open buffers.
A register is a buffer (for lack of better word) where your deleted or copied text goes. It could be a word, a line, etc. :reg
will display the content of all your registers.
精彩评论