LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Can't copy-paste from one terminal to another using vim (https://www.linuxquestions.org/questions/slackware-14/cant-copy-paste-from-one-terminal-to-another-using-vim-776616/)

cola 12-18-2009 02:56 AM

Can't copy-paste from one terminal to another using vim
 
I opened two text files with vim(different two konsole window).
Selecting some texts from one vim window yanked(y) then tried pasting(p) to other vim window.It doesn't work.
Code:

E353:Nothing in register "
"*y or "+y don't work.

What's the way to paste texts from one vim window to another?

Slakcware 13+kde

Kenichi Kato 12-18-2009 03:15 AM

1 Attachment(s)
Hi,

1. On the source terminal, I use my mouse to select the block & right-click and select copy.
2. Then on the destination terminal, I right-click and select paste.

cola 12-18-2009 03:21 AM

No option if i do right click.

forrestt 12-18-2009 03:27 AM

All you need to do is highlight the text with you mouse that you want to copy. It is automatically copied. Then in the window you want to paste into, go into insert mode, and then click your middle mouse button while pointing into that window.

HTH

Forrest

p.s. Just to add, "yy" yanks and "p" pastes.

cola 12-18-2009 03:29 AM

Quote:

Originally Posted by forrestt (Post 3796432)
All you need to do is highlight the text with you mouse that you want to copy. It is automatically copied. Then in the window you want to paste into, go into insert mode, and then click your middle mouse button while pointing into that window.

HTH

Forrest

It works if it's the same vim window.
But if they are different two vim windows then it doesn't work.

forrestt 12-18-2009 03:49 AM

It works with any window be it vim or any other app. You do need to go into insert mode first (by pressing 'i' in the target window). Try again. This is how X windows has worked for as long as I've used it (since late 1980's). Highlighting any text automatically copies it to the X window buffer. Clicking the middle mouse button pastes it to the window under the mouse pointer.

HTH

Forrest

veeall 12-18-2009 04:07 AM

Here's another thread about it. Basically it is controlled by an option in '/usr/share/vim/vimrc' or '~/.vimrc' or can be switched during runtime in vi with: ':set mouse=a' and ':set mouse=r'

I uninstalled elvis to which vi symlink points by default in slackware, and using vim middleclick pasteing works as expected after having set 'set mouse=r' in configuration file.

cola 12-18-2009 04:19 AM

Thanks veeall.
:set mouse=r and it works fine.

cola 12-18-2009 05:14 AM

This is solved.

lumak 12-18-2009 10:39 PM

The mouse options screws with the way you do somethings. But! if you remember to use shift + highlight or shift + click then it will work. I believe gpm needs to be enabled.

this is because vim is compiled without x clipboard support on slackware. Obviously this does not affect gvim

tuxdev 12-18-2009 10:48 PM

For this and other nifty features relating to X, I symlink vim to gvim

Old_Fogie 12-18-2009 10:51 PM

You know I have this same issue for slackware --current, but not using 'vim' (as I don't use vi/vim/gvim - my brain don't work that way) ; I have this issue with nano using xterm.

Example:
step 1: have an xterm open
step 2: then highlight text (it should now be in clipboard/klipper)
step 3: nano somefile.txt
step 4: press mousewheel down, or use shift-insert to paste the text and what get's pasted is stuff that I had used 'control + c' key on earlier.

It's driving me batty!


All times are GMT -5. The time now is 02:30 PM.