what is the problem?

https://vi.stackexchange.com/questions/13564/why-is-vim-for-debian-compiled-without-clipboard

for whatever reasons a lot of vim packages come compiled without system -clipboard support.

furthermore: for copy & paste per default vim uses it’s own registers (not the default primary and secondary system clipboard that most Desktop (!) GNU Linux systems have (on headless-servers (no GUI no Desktop there is no such clipboard).

Also the “select text in visual mode” [esc] then v then i then p and then “+y   only works with vims that come with +clipboard support compiled in.

so what to do? install gvim!

https://vim.fandom.com/wiki/Accessing_the_system_clipboard

https://askubuntu.com/questions/613170/vim-and-system-clipboard

# check if vim was compiled with +clipboard support
hostnamectl; # tested on system
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-13-amd64
Architecture: x86-64

vim --version | grep clipboard
-clipboard +jumplist +persistent_undo +vartabs
+eval +mouse_gpm +syntax -xterm_clipboard

workaround: install gvim

hostnamectl; # tested on
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-13-amd64
      Architecture: x86-64

su - root;
apt update;
apt install gvim;
gvim --version|grep clip
+clipboard         +jumplist          +persistent_undo   +vartabs
+eval              +mouse_gpm         +syntax            +xterm_clipboard

and the system clipboard should be accessible like this:

gvim how to access system clipboard

vim vs gvim what is the difference?

(package vim-gnome was removed from Debian 10 for security reasons)

vim clipboard or not, try this option:


hostnamectl; # tested with
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-13-amd64
      Architecture: x86-64

# even if it does not come with +clipboard compiled
vim --version|grep 'IMproved\|clip'
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 15 2019 16:41:15)
-clipboard         +jumplist          +persistent_undo   +vartabs
+eval              +mouse_gpm         +syntax            -xterm_clipboard

# try this: (re-login) and test

# specify to automatically use the system clipboard for copy and paste (src)
# as non-root user run:
echo "set clipboard=unnamedplus" >> ~/.vimrc

this should work:

  1. select the text with the mouse
  2. Ctrl+Shift+C to copy from vim 8.1 into system clipboard
  3. switch over to other application
  4. Ctrl+V or middle mouse button to insert

if that does not work

the user might have installed an older version of vim.

vim is an excellent very powerful editor that can handle documents of 100.000 lines and more. hint: vim does not have PER DEFAULT access to system clipboard (for whatever reason not enabled per default) two options:

    • install gvim
    • recompile vim

about clipboard registers: there are many more than just one (basically as many as user’s keyboard has chars 🙂 the system clipboard in vim is represented by + (plus) register this is “the one” register that is also used by other gui applications like pluma (very nice text editor as well)

alternative: install gvim

hostnamectl|tail -n 3; # tested on +MATE Desktop
  Operating System: Debian GNU/Linux 9 (stretch)
            Kernel: Linux 4.9.0-13-amd64
      Architecture: x86-64

su - root;
apt update;
apt install gvim;
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package gvim is a virtual package provided by:
  vim-gtk3 2:8.0.0197-4+deb9u3
  vim-gtk 2:8.0.0197-4+deb9u3
  vim-athena 2:8.0.0197-4+deb9u3
You should explicitly select one to install.

apt install vim-gtk3;

in gvim this works as well as expected:

  1. open file
  2. mouse highlight text
  3. go to menu and select “copy”

nice 🙂

colorize: to get the nice black background go:

[ESC]
:syntax on
:colorscheme torte
[ENTER]
# or (save settings permanent)
# white text on black background
echo "colorscheme torte" >> ~/.vimrc
echo "syntax on" >> ~/.vimrc

# green text on black background
echo "colorscheme elflord" >> ~/.vimrc
echo "syntax on" >> ~/.vimrc
# and restart vim or gvim

excellent video: here is A SUPBER VIDEO explaining copy and pasting outside of vim 🙂 THANKS! WELL DONE!

vim performance compared to other editors:

the onemillionlines.txt text editor benchmark:

let’s generate some very large text files

# generate a file with 1 million lines of text
# and messure the time it takes for the computer to generate those lines
time for i in $(seq 1 1000000); do echo "generating line number $i"; echo "$i another line to test if the editor can handle it" >> onemillionlines.txt; done

took lenovo t440 laptop with i5 and ssd:

generating line number 999996
generating line number 999997
generating line number 999998
generating line number 999999
generating line number 1000000

real	0m27.398s
user	0m19.728s
sys	0m7.492s

half a minute to generate this file

then for some reason it generates 1 million and 1 line

wc -l onemillionlines.txt; # count line numbers in file
1000001 temp.txt

du -hs onemillionlines.txt; # file size
54M	temp.txt; # 54MBytes

not exactly 1 million

now try to open that file with one’s favorite text editor and see if it “folds” (if it gives up and crashes)

or if not: how long it takes to digest that massive file

in vim it takes 3 seconds to open that file

vim v8: one million lines? yes even without breaking a sweat

pluma: folds after around 500.000 lines “blackout”

all recordings made with very excellent https://www.maartenbaert.be/simplescreenrecorder/

LibreOffice Writer 5.2 (Java)?

no way.

loading is slow.

editing the file is unusable slow X-D

what is it?

apt show vim-gtk3

Package: vim-gtk3
Version: 2:8.0.0197-4+deb9u3
Priority: extra
Section: editors
Source: vim
Maintainer: Debian Vim Maintainers <pkg-vim-maintainers ÄT lists PUNKT alioth PUNKT debian PUNKT org>
Installed-Size: 3,047 kB
Provides: editor, gvim, vim, vim-lua, vim-perl, vim-python, vim-ruby, vim-tcl
Depends: vim-common (= 2:8.0.0197-4+deb9u3), vim-gui-common (= 2:8.0.0197-4+deb9u3), vim-runtime (= 2:8.0.0197-4+deb9u3), libacl1 (>= 2.2.51-8), libc6 (>= 2.15), libcairo2 (>= 1.4.10), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.37.3), libgpm2 (>= 1.20.4), libgtk-3-0 (>= 3.21.5), libice6 (>= 1:1.0.0), liblua5.2-0, libpango-1.0-0 (>= 1.37.5), libpangocairo-1.0-0 (>= 1.14.0), libperl5.24 (>= 5.24.0), libpython3.5 (>= 3.5.0~b1), libruby2.3 (>= 2.3.0~preview2), libselinux1 (>= 1.32), libsm6, libtcl8.6 (>= 8.6.0), libtinfo5 (>= 6), libx11-6, libxt6
Suggests: cscope, fonts-dejavu, gnome-icon-theme, vim-doc
Homepage: http://www.vim.org/
Tag: uitoolkit::gtk
Download-Size: 1,264 kB
APT-Manual-Installed: yes
APT-Sources: https://ftp.halifax.rwth-aachen.de/debian stretch/main amd64 Packages
Description:

Vi IMproved - enhanced vi editor - with GTK3 GUI

 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added:
- multi level undo
- syntax  highlighting
- command line history
- on-line help
- filename completion
- block operations
- folding
- Unicode support, etc.

 This package contains a version of vim compiled with a GTK3 GUI
 and support for scripting with Lua, Perl, Python, Ruby, and Tcl.

What are the differences between the vim versions?

“Including the vim package, there appear to be at least six “vim-variants” (not including available documentation, or plugin packages) as well as the main vim package in both the main and universe repositories.

Below is a brief summary of each (links go to package description and dependencies in Ubuntu LTS release 16.04 “Xenial”):

  • vimVim compiled and set up with a rather standard set of features. This package does not provide a GUI version of Vim or scripting language support. See the other vim-* packages if you need more (or less).In order to install this package, run sudo apt-get install vim
  • jvim-cannaJapanized VIM (Canna version)This package allows the entering of Kanji from the console.In order to install this package, run sudo apt-get install jvim-cannaDepends upon the libcanna1g libraryDoes not appear to support Perl, Python, Ruby, or TCL scripting.
  • vim-athena – enhanced vi editor – compiled with an Athena GUIThis package is compiled with the Athena GUI as opposed to GTK+ or Gnome.See this askubuntu answer for additional details.In order to install this package, run sudo apt-get install vim-athenaSupports Perl, Python, Ruby, and TCL scripting.
  • vim-gnome/vim-gtk3 – enhanced vi editor – compiled with a GNOME GUI (GTK2 before 17.10, GTK3 from 17.10)In order to install this package, run sudo apt-get install vim-gnomeDepends upon the libgnome2 librarySupports Perl, Python, Ruby, and TCL scripting.
  • vim-gtk – enhanced vi editor – compiled with the GTK2 GUIUsed in KDE/Kubuntu-like environmentsIn order to install this package, run sudo apt-get install vim-gtkSupports Perl, Python, Ruby, and TCL scripting.
  • vim-nox – enhanced vi editorLike vim-tiny, vim-nox is a minimal vim installation and does not have a GUI. It comes with mouse support, but no clipboard support, IIRC.In order to install this package, run sudo apt-get install vim-noxSupports Perl, Python, Ruby, and TCL scripting.
  • vim-tiny – enhanced vi editor – compact versionvim-tiny is included as the default vim on Ubuntu distributions and comes with many optional features disabled(e.g. multi-level undo).See this askubuntu answer for details on its feature set(or lack thereof).In order to install this package, run sudo apt-get install vim-tinyDoes not support Perl, Python, Ruby, or TCL scripting.As close to being vi without being vi.

Locally, to see which features are supported in a particular installed vim package, running the following command: vim --version will provide a list of features included(or excluded) in the particular package.”

src: https://askubuntu.com/a/281972

thanks all involved

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin