xsel copies to clipboard twice

35 views
Skip to first unread message

Tim Johnson

unread,
Aug 8, 2017, 2:27:13 PM8/8/17
to vim ML
I'm using vim 7.4 (terminal mode) on ubuntu 14.04, launched from
Midnight Commander. Glipper is my clipboard manager.

I have the following script line loaded :

map ;cc :w !xsel -i -b<CR>

When I select some text in visual mode and then press ;cc
the selected text is copied _twice_ to the clipboard

It's been a long time since I've done any vim scripting, so I'd
welcome some advice on how to correct my code to avoid the
redundancy.

See http://vim.wikia.com/wiki/Accessing_the_system_clipboard

TIA
--
Tim
http://www.akwebsoft.com, http://www.tj49.com

Grant Taylor

unread,
Aug 8, 2017, 5:02:42 PM8/8/17
to vim_use
On Tuesday, 8 August 2017 12:27:13 UTC-6, Tim Johnson wrote:
> When I select some text in visual mode and then press ;cc
> the selected text is copied _twice_ to the clipboard

What happens if you use the following sequence?

"+y

That should copy the selected (hilighted) text into the X11 clipboard.

"*y

That should copy the selected (hilighted) text into the X11 primary selection buffer.

(Where "copy" is subject to the typical X11 issues with the source program still being available.)



--
Grant. . . .
unix || die

Tim Johnson

unread,
Aug 8, 2017, 6:59:28 PM8/8/17
to vim_use
* Grant Taylor <drsc...@gmail.com> [170808 13:04]:
Yes, "*y copies to the clipboard - in a version of vim, where the clipboard features
are enabled. And only copies once.

I've done a little more testing with different vim binaries on my
system:

The /usr/bin/vim.gnome binary, which is what I am using as my
default MC editor does not have the redundant copy issue when
running xsel as an external app.

The /usr/bin/vim binary is where the redundant copy occurs.

I'd conclude that some other feature in /usr/bin/vim is causing
this.

Both /usr/bin/vim and /usr/bin/vim.gnome have both clipboard and
xterm_clipboard enabled.

Happily, if I were to use /usr/bin/vim.basic, which does *not* have
clipboard features enabled, then the xsel call works without
redundancy.

Not a big deal, just curious ....
thanks for the reply

Christian Brabandt

unread,
Aug 9, 2017, 1:45:58 AM8/9/17
to vim_use

On Di, 08 Aug 2017, Tim Johnson wrote:

> The /usr/bin/vim.gnome binary, which is what I am using as my
> default MC editor does not have the redundant copy issue when
> running xsel as an external app.
>
> The /usr/bin/vim binary is where the redundant copy occurs.
>
> I'd conclude that some other feature in /usr/bin/vim is causing
> this.
>
> Both /usr/bin/vim and /usr/bin/vim.gnome have both clipboard and
> xterm_clipboard enabled.

Please show the vim --version output for both versions where it happens
and where it doesn't.

Best,
Christian
--
Es ist ein großer Unterscheid, ob ich lese zu Genuss und
Belebung oder zu Erkenntnis und Belehrung.
-- Goethe, Maximen und Reflektionen, Nr. 791

Tim Johnson

unread,
Aug 9, 2017, 11:24:18 AM8/9/17
to vim_use
* Christian Brabandt <cbl...@256bit.org> [170808 21:50]:
>
> On Di, 08 Aug 2017, Tim Johnson wrote:
>
> > The /usr/bin/vim.gnome binary, which is what I am using as my
> > default MC editor does not have the redundant copy issue when
> > running xsel as an external app.
> >
> > The /usr/bin/vim binary is where the redundant copy occurs.
> >
> > I'd conclude that some other feature in /usr/bin/vim is causing
> > this.
> >
> > Both /usr/bin/vim and /usr/bin/vim.gnome have both clipboard and
> > xterm_clipboard enabled.
>
> Please show the vim --version output for both versions where it happens
> and where it doesn't.
I'm attaching versions.txt - headers should be explanatory
versions.txt

