Home » Questions » Computers [ Ask a new question ]

Configure VIM for copy and paste keyboard shortcuts from system buffer in Ubuntu?

Configure VIM for copy and paste keyboard shortcuts from system buffer in Ubuntu?

How do I configure VIM for using Ctrl-c to copy and Ctrl-v to paste from system buffer in Ubuntu?

Asked by: Guest | Views: 277
Total answers/comments: 1
Guest [Entry]

"Map Ctrl-V to run the system command that grabs the system clipboard and throws it into a register, and pastes it onto the screen under the cursor:

vmap <C-c> y:call system(""xclip -i -selection clipboard"", getreg(""\""""))<CR>:call system(""xclip -i"", getreg(""\""""))<CR>
nmap <C-v> :call setreg(""\"""",system(""xclip -o -selection clipboard""))<CR>p

Source: http://vim.wikia.com/wiki/In_line_copy_and_paste_to_system_clipboard"