5 ms·
Unify your vim clipboard with the system clipboard, they said. The integration is wonderful, they said. Well: 1/ copy URL from browser 2/ alt tab to vim not
by gorgoiler 5y ago
Unify your vim clipboard with the system clipboard, they said. The integration is wonderful, they said.
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)? :)
- avnigo 5y ago> 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.
- jarenmf 5y agoIf usually delete to another register to avoid that, "dd for example :)
- normie3000 5y agoDoesn’t dd delete the line under the cursor?
- Veen 5y agodd 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.
- Tyr42 5y agoThere'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.
- boondaburrah 5y agoAs 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.
- spectaclepiece 5y agoAfter 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
- avnigo 5y agoYou 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>==
- stavros 5y agoFor 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).
- _dain_ 5y agoI 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.
- julesnp 5y agoIf you don't need the old URL, I'd recommend this plugin: https://github.com/inkarkat/vim-ReplaceWithRegister https://github.com/inkarkat/vim-ReplaceWithRegister
- unionpivo 5y agoI just go to insert mode and shift-Insert , to insert from clipboard This works even if I ssh into something.