From: Iain Patterson Date: Wed, 29 Jul 2009 13:51:39 +0000 (+0100) Subject: Clipboard plugin. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=884267902e73908af24a211c7ae9205702d09a6e;p=profile.git Clipboard plugin. Not much use on Red Hat but works on Windows. --- diff --git a/.vim/plugin/clipbrd.vim b/.vim/plugin/clipbrd.vim new file mode 100644 index 0000000..3c3580a --- /dev/null +++ b/.vim/plugin/clipbrd.vim @@ -0,0 +1,211 @@ +" clipbrd.vim -- Clipboard and other register content editor. +" Author: Hari Krishna (hari_vim at yahoo dot com) +" Last Change: 01-Jun-2006 @ 17:57 +" Created: 26-May-2004 +" Requires: Vim-7.0, genutils.vim(2.0) +" Version: 2.0.1 +" Licence: This program is free software; you can redistribute it and/or +" modify it under the terms of the GNU General Public License. +" See http://www.gnu.org/copyleft/gpl.txt +" Download From: +" http://www.vim.org/script.php?script_id=1014 +" Usage: +" - Execute the default map (\cb or cb) or :ClipBrd command to view +" the default register ("*", the clipboard register). You can also specify +" the register name as an argument to the :ClipBrd command. +" - The register name is remembered (until you change it again by explicitly +" specifying it) so that you don't have to specify it everytime you run +" :ClipBrd command. +" - The "[Clip Board]" buffer is like a regular Vim file buffer, as you can +" write (:w, :w!, :wq, :wq!), reload (:e, :e!) and quit (:q, :q!) the +" buffer using the built-in Vim commands. Writing without the bang will +" make the plugin prompt you for confirmation and where available, you can +" click "Cancel" to prevent the buffer from quitting. +" - To refresh contents from the register, use :e or :e! command, or just +" close and reopen the buffer. To quit without saving, just use the :q! +" command. +" - while in the [Clip Board] buffer shows the register name. +" - Even other buffer commands and settings work as expected, e.g., you can +" :hide the buffer if you can't decide to save or quit, and the contents +" should remain the same when you come back, unless a different register +" is explicitly specified while opening the clipboard. Setting 'bufhidden' +" to "hide" or 'hidden' also should do the same. +" Installation: +" - Place the file in your plugin directory. +" - Also install the latest genutils.vim. +" - If you don't like the default map (\cb), change it by placing the +" following in your vimrc (change appropriately): +" nmap ClipBrdOpen +" - If you want to change the default register from "*" to something else, +" put the following in your vimrc: +" let g:clipbrdDefaultReg = '+' +" The default register is significant only the first time you invoke the +" ClipBrd without specifying any register. +" - You can optionally create a program shortcut with the following as the +" command: +" +" gvim +ClipBrd +only +" +" This allows you to use the shortcut to quickly view and edit the +" system clipboard. I find it extremely useful. Place the shortcut in a +" quick reach (like the windows taskbar) and you will have a powerful +" clipboard editor handy all the time. +" TODO: + +if exists('loaded_clipbrd') + finish +endif +if v:version < 700 + "echomsg 'clipbrd: You need at least Vim 7.0' + finish +endif + +if !exists('loaded_genutils') + runtime plugin/genutils.vim +endif +if !exists('loaded_genutils') || loaded_genutils < 200 + echomsg 'clipbrd: You need a newer version of genutils.vim plugin' + finish +endif +let loaded_clipbrd=1 + +if !exists('s:myBufNum') +let s:myBufNum = -1 +let s:myDir = '' +if exists('g:clipbrdDefaultReg') + let s:curReg = g:clipbrdDefaultReg +else + let s:curReg = '*' +endif +let s:title = '[Clip Board]' +endif + +command! -nargs=? ClipBrd :call ViewRegister() + +if (! exists("no_plugin_maps") || ! no_plugin_maps) && + \ (! exists("no_clipbrd_maps") || ! no_clipbrd_maps) + nnoremap