Try nvim clipboard+=unnamedplus
dblume

dblume commited on 2025-03-06 10:43:18
Showing 1 changed files, with 8 additions and 5 deletions.


It fixes the issue where just "unnamed" would have delete operations
overwrite the clipboard before pasting.
... ...
@@ -30,13 +30,16 @@ 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.
35
+set clipboard+=unnamedplus
36
+
37
+" Will remove these two remappings if unnamedplus (above) does the job
33 38
 " Yank and put into the system Clipboard (register + or *)
34 39
 " Otherwise make explicit commands "+yy "+y "+Y (or * instead of + as needed)
35
-" N.B. Don't use unnamed register for clipboard (set clipboard=unnamed)
36
-"      Delete operations would overwrite clipboard before pasting.
37
-" Also N.B. cscope_maps might assign <leader>c to its prefix.
38
-nnoremap <leader>c "+
39
-vnoremap <leader>c "+
40
+" N.B. cscope_maps might assign <leader>c to its prefix.
41
+"nnoremap <leader>c "+
42
+"vnoremap <leader>c "+
40 43
 
41 44
 " Make j and k move to the next row, not file line
42 45
 nnoremap j gj
43 46