I've been using ubuntu for over a decade and I have no idea how the clipboard works.
There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want.
I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it.
Can someone finally explain it to me? Or tell me what to do to make it sane.
(it of course did occur to me to google the question over the past 10 years but every time I did, I didn't find a satisfactory answer for something that ought to be a basic computer literacy skill)
Clipboards in x11 are based on selections. There are two selections of note, the primary selection and clipboard selection. In GUI applications, selecting text copies it to the primary selection, middle clicking pastes the primary selection. Ctrl-C copies to the clipboard selection, Ctrl-V pastes the clipboard selection. The happy path is to stick to those operations only.
For terminals, ctrl-c/Ctrl-v have conflicting interpretations so are usually bound to ctrl-shift-c/ctrl-shift-v. Some (e.g. iterm) try to emulate copy on select on operating systems that don't support it by copying the selection to the single clipboard.
For vim, the selections are bound to buffers. * Is the primary/selection buffer, + is the clipboard. Use "+y/"+p for ctrl-c/ctrl-v equivalents, or "*y/"*p for copy-on-select/middle click equivalents. Note that some distros ship a default "vim-minimal"/"vim-tiny" package built without this support so they can use it as "vi" for POSIX compatibility without pulling in x11 libraries. In that case look for a "vim-x11", "vim-full" or "gvim" package. Or use neovim, I haven't seen packagers slice that up the same way. Depending on your terminal, you may be also able to use the GUI equivalents in insert mode anyway (don't try use your terminal paste in normal mode, it'll paste into the command buffer).
Shift-Insert is unfortunately application dependent. I think it _should_ be equivalent to middle click, but some apps treat it as ctrl-v.
Some clipboard managers or applications will overwrite the primary contents with the clipboard contents when you perform an explicit copy.
I think you'll unfortunately be left unsatisfied since there is no "simple" answer due to the way clipboards work in x11 and the historical baggage a lot of terminal apps drag with them (everyone did text-copying differently before ctrl-c and ctrl-v became ubiquitous).
A nice thing you can do in Vim though is to make the default clipboard the system clipboard like this in your .vimrc:
On another note, rebinding ctrl-c, ctrl-v, ctrl-s etc. in the terminal (including Vim) can be confusing, since most ctrl commands will be caught by stty (in most terminal emulators) and never passed on to the running application. If you really wanted to, you could rebind Vim's yank/paste to ctrl-c, ctrl-v by unbinding the stty commands.
# 1. check the bindings for your system
stty -a
# 2. put the stuff you want to unbind in your shell rc file
stty <command name> undef
And then rebinding yank/paste in your .vimrc to only use your system clipboard.
This would, however, become painful as soon as you need to quickly use a machine remotely where all your local configs won't be present. It also generally raises the question why one is using Vim in the first place, if one is not planning to use its powerful features.
vim has its own used by default when you dd, p, etc. You can copy to one of the previous things (assuming your build enabled it) with "+y and "*y key sequences. You can also paste the same way, but I usually just let the term emu handle that with ctrl-shift-v or similar.
shift-insert is kinda weird actually. AFAIK it should paste from selection, but it often surprises me, so I avoid it.
I select and copy from Firefox and ctrl-shift insert pastes it into a terminal 95% of the time.
Rightclick paste always pastes it into a terminal.
Selecting in the terminal window and right click copying is the only way to reverse it which is pretty attrocious as I have to zoom way out and other shenanigans.
If any emacs-fu greybeards know of how to emacs Yank to the Gnome clipboard I will be eternally grateful.
Same, which is why I made my own bash aliases which basically streams files and text into temporary files in my home directory. I can then paste them as plaintext or move them as files. Should make a function to keep a list of the 10 latest files and query those then.
There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want.
I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it.
Can someone finally explain it to me? Or tell me what to do to make it sane.
(it of course did occur to me to google the question over the past 10 years but every time I did, I didn't find a satisfactory answer for something that ought to be a basic computer literacy skill)