News for hackers. Stuff that matters.
Re:Advanced Vim Registers by gws on Wednesday January 09, 2013 @03:25AM (#5030707)
A less powerful but much simpler alternative to using the registers is the Yankring plugin (https://github.com/vim-scripts/YankRing.vim)

With that anything you have ever yanked or deleted is in the ring and when you paste something you can easily rotate through the items in the ring. Basically you type 'p' to paste and if that's not what you wanted you keep pressing ctrl-p until you get what you want.

Re:Advanced Vim Registers by petepete on Wednesday January 09, 2013 @07:00AM (#5031137)
I've just been through the YankRing tutorial and it's fantastic; I don't know how I haven't come across this before. Thanks!
Re:Advanced Vim Registers by crazydiamond on Wednesday January 09, 2013 @11:43PM (#5035469)
I used it (YankRing) for some time, but it was never consistent. The plus point is that it works across terminal, otoh often "p" did not work, so i would have to do "YRShow" and select.

Often this is used, but everything you delete gets copied to your clipboard.

       set clipboard=unnamed
So i prefer to map C-c and C-x (or whatever) to copy/cut to clipboard.

    " regardless of clipboard option, c-c copies selection to clip
    vmap <C-c> "+y
    " cut into clipboard
    vmap <C-x> "+d
    " copy to clipboard, http://news.ycombinator.com/item?id=4767227 , use 3 \y to copy 3 lines
    map <leader>y "+yy
    " paste from clipboard
    map <leader>p "+p
    " delete to black hole register, not going to clipboard etc
    nnoremap <leader>d "_d
    vnoremap <leader>d "_d
I've also mapped a key to write selected lines to a file, and another to read from it.

    map <silent> <leader>ww  :w! ~/tmp/vimxfer<CR>
    map <silent> <leader>wa  :w!>> ~/tmp/vimxfer<CR>
    nmap <silent> <leader>rr  :r ~/tmp/vimxfer<CR>
Pls refer to post below on "reattach to user namespace" for OSX ML users.