Click to See Complete Forum and Search --> : paste into vim from X buffer????
hottdogg
06-28-2008, 01:11 PM
HI!
Occasionally I have to paste texts from web browser to text editor.
Actually I want to do this using vim running in xterminal.
But , I don know how, so usually I did this with kedit/gui editor.
My brain is too slow understanding form ¨:help paste¨ in vim.
So how to ¨paste texts into vim running in xterminal ¨ ?
Tnx
bwkaz
06-28-2008, 04:01 PM
Set paste mode, then go into insert mode, then middle-click.
vim itself can't talk to X to get the current paste buffer. But the terminal emulator that vim is running in certainly can (and does). vim sees this as keystrokes, of course, which is why you need to set paste mode (otherwise any autoindent type rules you have set up will interfere).
:set paste
i
<middle-click>
<ESC>
:set nopaste
Edit: Or just use gvim?
hottdogg
07-08-2008, 11:38 AM
wait, i´m still curious with using vim.And gvim isnt in my default slackware though..so..
anyway,wow this pasting middleclick thing is new for me.
I can paste from web browser to xterminal using middle click. yay! :rolleyes:
But it doesn´t work in vim...:(
:set paste
i
<middle click> <--doesn´t work
what´s the problem here??
I´m running xfce in slackware 12.0 using Terminal x terminal emulator.
Oh, and vim 7.1
hottdogg
07-08-2008, 11:50 AM
Oops..apparently I can use shft+ctrl+v instead of middle click for pasting to vim and terminal shell.
But middle click only works in terminal shell.
Strange...
bwkaz
07-08-2008, 07:45 PM
Definitely strange. I wonder if the terminal emulator is intercepting the paste operation for some crazy reason? I just tried it on xterm (though this is an older version), and ctrl+shift+v didn't do anything (except show the vim "I'm going to insert the next character you type verbatim" that you normally get when hitting ctrl+v), while middle-click worked fine. I know it works fine in Eterm as well, but I don't have any other emulators to test.
Do you know what program that "Terminal" thing is starting? ps -ef might shed some light. :)
hottdogg
07-09-2008, 10:46 AM
This simple problem really lead me founding stranger behaviour..
bwkaz,
i dont understand your suggestion ps -ef.
You want me paste ps -ef result from my linux?
The terminal what I was referring to is here (http://www.os-cillation.com/index.php?id=42&L=5). A default for xfce I guess.
Same with konsole...
To make pasting works in vim I have to use shift+insert. I think it´s software dependent.
Now if I use middle click, it´ll paste from yesterday buffer!! :eek:
In summary, pasting
With konsole
desired text:
shift+insert
unexpected :
midclick
With terminal
desired pasted text:
shift+ctrl+v
unexpected :
midclick
With xterm
desired text:
dunno
unexpected text:
midclick
But for all terminal emu above in the shell( not running vim) midclick will paste the desired texts.
I suspect , vim+slackware 12 is to blame here..dunno..vim help is making me discouraged & unenthusiastic ..:rolleyes:
Because after read this thread (http://ubuntuforums.org/showthread.php?t=106262), I checked my vim version :version. And then somewhere along the line is -xterm_clipboard,just like OP from that ubuntuforums.org mentioned.
Rebuilding my own vim then? pfft, I´m not that hardcore linux user. I´ll check with slackware community..
retsaw
07-09-2008, 05:48 PM
This is related to the mouse handling in vim. You probably have "set mouse=a" in your /etc/vimrc change it to "set mouse=r" and the middle click should work normally.