0

Copy/paste has never worked properly in all cases in GNU/Linux, for decades, and this problem is still not fixed.

I find myself with two xfce4-terminal instances, terminal A and terminal B.

Terminal A is at a bash command prompt. Terminal B is in a vim instance, editing some arbitrary file.

I attempt to copy/paste text from B into A, by highlighting the text in B with the mouse cursor. The text becomes successfully highlighted. I use the middle button in terminal A.

Expected results:

The text from terminal B should be copied into terminal A.

Actual results:

The previous entry in the clip buffer gets dumped in terminal A instead.

My "fix":

Get out of vim and use less or similar command line tools, copy the text without being in vim. Then it works as expected.

Question:

Is there a better fix?

  • Have you tried Right Click->Copy and Right Click->Paste? or Copy & Paste from the terminal's Edit menu? or highlight to select in the source terminal and then Edit Menu->Paste Selection. All of those work for me in xfce4-terminal. standard middle-button paste works for me most of the time (but that depends on what the source program does - some apps like to use the clipboard for selections instead of just the select buffer). – cas Oct 5 '19 at 10:42
  • btw, it might help if you set mouse= and ttymouse= (i.e. null arguments) in your .vimrc. IMO vim's mouse handling sucks so I disable it. That may be why copy-paste works for me....it's been so long since i've allowed vim mouse handling that I can't remember how it behaved. – cas Oct 5 '19 at 10:44
  • See vi.stackexchange.com/q/84 Make sure your version of Vim has +clipboard support. I recommend Neovim. – Devon Oct 5 '19 at 15:57
-1

You can use the terminal in vim mode. If you type in the terminal console, set -o vi The terminal keyboard layout now switches to vim mode.

another way: copy / cut mouse clipboard paste in the terminal

CTRL+SHIFT+V

  • This doesn’t answer how to copy from Vim. – Devon Oct 5 '19 at 16:02
  • because we don't copy mouse on the vim, if you standard mode on the vim, you chanced mode v, Visiual mode and we keypress J belove line select or K above line select than yy command than for paste pp command – Erdal Oct 5 '19 at 16:29
  • 1
    vi users usually don't use a mouse – Erdal Oct 5 '19 at 16:37

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.