I am new to vim_dev group. I have read several posts regarding a similar issue before I make this post (http://vim.wikia.com/wiki/Accessing_the_system_clipboard and such). And the more I read, the more I got confused. That's why I am sending this email.
I am using vim, not Gvim, in terminal window. I had had vim 7.2 which I installed using ubuntu software center. It didn't have xterm_clipboard feature. So, I decided to get the source files of Vim 7.3 and compile it by myself. Obviously I have been missing something because no matter what I did, I couldn't get xterm_clipboard feature enabled for vim 7.3. I can compile, install Vim 7.3 without any glitch, so missing any dependencies is not an issue here, I believe.
I didn't make any change in Makefile. Here is the portion of feature.h file, which is making reference to the +xterm_clipboard setting:
______________________feature.h____________________________
/*
* +clipboard Clipboard support. Always used for the GUI.
* +xterm_clipboard Unix only: Include code for handling the clipboard
* in an xterm like in the GUI.
*/
#ifdef FEAT_GUI
# ifndef FEAT_CLIPBOARD
# define FEAT_CLIPBOARD
# ifndef FEAT_VISUAL
# define FEAT_VISUAL
# endif
# endif
#endif
#if defined(FEAT_NORMAL) && defined(FEAT_VISUAL) \
&& (defined(UNIX) || defined(VMS)) \
&& defined(WANT_X11) && defined(HAVE_X11)
# define FEAT_XCLIPBOARD
# ifndef FEAT_CLIPBOARD
# define FEAT_CLIPBOARD
# endif
#endif
______________________feature.h____________________________
These settings tell me that xterm_clipboard will be available, if other stuff are defined, like UNIX and X11. And I think those should be already defined as I am using Ubuntu Desktop.I also have tried making big and huge builds but none of them helped with the clipboard usage. Here is what I get when I do vim --version:
XXXX@XXXXlaptop:~/Downloads/vim/vim73/src$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 28 2012 17:29:17)
Compiled byXXXX@XXXXlaptop
Normal version without 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 +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 -multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+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
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses
Any help will be highly appreciated to point out what I might be missing to tackle this copy&paste usage under linux.
Thanks
Your Vim is compiled with -X11 i.e. no X11 support. This implies no
clipboard support on Linux, since on Linux the clipboard is a function
of the X11 server.
See http://users.skynet.be/antoine.mechelynck/compunix.htm and make sure
to include
export CONF_OPT_GUI='--with-x --disable-gui'
if you want a Vim with xterm clipboard support but without GUI
capabilities. Another possibility is to compile a GUI vim: on Linux such
an executable will run in console mode if invoked as vim or in GUI mode
if invoked as gvim or as vim -g
Also make sure (important) that the necessary "development" packages are
installed on your system. The exact names of those packages vary from
one Linux distribution to the next. I'm using openSUSE and have no idea
how the Ubuntu development packages for X11 are named but maybe someone
else will chime in.
Best regards,
Tony.
--
Don't get suckered in by the comments -- they can be terribly
misleading. Debug only code.
-- Dave Storer
One of my systems runs Ubuntu 10.04 and the vim I built works fine
with X11 and the clipboard. Here is all I think I did besides
obtaining the vim source.
sudo apt-get build-dep vim
./configure
make
sudo make install
If you have already compiled vim, then you might have to execute
make distclean
before
./configure
to make sure that the configure script picks up the new build-dep
files.
Here is the output of "vim --version".
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 5 2012 16:31:33)
Included patches: 1-434
Compiled by gary@phoenix
Normal version with GTK2 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
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lnsl -lselinux -lacl -lattr -lgpm
I have never built a version with X11 and clipboard support but no
other GUI features, so I'd be guessing about the ./configure options
for that. Tony has more experience there. You might take a look at
the output of
./configure --help
to see the possible configure options.
HTH,
Gary
As others have mentioned, you need a Vim build with X11 support (and
therefore gvim, in most circumstances) even if you're only ever going to
use it in a terminal. You can get this without building your own by
installing Ubuntu's vim-gtk package.
If, after doing that, running ":echo has('xterm_clipboard')" in vim
doesn't report 1 then the alternatives system is probably pointing at
the wrong binary. You should see something like this
$ update-alternatives --display vim
vim - auto mode
link currently points to /usr/bin/vim.gtk
/usr/bin/vim.basic - priority 30
/usr/bin/vim.gtk - priority 50
Current 'best' version is '/usr/bin/vim.gtk'.
but it may be in manual mode, with the current 'best' set to a binary
that doesn't provide clipboard access. Running either
"update-alternatives --auto vim" or "update-alternatives --config vim"
would give you the opportunity to fix this. The man page will explain
what these do.
Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jame...@jamessan.com>
Hello James,
I found your post very helpful. I was wondering whether you happen to know whether I can compile vim on Mac with xterm-clipboard support. I posted this question on the macvim forum but nobody responded.
Many thanks.
Li