> 4/ paste new URL but get the old URL instead?!
To paste the copied URL instead of the deleted one, you can paste from the 0 register by using "0p.
Otherwise, depending on your system, pasting from the * or + registers (using "*p or "+p) will paste what you copied from the browser.
For me, the two things don't go to the same register, but for you, you can select the old URL and paste over it (vWp) instead of deleting and then pasting (dvWP).
Re:The weight of the clipboard
by spectaclepiece on Wednesday January 05, 2022 @03:01AM
(#29806357)
After reading this my mind went to the same place of viewing the clipboard as a stack. Wonder if that’s possible system-wide.
One solution I have in vim which I always forget to use is adding an additional d or p to use a secondary paste buffer:
vnoremap dd "ad
nnoremap ddd "add
nnoremap pp "ap
You can also move lines up and down using the move command:
:[range]m[ove] {address}
Some common remaps: vnoremap <c-j> :m '>+1<CR>gv=gv
vnoremap <c-k> :m '<-2<CR>gv=gv
inoremap <c-j> <Esc>:m .+1<CR>==gi
inoremap <c-k> <Esc>:m .-2<CR>==gi
nnoremap <leader>j :m .+1<CR>==
nnoremap <leader>k :m .-2<CR>==I got really annoyed by this, so made it so dd just deletes rather than adding to clipboard. If I really want to "cut" I highlight in visual select mode and press x.
Having the common deletion operation also default to adding to clipboard is a design mistake in Vim, I feel.
If you don't need the old URL, I'd recommend this plugin:
If usually delete to another register to avoid that, "dd for example :)
Re:The weight of the clipboard
by normie3000 on Wednesday January 05, 2022 @03:02AM
(#29806362)
Doesn’t dd delete the line under the cursor?
dd deletes the line under the cursor. "dd deletes something into the d register (the " is part of the command that selects the register). "d selects the register. The second d is the delete command. So you could do something like "dd2w to delete the next two words and save them into the d register. The same thing works with any named register, so a less confusing example might have been "cd2w to delete into the c register.
There's also a dedicated null register "_, so "_d really just deletes it without storing it anywhere. But I agree _ is harder to reach than d.
I also really like junegunn/vim-peekaboo, which really helps if I know I copied something, but I'm not sure how far down the stack it is.
Re:The weight of the clipboard
by boondaburrah on Wednesday January 05, 2022 @05:44AM
(#29807457)
As a VIM noob for the past 7 years, I've learned many times over that dd is cut (like yy is copy), not delete, despite what people say.
Well:
1/ copy URL from browser
2/ alt tab to vim notes
3/ delete old URL from notes
4/ paste new URL but get the old URL instead?!
How do I do the FORTH equivalent of swapping the two items on the top of the stack (and have a stack in the first place)? :)