At half time in Game 6 of Knicks vs Hawks, Cory Kisper is the only Hawks player with a positive +/-. In his 5 minutes of playing time the Hawks have scored 3 more points than the Knicks.
u/InternationalDog8114
There are many times when you copy something, and before pasting, there are still some deletions you need to make. Traditionally one uses many of the named registers to accomplish this, but even after years their usage for this purpose never became fluid to me. It is true that many other patterns have taken a long time to "click" for me, and perhaps this one just needs a little longer, but I have decided for the time being I cannot wait.
I came up with a solution I find more intuitive (but more limited): have a mapping that toggles whether or not the unnamed register is locked, i.e., upon locking, any further deletions will not replace the contents of the register, and upon unlocking behavior returns back to normal. What do you guys think? Maybe you are already content / quick at using the traditional approach? Or maybe you use some plugin?
let g:reglock_enabled = 0
let g:reglock_value = ''
let g:reglock_type = ''
function! ToggleRegisterLock()
if g:reglock_enabled
let g:reglock_enabled = 0
echo "Register lock OFF"
else
let g:reglock_value = getreg('"')
let g:reglock_type = getregtype('"')
let g:reglock_enabled = 1
echo "Register lock ON"
endif
endfunction
function! RestoreLockedRegister(timer)
if g:reglock_enabled
call setreg('"', g:reglock_value, g:reglock_type)
endif
endfunction
nnoremap <leader>l :call ToggleRegisterLock()<CR>
augroup RegisterLock
autocmd!
autocmd TextYankPost * if g:reglock_enabled | call timer_start(0, 'RestoreLockedRegister') | endif
augroup END