Tim Johnson

unread,
Aug 9, 2017, 11:25:49 AM8/9/17
to vim_use
* Christian Brabandt <cbl...@256bit.org> [170808 21:50]:
>
> On Di, 08 Aug 2017, Tim Johnson wrote:
>
> > The /usr/bin/vim.gnome binary, which is what I am using as my
> > default MC editor does not have the redundant copy issue when
> > running xsel as an external app.
> >
> > The /usr/bin/vim binary is where the redundant copy occurs.
> >
> > I'd conclude that some other feature in /usr/bin/vim is causing
> > this.
> >
> > Both /usr/bin/vim and /usr/bin/vim.gnome have both clipboard and
> > xterm_clipboard enabled.
>
> Please show the vim --version output for both versions where it happens
> and where it doesn't.
Sorry disregard the last attachment, I hadn't saved it! Must have
coffee....
This attachment should be complete
versions.txt

Christian Brabandt

unread,
Aug 9, 2017, 2:31:41 PM8/9/17
to vim_use

On Mi, 09 Aug 2017, Tim Johnson wrote:

> Redundant clipboard copy here - versions follow :
> -------------------------------------------------
> +acl +cmdline_info +emacs_tags -hangul_input +menu +mouse_xterm -python3 +syntax +virtualedit +xsmp_interact
> +arabic +comments +eval +iconv +mksession +multi_byte +quickfix +tag_binary +visual +xterm_clipboard
> +autocmd +conceal +ex_extra +insert_expand +modify_fname +multi_lang +reltime +tag_old_static +visualextra -xterm_save
> +balloon_eval +cryptv +extra_search +jumplist +mouse -mzscheme +rightleft -tag_any_white +viminfo +xpm
> +browse +cscope +farsi +keymap +mouseshape +netbeans_intg +ruby +tcl +vreplace
> ++builtin_terms +cursorbind +file_in_path +langmap +mouse_dec +path_extra +scrollbind +terminfo +wildignore
> +byte_offset +cursorshape +find_in_path +libcall +mouse_gpm +perl +signs +termresponse +wildmenu
> +cindent +dialog_con_gui +float +linebreak -mouse_jsbterm +persistent_undo +smartindent +textobjects +windows
> +clientserver +diff +folding +lispindent +mouse_netterm +postscript -sniff +title +writebackup
> +clipboard +digraphs -footer +listcmds +mouse_sgr +printer +startuptime +toolbar +X11
> +cmdline_compl +dnd +fork() +localmap -mouse_sysmouse +profile +statusline +user_commands -xfontset
> +cmdline_hist -ebcdic +gettext +lua +mouse_urxvt +python -sun_workshop +vertsplit +xim
>
> Clipboard single copy here - versions follow :
> -------------------------------------------------
> +acl +cmdline_info +emacs_tags -hangul_input +menu +mouse_xterm -python3 +syntax +virtualedit +xsmp_interact
> +arabic +comments +eval +iconv +mksession +multi_byte +quickfix +tag_binary +visual +xterm_clipboard
> +autocmd +conceal +ex_extra +insert_expand +modify_fname +multi_lang +reltime +tag_old_static +visualextra -xterm_save
> +balloon_eval +cryptv +extra_search +jumplist +mouse -mzscheme +rightleft -tag_any_white +viminfo +xpm
> +browse +cscope +farsi +keymap +mouseshape +netbeans_intg +ruby +tcl +vreplace
> ++builtin_terms +cursorbind +file_in_path +langmap +mouse_dec +path_extra +scrollbind +terminfo +wildignore
> +byte_offset +cursorshape +find_in_path +libcall +mouse_gpm +perl +signs +termresponse +wildmenu
> +cindent +dialog_con_gui +float +linebreak -mouse_jsbterm +persistent_undo +smartindent +textobjects +windows
> +clientserver +diff +folding +lispindent +mouse_netterm +postscript -sniff +title +writebackup
> +clipboard +digraphs -footer +listcmds +mouse_sgr +printer +startuptime +toolbar +X11
> +cmdline_compl +dnd +fork() +localmap -mouse_sysmouse +profile +statusline +user_commands -xfontset
> +cmdline_hist -ebcdic +gettext +lua +mouse_urxvt +python -sun_workshop +vertsplit +xim

