Last active
December 5, 2015 18:56
-
-
Save mawaldne/b47337f05446f17a9cbf to your computer and use it in GitHub Desktop.
Vim - Automatically yank to system clipboard from Visual mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yank normally, but just copy it automatically to your system clipboard as well. | |
Added to my .vimrc. Should work from visual mode when you press y and from ex mode: 1,10YankToSystemRegister | |
" Auto Yank text to the OS X clipboard | |
function! CopyToSystemRegister() | |
let @*=@" | |
endfunction | |
command! -range -bar YankToSystemRegister <line1>,<line2>yank|call CopyToSystemRegister() | |
vnoremap y :YankToSystemRegister<cr> |
set clipboard=unnamed
is probably as good as it gets. Im not a fan of having everything characters go to the system clipboard though but vim registers still work fine.
Also started using yankring.vim which is awesome
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hmmm, one problem with this is now regular registers dont work. "ay, content isnt in the A register. Wonder if theres a way to get the current selected register?