Advanced Vim Registers
blog.sanctum.geek.nz
blog.sanctum.geek.nz
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.
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.I feel like this must exist but I've no idea what to Google for.
Also vimcasts.org, and check the zzapper page linked in the tips blog.
Regarding the system clipboard register: in OS X 10.8 the `"+` register no longer works. Has anyone found a way to get it working again?
If you want a quick fix for getting it working again, make sure /usr/local/bin is early on in your PATH and run "brew install macvim --override-system-vim"
So, highlight in visual mode, go into command mode, and !pbcopy
https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
You can install using 'brew install reattach-to-user-namespace'
You need to config tmux:- set-option -g default-command "reattach-to-user-namespace -l zsh"
then set vim to use to use the unnamed clipboard by default.
thanks for posting this!
My only gripe with vim is that the discoverability of features is god awful because :help is so overwhelming.