Looks pretty similar. However you did not include the patch level.


Best,
Christian
--
Lieber zuviel essen als zuviel trinken.

Tim Johnson

unread,
Aug 10, 2017, 1:56:29 PM8/10/17
to vim_use
* Christian Brabandt <cbl...@256bit.org> [170809 10:34]:
>
> On Mi, 09 Aug 2017, Tim Johnson wrote:
<...>
Redundant clipboard copy here - patches follow :
------------------------------------------------
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by pkg-vim-m...@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):

Clipboard single copy here - patches follow :
---------------------------------------------
M - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by pkg-vim-m...@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):

>
> Looks pretty similar. However you did not include the patch level.
I could include ldd output for both also

Christian Brabandt

unread,
Aug 10, 2017, 2:08:48 PM8/10/17
to vim_use

On Do, 10 Aug 2017, Tim Johnson wrote:

> * Christian Brabandt <cbl...@256bit.org> [170809 10:34]:
> >
> > On Mi, 09 Aug 2017, Tim Johnson wrote:
> <...>
> Redundant clipboard copy here - patches follow :
> ------------------------------------------------
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> Included patches: 1-52
> Extra patches: 8.0.0056
> Modified by pkg-vim-m...@lists.alioth.debian.org
> Compiled by buildd@
> Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
>
> Clipboard single copy here - patches follow :
> ---------------------------------------------
> M - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> Included patches: 1-52
> Extra patches: 8.0.0056
> Modified by pkg-vim-m...@lists.alioth.debian.org
> Compiled by buildd@
> Huge version with GTK2-GNOME GUI. Features included (+) or not (-):

Are you sure? That looks like the same version for both your Vims?

> > Looks pretty similar. However you did not include the patch level.
> I could include ldd output for both also

Well, check yourself for differences. There must be a difference
somewhere.

Best,
Christian
--
Der eine hat eine falsche Rechtschreibung und der andere eine rechte
Falschschreibung.
-- Georg Christoph Lichtenberg

Tim Johnson

unread,
Aug 10, 2017, 2:21:58 PM8/10/17
to vim...@googlegroups.com
* Christian Brabandt <cbl...@256bit.org> [170810 10:10]:
>
> On Do, 10 Aug 2017, Tim Johnson wrote:
>
> > * Christian Brabandt <cbl...@256bit.org> [170809 10:34]:
> > >
> > > On Mi, 09 Aug 2017, Tim Johnson wrote:
> > <...>
> > Redundant clipboard copy here - patches follow :
> > ------------------------------------------------
> > VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> > Included patches: 1-52
> > Extra patches: 8.0.0056
> > Modified by pkg-vim-m...@lists.alioth.debian.org
> > Compiled by buildd@
> > Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
> >
> > Clipboard single copy here - patches follow :
> > ---------------------------------------------
> > M - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> > Included patches: 1-52
> > Extra patches: 8.0.0056
> > Modified by pkg-vim-m...@lists.alioth.debian.org
> > Compiled by buildd@
> > Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
>
> Are you sure? That looks like the same version for both your Vims?
> Well, check yourself for differences. There must be a difference
> somewhere.

Ugh, they are now. Something on my system (perhaps me) has fiddled
with symlinks.

The bottom line is (I think) that when *clipboard features are
compiled the redundancy occurs. I am now using by preference a
"lighter" version without *clipboard (and other) features. This
gives me quicker launch time from mc and xsel functions as a JIT
resource.

I appreciate the interest. I'm going to call this solved. Thanks for
the help.
Reply all
Reply to author
Forward
0 new messages