changeset 0:c293edf9fbac default tip

Initial revision
author Guido Berhoerster <guido+vim@berhoerster.name>
date Sat, 14 Mar 2015 10:57:21 +0100
parents
children
files README doc/tags doc/xsel.txt plugin/xsel.vim
diffstat 4 files changed, 181 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Sat Mar 14 10:57:21 2015 +0100
@@ -0,0 +1,53 @@
+Vim xsel Script
+===============
+
+The xsel script for Vim integrates vim with the [xsel utility][1] in order to
+copy text from and to X CLIPBOARD selection.
+
+[1]: http://www.vergenet.net/~conrad/software/xsel/ "xsel"
+
+Usage
+-----
+
+See the included documentation in Vim help format.
+
+Contact
+-------
+
+Please send any feedback, translations or bug reports via email to
+<guido+weechat@berhoerster.name>.
+
+Bug Reports
+-----------
+
+When sending bug reports, please always mention the exact version of the script
+with which the issue occurs as well as the version of vim and the operating
+system you are using and make sure that you provide sufficient information to
+reproduce the issue and include any input, output, and any error messages.
+
+License
+-------
+
+Except otherwise noted, all files are Copyright (C) 2009 Guido Berhoerster and
+distributed under the following license terms:
+
+Copyright (C) 2009 Guido Berhoerster <guido+vim@berhoerster.name>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/tags	Sat Mar 14 10:57:21 2015 +0100
@@ -0,0 +1,10 @@
+:GetClipboard	xsel.txt	/*:GetClipboard*
+:SetClipboard	xsel.txt	/*:SetClipboard*
+<Leader>gc	xsel.txt	/*<Leader>gc*
+<Leader>sc	xsel.txt	/*<Leader>sc*
+<Plug>XselGetClipboard	xsel.txt	/*<Plug>XselGetClipboard*
+<Plug>XselSetClipboard	xsel.txt	/*<Plug>XselSetClipboard*
+xsel	xsel.txt	/*xsel*
+xsel-commands	xsel.txt	/*xsel-commands*
+xsel-mappings	xsel.txt	/*xsel-mappings*
+xsel.txt	xsel.txt	/*xsel.txt*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/xsel.txt	Sat Mar 14 10:57:21 2015 +0100
@@ -0,0 +1,39 @@
+*xsel.txt*			xsel script	       Last change: 2009-02-19
+
+xsel integration for Vim				*xsel*
+
+1. Mappings		|xsel-mappings|
+2. Commands		|xsel-commands|
+
+The xsel script for Vim integrates vim with the xsel utility in order to copy
+text from and to X CLIPBOARD selection. It requires xsel to be installed (see
+http://www.vergenet.net/~conrad/software/xsel/).
+
+==============================================================================
+1. Mappings						*xsel-mappings*
+
+					*<Leader>sc* *<Plug>XselSetClipboard*
+<Leader>sc
+<Plug>XselSetClipboard
+				Set the X CLIPBOARD to the content of the
+				unnamed register.
+
+					*<Leader>gc* *<Plug>XselGetClipboard*
+<Leader>gc
+<Plug>XselGetClipboard
+				Get the content of the X CLIPBOARD selection
+				and store it in the unnamed register.
+
+==============================================================================
+2. Commands						*xsel-commands*
+
+							*:SetClipboard*
+:SetClipboard {reg}		Set the X CLIPBOARD to the content of the
+				register {reg}.
+
+							*:GetClipboard*
+:GetClipboard {reg}		Get the content of the X CLIPBOARD and store
+				it in the register {reg}.
+
+==============================================================================
+  vim:tw=78:ts=8:ft=help:norl:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugin/xsel.vim	Sat Mar 14 10:57:21 2015 +0100
@@ -0,0 +1,79 @@
+" Vim xsel integration plugin
+" Maintainer:       Guido Berhoerster <guido+vim@berhoerster.name>
+" Latest Revision:  2009-02-14
+" License:
+"   Copyright (c) 2009 <guido+vim@berhoerster.name>
+"
+"   Permission is hereby granted, free of charge, to any person obtaining
+"   a copy of this software and associated documentation files (the
+"   "Software"), to deal in the Software without restriction, including
+"   without limitation the rights to use, copy, modify, merge, publish,
+"   distribute, sublicense, and/or sell copies of the Software, and to
+"   permit persons to whom the Software is furnished to do so, subject to
+"   the following conditions:
+"
+"   The above copyright notice and this permission notice shall be included
+"   in all copies or substantial portions of the Software.
+"
+"   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+"   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+"   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+"   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+"   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+"   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+"   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" Requirements: xsel (see http://www.vergenet.net/~conrad/software/xsel/)
+
+if exists("g:loaded_xsel")
+  finish
+endif
+let g:loaded_xsel = 1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+try
+    if !hasmapto('<Plug>XselGetClipboard')
+        map <unique> <Leader>gc <Plug>XselGetClipboard
+    endif
+    noremap <unique> <script> <silent> <Plug>XselGetClipboard :call <SID>GetClipboard('"')<CR>
+
+    if !hasmapto('<Plug>XselSetClipboard')
+        map <unique> <Leader>sc <Plug>XselSetClipboard
+    endif
+    noremap <unique> <script> <silent> <Plug>XselSetClipboard :call <SID>SetClipboard('"')<CR>
+
+    if !exists(":GetClipboard")
+        command -nargs=0 -register GetClipboard :call s:GetClipboard('<reg>')
+    endif
+
+    if !exists(":SetClipboard")
+        command -nargs=0 -register SetClipboard :call s:SetClipboard('<reg>')
+    endif
+
+    function! s:GetClipboard(reg)
+        let s:reg = a:reg
+        if empty(s:reg)
+            let s:reg='"'
+        endif
+        call setreg(s:reg, system("xsel -o -b"))
+        if v:shell_error != 0
+            redraw!
+            echohl ErrorMsg | echo "***error*** (GetClipboard) error executing xsel" | echohl None
+        endif
+    endfunction
+
+    function! s:SetClipboard(reg)
+        let s:reg = a:reg
+        if empty(s:reg)
+            let s:reg='"'
+        endif
+        call system("xsel -i -b", getreg(s:reg))
+        if v:shell_error != 0
+            redraw!
+            echohl ErrorMsg | echo "***error*** (SetClipboard) error executing xsel" | echohl None
+        endif
+    endfunction
+finally
+    let &cpo = s:save_cpo
+endtry