Vim deletes go to a useful register again.
dblume

dblume commited on 2025-06-10 22:18:07
Showing 2 changed files, with 18 additions and 15 deletions.


Argh. Turns out my muscle memory does rely on deletes
going to a register. Writing a note to myself that really
the only way to do puts (pastes) that overwrite is to do
so over visual selections, not deletes (d,D) or changes (c,C).
... ...
@@ -30,16 +30,17 @@ set title titlestring=%f%m\ -\ nvim
30 30
 "            \   'cache_enabled': 0,
31 31
 "            \ }
32 32
 
33
-" N.B. Don't just use unnamed register for clipboard (set clipboard=unnamed)
34
-"      Delete operations would overwrite clipboard before pasting.
33
+" David, you rely on delete operations going to the default register.
34
+" So remapping to deletes to go to _ won't work for you.
35
+"
36
+"    nnoremap d "_d   <-- you won't like this.
37
+"
38
+" Get used to using visual mode to select the text you want to replace
39
+" with something that's in a register or the clipboard.
40
+"
41
+" Having said that, use unnamedplus.
35 42
 set clipboard+=unnamedplus
36 43
 
37
-" Deleting shouldn't overwrite the clipboard. Use yank when you want to copy.
38
-nnoremap d "_d
39
-nnoremap D "_D
40
-vnoremap d "_d
41
-vnoremap D "_D
42
-
43 44
 " Will remove these two remappings if unnamedplus (above) does the job
44 45
 " Yank and put into the system Clipboard (register + or *)
45 46
 " Otherwise make explicit commands "+yy "+y "+Y (or * instead of + as needed)
... ...
@@ -18,15 +18,17 @@ set ruler           " Show cursor pos on right side of status bar
18 18
 " Set the title of the terminal window. Consider changing titlestring, %t, %M
19 19
 set title titlestring=%f%m\ -\ vim
20 20
 
21
-" N.B. Don't just use unnamed register for clipboard (set clipboard=unnamed)
22
-"      Delete operations would overwrite clipboard before pasting.
21
+" David, you rely on delete operations going to the default register.
22
+" So remapping to deletes to go to _ won't work for you.
23
+"
24
+"    nnoremap d "_d   <-- you won't like this.
25
+"
26
+" Get used to using visual mode to select the text you want to replace
27
+" with something that's in a register or the clipboard.
28
+"
29
+" Having said that, use unnamedplus.
23 30
 set clipboard=unnamed,unnamedplus
24 31
 
25
-" Deleting shouldn't overwrite the clipboard. Use yank when you want to copy.
26
-nnoremap d "_d
27
-nnoremap D "_D
28
-vnoremap d "_d
29
-vnoremap D "_D
30 32
 
31 33
 " Will remove these two remappings if unnamedplus (above) does the job
32 34
 " Yank and put into the system Clipboard (register + or *)
33 35