Thanks,
Ven
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
Well, this doesn't answer the question I asked earlier about using
visual mode to copy and paste.
But if you use xclip to copy,
and ctrl+shift+v to paste, then setting
mouse=a, you can get all the functionality you want. It does take some
getting used to probably, since you can't use the middle mouse button
to paste.
If you can find a way to copy that's not as messy as putting this
in your .vimrc, please let me know:
vmap <C-c> :<Esc>`>a<CR><Esc>mx`<i<CR><Esc>my'xk$v'y!xclip -selection c<CR>u
xclip is a utility that allows you to use the clipboard on Linux
machines that use X11:
http://sourceforge.net/projects/xclip/
Copy and paste is such a basic functionality, and I'm really surprised
that vim doesn't have a nice platform-independent way of handling
this. Actually even a platform-dependent way of copying and pasting
would work - it would just be nice if this were better documented
somewhere.
>>
>> If you can find a way to copy that's not as messy as putting this
>> in your .vimrc, please let me know:
>> vmap <C-c> :<Esc>`>a<CR><Esc>mx`<i<CR><Esc>my'xk$v'y!xclip -selection
>> c<CR>u
>>
That was something I figured out the painful way. What I basically do
is take the text to copy, put it on its own line, mark the beginning
of it, mark the end of it, and send it to xclip, which sends it to the
clipboard. But now, since the command executed, it wiped out the text
you wanted to copy, so I put a u at the end to undo it. If there's a
hall of fame for vim hacks, this should definitely go on it!
>
>
> with this unreadable mix of letters and characters, I am now able to use
> functionalities 1 and 2 of my have-to list (with having the shift key to
Wait, so then you must have xclip on your machine, if you got it to work, right?
> press in addition). I still cannot paste text, which I have marked with the
> mouse, to vim or a different editor.
>
> Maybe there is still a way to configure vim in the right way? Are no vim
> specialists on this list?
I'm working on the paste part myself, but I'm having difficulties getting my
ctrl+shift+v to work (it works on Linux, but not in Cygwin). I played
around a bit with the inputrc and now when I want to paste, it puts me
into visual mode - great.
Pardon my sarcasm, but yes, it bothers me a bit when we need to ask
a "vim specialist" on how to get copy and paste working. It should
definitely not be this complicated. I wonder, how do all the vim users
on this list use copy and paste?
Thanks,
Ven
>
>
> Thanks
> Alex
>
>
>> Thanks,
>> Ven
>>
xclip lets you access the X11 clipboard on the command-line. In other
words, you can pipe text to and from the X11 selection buffer.
--
Erik Falor
Registered Linux User #445632 http://counter.li.org
> definitely not be this complicated. I wonder, how do all the
> vim users on this list use copy and paste?
speaking for myself only, i got used to using ctrl-insert and
shift-insert way back in my windows days because they worked
in more places than ctrl-c and ctrl-v
i have several lines relating to them in my .vimrc:
nmap <S-Insert> "+gP
vmap <S-Insert> "-d"+P
imap <S-Insert> <C-O>:set paste<CR><C-R>+\|<C-O>:set nopaste<CR>
cmap <S-Insert> <C-R>+
imap <C-Insert> <C-O>"+y
vmap <C-Insert> "+y
vmap <S-Del> "+d
imap <C-Del> <C-O>daw
and lately, if i want to quit an app i am copying from before
i paste i make sure and start klipper beforehand
sc
Unfortunately I haven't come across a system yet where the + buffers
were enabled. That's why I had to jump through all these hoops with
/dev/clipboard with Cygwin, and xclip on the Linux machines that used
X11.
So here's the latest attempt at pasting:
For Cygwin:
nmap <C-v> iz<Esc>mz:execute "normal a".system("cat /dev/clipboard")[:-2]<CR>`zx
For Linux:
nmap <C-v> iz<Esc>mz:execute "normal a".system("xclip -o")[:-2]<CR>`zx
or map it to the Middle Mouse:
map <MiddleMouse> iz<Esc>mz:execute "normal a".system("xclip -o")[:-2]<CR>`zx
Apparently when I execute a command, it puts it on the next line, but
this "normal a".system, passing it a system command pasted it right
where I want. Well, almost, because if I pasted it at the beginning
of the line, it pasted *after* the first character, which was
annoying. So I did another hack using marks to paste.
Ctrl+insert is a good idea if you don't want to overwrite the ctrl+v,
which is used to print out an escape character. That's why I was made
the key mappings for normal mode only, not visual or command mode.
Thanks,
Ven