1
votes

I start by mentioning that I have already read several suggestions about this, including How to make vim paste from (and copy to) system's clipboard?, https://superuser.com/questions/187537/copy-to-system-clipboard-instead-of-vim-buffer, https://askubuntu.com/questions/172265/how-to-use-a-common-clipboard-for-vim-and-unity and http://vim.wikia.com/wiki/Accessing_the_system_clipboard, but I have been unable to find a solution.

So, my problem is that copying to gvim works through the X11 clipboard but I can't get copy from gvim to work, no matter what. I have verified that my version has x11 clipboard support compiled in. Currently I have added the following to .vimrc:

set clipboard=unnamedplus,autoselect
set guioptions+=a
set paste
set go+=a

Simple yanking doesn't work, neither does "+y or "*y. I have verified with xclip that there's nothing in the clipboard. I have tried several other parameter variations as well, including

I'm using Ubuntu 12.04 and gvim --version says

$ VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May  4 2012 04:22:36)
Included patches: 1-429
Modified by [email protected]
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff 
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi 
+file_in_path +find_in_path +float +folding -footer +fork() +gettext 
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall 
+linebreak +lispindent +listcmds +localmap +lua +menu +mksession +modify_fname 
+mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm 
-mouse_sysmouse +mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme 
+netbeans_intg +path_extra +perl +persistent_undo +postscript +printer +profile
+python -python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs 
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
+toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim 
+xsmp_interact +xterm_clipboard -xterm_save 

So could this be something else? Any ideas? This is driving me craze, nevermind make me feel stupid because I have to open the files in gedit if I need to copy something to e.g. an email.

1

1 Answers

1
votes

set guioptions+=a and set go+=a are one and the same: keep the first one and delete the other.

set paste is an abomination that messes with too many other options to be set by default in your ~/.vimrc. Read :help 'paste', delete that line and read :help 'pastetoggle'.

"+y and "*y end up in different clipboards. What command do you use for yanking and how do you paste in other programs? Ctrl+v? Middle-click?