20

I'm curious as to why the default Debian package for vim (the one you normally get by sudo apt-get install vim) isn't compiled with clipboard support?

Neither the regular -clipboard or -Xterm-clipboard is enabled, why?

There might be reason to not include -Xterm-clipboard on Debian installations without X-server installed, but the regular -clipboard?

Any insight into why this is would be helpfull.

(Clarification: I know I can compile Vim with these flags, I just want to know why they aren't enabled by default.)

  • What provides the clipboard if not X? xterm-clipboard is a different thing; that is for the buffers that xterm provides (see, for example, askubuntu.com/a/541730/158442). – muru Sep 14 '17 at 11:23
  • but xterm-clipboard is also a feature provided by the X server – Christian Brabandt Sep 14 '17 at 11:36
  • 2
    @muru there exists no such thing as an xterm-like buffer. What you mean are X cut buffers, which is a feature of the X Server providing some means of inter-process communication between X clients, one usually being called Clipboard (Ctrl-V, CTRL-X, Ctrl-V in the usual desktop clients) and the other being middle mouse pasting of whatever was selected with the mouse previously. Although this is called xterm_clipboard it has nothing to do with xterm. – Christian Brabandt Sep 14 '17 at 13:24
  • 2
    @ChristianBrabandt huh, I always thought this cut buffer was something from xterm, like screen's paste buffer, and this feature supported such buffers. Thanks for correcting! – muru Sep 14 '17 at 13:27
  • 1
    The smartass in me would tell you to install Neovim since it dispenses with pretty much all the compile flags in favour of just trying things at runtime. For example, the clipboard uses xsel/xclip instead of linking against a bunch of X libraries. – Yet Another User Sep 28 '17 at 5:01
24

The package description contains

This package contains a version of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less).

I believe this was made, because using the clipboard would involve linking against X libraries, which means, you couldn't install vim without also installing a bunch of X dependencies which you usually do not want in a server (or minimal) environment.

This means, if you want the clipboard feature, you should install e.g. the package vim-gtk (which despite its name also contains a non-gui vim).

For a similar reason, the package vim-nox exists. It does not depend on the X server, but needs additional libraries like liblua, libperl, libpython and does therefore install those additional dependencies (which you also probably do not need in a server environment), but no X libraries (like GTK or X11 ones needed for the gui and the clipboard).

  • Ahh I thought you could copy-paste on a non GUI install of Linux. That's why I thought the flag -clipboard was for Vim to acess the system copy-paste register. (You can using X-Copy but I meant by deafult) – Gustav Blomqvist Sep 14 '17 at 19:58
  • 1
    @GustavBlomqvist: You can, by using the regular command line clipboards, ie, select text, middle click to paste, and using GPM bindings. – Arafangion Sep 15 '17 at 5:16
2

VIM is intended to be a portable editor that "just works" on all systems. By having the default version use the clipboard functionality, it will need to link against X11 libraries, and a separate version of VIM would need to be compiled for desktop versus server (no pre-installed X11/xorg) builds. This is why the vim and vim-gtk packages are provided.

If you want to compile the command-line version of VIM (I use it with Guake/yakuake all the time), here's the build/install script for Debian-based systems.

# Get the compile-dependencies of vim
sudo apt-get -y build-dep vim
# Install the "checkinstall" tool so the "make install" step is
# wrapped and the result is a .deb file that can be removed later by
# your package manager rather than having to hunt down every file deployed
# by "make install", which might not be possible if it overwrites existing
# system files.
sudo apt-get -y install checkinstall
# Install python dev
sudo apt-get -y install python-dev
# Install xorg dev
sudo apt-get -y install xorg-dev
# Install git
sudo apt-get -y install git
# Get the source
git clone https://github.com/vim/vim.git vim_source
# Remove ./configure cache in case we have to run this twice due to permissions
# related issues.
rm vim_source/src/auto/config.cache
# Compile it
cd vim_source
make clean
./configure \
    --enable-perlinterp=dynamic \
    --enable-pythoninterp=dynamic \
    --enable-rubyinterp=dynamic \
    --enable-cscope \
    --enable-gui=auto \
    --enable-gtk2-check \
    --enable-gnome-check \
    --with-features=normal \
    --with-x \
    --with-compiledby="DevNull <darkstar@/dev/null>" \
    --with-python-config-dir=/usr/lib/python2.7/config-$(uname -m)-linux-gnu
# Build quickly (8 parallel jobs, hope your system doesn't get overwhelmed)
make -j8
# Need root to install
sudo checkinstall

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.