mirror of
https://github.com/jbranchaud/til
synced 2026-01-07 17:18:02 +00:00
Add The Black Hole Register as a vim til.
This commit is contained in:
@@ -66,6 +66,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
|
|
||||||
### vim
|
### vim
|
||||||
|
|
||||||
|
- [The Black Hole Register](vim/the-black-hole-register.md)
|
||||||
- [Buffer Time Travel](vim/buffer-time-travel.md)
|
- [Buffer Time Travel](vim/buffer-time-travel.md)
|
||||||
- [Close the Current Buffer](vim/close-the-current-buffer.md)
|
- [Close the Current Buffer](vim/close-the-current-buffer.md)
|
||||||
- [Count the Number of Matches](vim/count-the-number-of-matches.md)
|
- [Count the Number of Matches](vim/count-the-number-of-matches.md)
|
||||||
|
|||||||
19
vim/the-black-hole-register.md
Normal file
19
vim/the-black-hole-register.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# The Black Hole Register
|
||||||
|
|
||||||
|
Vim has a variety of registers for storing and moving around text. Vim also
|
||||||
|
has a special register called the *black hole register*.
|
||||||
|
|
||||||
|
> When writing to this register, nothing happens. This can be used to delete
|
||||||
|
> text without affecting the normal registers. When reading from this register,
|
||||||
|
> nothing is returned.
|
||||||
|
|
||||||
|
As stated in the docs, if you don't want to overwrite the unnamed register or
|
||||||
|
some other register when deleting text, you can use the black hole register.
|
||||||
|
For instance, to deleting the current line without any register side-effects
|
||||||
|
looks like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
"_dd
|
||||||
|
```
|
||||||
|
|
||||||
|
See `:h registers` for more info on Vim's registers.
|
||||||
Reference in New Issue
Block a user