VIM with no clipboard support

Hello everyone,

I’m working only with VIM and I would like to have clipboard support included which I can get to work.

My machine is set upped with GNOME - 3.20.2,
and below are all the packages I have installed for VIM:


dev:~ # rpm -qa | grep vim
vim-data-7.4.326-12.1.noarch
vim-7.4.326-12.1.x86_64

So what else I need to get clipboard support for VIM on openSUSE ?


dev:~ # vim --version | grep clipboard
-clipboard       +iconv           +path_extra      -toolbar
+eval            +mouse_dec       +startuptime     -xterm_clipboard

I’m not sure what you are expecting.

It is working fine for me. But, as far as I know, it is “xterm” or “konsole” that is handling the clipboard, and “vim” is running only as a command line application. There is also a “gvim” that you can install, if you want a GUI interface version of “vim”.

In vim you can use the visual mode to select what you need to copy than you can paste in either insert or normal mode. This is working within vim. If you need vim to handle the global clipboard, well that is a different story. Would recommend checking out xclip or just use the mouse to copy from vim (might need to disable the mouse tho first) and rely on the terminal emulator to paste in vim (ctrl+shift+v in most cases).
For a start take a look at this: http://vim.wikia.com/wiki/Copy,_cut_and_paste

There may be a solution I’m not aware of,
I’ve only found that VIM has its own internal clipboard (which among other things supports “visual mode”) but does not support the general “Shared clipboard” which would enable copy/pasting from and to other applications.

So,
I keep that in mind whether to use VIM in the first place or whether I should launch some other text editor.

TSU

I am often copying/pasting between vim and other applications. The terminal emulator handles the “Shared clipboard”.

Sure.
But AFAIK vim does have some X11 clipboard support built in as well.
It’s disabled in (open)SUSE though:

* Wed Jul 09 2014 kukuk@suse.de

- Don't link non-gui version against X11, we don't need it [bnc#886237]


(I don’t have permissions to view the mentioned bug report though)

And the Factory/Tumbleweed package has this additional entry:

* Sat Mar 11 2017 - kukuk@suse.de
 
- Build default vim without X11 support, use update-alternatives
   to prefer gvim if installed for X11 support.

Interesting to know about the update-alternatives to re-direct to gvim,
But I doubt that anyone talking about vim ordinarily thinks of gvim… People use vim for its use in a text console.

Lack of support for the shared clipboard has existed for as long as I’ve ever used vim in openSUSE
(@nrickert, not sure what you’re looking at, I’ve never been able to do what you’re describing. As long as the text is not within vim, I’ve also been able to use the enhanced console features of openSUSE, but not within vim)
If I catch myself within vim and need to import text, I normally save the file, then open the file in some other text editor to paste, then if I still want to use vim then re-open in vim.

TSU

For example, yesterday I added a comment to a bug report. I keep a list of bug reports that I have commented on. So I copied the bug number and description in bugzilla, then pasted them into the file with “vi” (really “vim”) running in an “xterm”.

Sometimes I have to use the “klipper” (in the tray) to make that available for pasting with xterm.

OK,
I was able to do what you described…
Instead of using vim commands to copy/paste(as described, they work only within vim), use the console menu “Edit” commands.
So, this is possible only in a windowed console enhanced by openSUSE(typically every console except for xterm).

Learned something new today… :slight_smile:

TSU

Right, and that’s probably the reason why X11 support for the normal vim is disabled in (open)SUSE.
Otherwise it would pull in the X11 libraries also on a text mode installation e.g., I think… :wink: