Wednesday, September 7, 2011

Re: Writing only the selected characters

Being unsatisfied with existing solutions, I wrote this:

vmap <silent> <leader>y y:call Yank()<cr>
nmap <silent> <leader>p :call Paste(0)<cr>
nmap <silent> <leader>P :call Paste(1)<cr>

function! Yank()
let response = system("xclip", @")
endfunction

function! Paste(paste_before)
let at_q = @q
let @q = system("xclip -o")
if a:paste_before
normal! "qP
else
normal! "qp
endif
let @q = at_q
endfunction


Sayonara,
--
Bastien

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: