How can I use just one unified clipboard? (even for IntelliJ's "copy path")

6,441

Solution 1

There are several clipboard managers such as parcellite, klipper, glipper, glippy, anamnesis, pastie and others. These generally allow you to manage your clipboard by presenting a history.

Some of them allow you to treat the primary and secondary clipboards as one (parcellite and klipper definitely do).

Anamnesis allows you to plow through your history with a search tool.

Solution 2

autocutsel is a lightweight tool that merges the contents of both clipboards. You might also consider using a full-blown clipboard manager, like Shawn suggested.

Solution 3

Presumably, you are trying to paste into the Terminal using middle-click.

Generally speaking, if you Copy with the application menu, context menu (which usually just triggers the application menu), or ^c (which also usually triggers the app menu), the results are stored to the "Clipboard" selection and can be Pasted with ^v or a corresponding menu.

If you Copy by highlighting text with the mouse, the results are stored to the "Primary" selection and can be Pasted by middle-clicking the target window.

If you select text in your application with the mouse, then use ^c to Copy it manually, you will stored the results in the "Primary" selection with the mouse, and the "Clipboard" selection with the ^c, so they will both match and you don't get confused.

But, if you select text in your app with the keyboard, then hit ^c, and subsequently select some other text (like a target selection to overwrite) the result will not be stored in the "Primary" selection and you will not get the copied text. You will not be able to middle-click to Paste the copied text, but you can use the Terminal application menu or context menu to Paste from the "Clipboard" selection.

Some applications will also fill the "Primary" selection when you Copy to the "Clipboard". This is non-standard behavior and should be avoided and not relied upon.

Share:
6,441

Related videos on Youtube

ripper234
Author by

ripper234

See blog or LinkedIn Profile

Updated on September 18, 2022

Comments

  • ripper234
    ripper234 over 1 year

    I don't really understand the linux clipboard/s scheme. Instead of understanding it, is there a way to simplify it into one, unified clipboard? You know, so I could copy in any app and paste in any other?

    The current issue that's bugging me is IntelliJ's "copy path" action seems to copy the path of the current file, but I can only paste it back into IntelliJ itself - if I try to paste it into a terminal, the content simply isn't in the clipboard.

    • tshepang
      tshepang almost 13 years
      Never used that IDE, but I don't have any issues with the Linux clipboard. Are there other sch situations?
    • ripper234
      ripper234 almost 13 years
      @Tshepang - one example is in gvim, if I select a text, do edit-->copy, then select another piece of text, then I effectively have two different pieces of text to paste. Middle click will paste the last text I selected, while edit->paste will paste the text I edit->copied.
    • alex
      alex almost 13 years
      There is concept of clipboard in the X Window system. Given that most of the time you work in X, this is only a matter of configuring/patching programs not using X clipboard to use it. For example, X-window enabled GNU Emacs don't copy to X clipboard by default, but can be easily configured to do so.
    • Adam Byrtek
      Adam Byrtek almost 13 years
      @alex Not exactly true, there are multiple concepts of clipboard in the X Window System.
    • Lie Ryan
      Lie Ryan almost 13 years
      @ripper234: That's because Vim by default copies to its internal buffer. If you want to copy to the system clipboard, use the + special buffer, to copy "+y and to paste "+p in the Command Mode. The * buffer is the middle click buffer, and there are many regular buffers which can only be used by Vim which can be accessed by prefixing the copy/paste with "a to "b (e.g. "aY)
    • unode
      unode almost 13 years
      @Lie what ripper234 said is correct. In gvim the menu action copy is the same as "+y. However the fact that vim has its own internal "clipboard" only puts more emphasis on the fact there are multiple clipboards, even if some are software specific, hence the confusion.
  • jeroen
    jeroen over 11 years
    I just installed Parcellite following your suggestion and it works wonderingly well. It's simply and get's the job done. Thx for the suggestion!
  • Ehtesh Choudhury
    Ehtesh Choudhury about 11 years
    Anamnesis fits the job well. Very small codebase and easy to read, to boot.
  • yrajabi
    yrajabi almost 11 years
    Those of us with heavy use of ssh and vim with its visual mode, will need to look at this question to fill the gap: Clipboard over SSH session through VIM (Hint: no xserver needed on the server side)