Silently Redirecting to the Vim Clipboard
In an upcoming video tutorial, I’ll be doing a bit of work with the :redir command. This is a great Vim facility but it can be helped with a function wrapper. I’m including that wrapper here:
function! RedirToClipboardFunction(cmd, ...)
let cmd = a:cmd . " " . join(a:000, " ")
redir @*>
exe cmd
redir END
endfunction
command! -complete=command -nargs=+ RedirToClipboard
\ silent! call RedirToClipbaordFunction(<f -args>)
This function allows you to run a command (such as :history, hint hint) and have the contents placed to the clipboard that you can then paste somewhere else.
The command that is created just makes it easier to use. For example:
:RedirToClipboard history : -50,
Tedronai:
September 30th, 2010 at 12:24 pm
Nice… so this blog is finally back to life?! :-)
Just wanted to let you know that I really appreciate your previous tutorials. Looking forward to more great vim-stuff.
Derek Wyatt:
September 30th, 2010 at 12:50 pm
Well, it was never really dead… just very, very sleepy. I was lacking inspiration and time; recently I’ve received a small bit of both.
Expect the blog to have “periodic” wakefulness. :)
juan:
April 16th, 2011 at 2:22 pm
Thank you so much for the vim“s tutorials