VectorLinux
September 16, 2014, 11:11:42 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Vim: problems copying text from vi to another application  (Read 1695 times)
ted1959
Member
*
Posts: 9


« on: December 25, 2007, 10:20:46 am »

I have just installed VL 5.9 Gold. So far it's looking pretty good. But I have found a problem when I'm editing a text file in a terminal with vi. When I select some text the text doesn't get copied to the clipboard - after selecting the text if I then click on the edit menu the "Paste" option is greyed out. If I open another application where I can paste in some text there's nothing in the clipboard to paste in.

Any idea why this is happening?
Logged
kidd
Packager
Vectorian
****
Posts: 682


« Reply #1 on: December 25, 2007, 11:19:44 am »

Vim's clipboard system behaves in a weird way if you don't fully understand it.

I'll try to write a small introduction to it:

1.) Clipboards in X windows:

X running in linux environments has 2 registers where you can copy/paste text.
   - ctrl-c/ctrl-v
   - Mouse selection / middle-click (or shift-insert)

2) Vim and registers:
   You can refer to a given register prepending a double quote (") and the register ID to the yank command
   Vim has lots of registers where you can leave and retrieve text.  Most common ones are the numbered registers, ", +, * and '/'.
   When you copy anything with 'y', this text gets pushed into '"' register, and the "0. "0 goes to "1, "1 goes to "2.....
   If you specify a register, the text will be placed in the specifyed reg, and the "0 reg. "0 goes to "1, "1 goes to "2.....
   
   "+ refers to the ctr-c/ctrl-v clipboard, and "* refers to the mouse selection/shift-ins one.

   copying a line to the "+ register is done with "+yy
   pasting a the "+ register is done with "+p

   If you don't wanna mess with all that (It's powerful, but a bit complicated), you can set an option to your ~/.vimrc

   :set clipboard=unnamed

   This way, "* register will be used when you don't specify any register.  This way, vim shares the clipboard with other applications and other vim instances (without special tricks).


aditional help in :h clipboard, and :h 'clipboard'     inside vim.

HTH

Logged

ted1959
Member
*
Posts: 9


« Reply #2 on: December 25, 2007, 09:09:56 pm »

Thanks for the info on pasting in vim.

I am trying to do all my copy/pasting using mouse selections and middle mouse button clicks for pasting the text into other applications.
I also have an installation of Ubuntu in which I can do this. I have been studying the various vim setup files but still haven't figured out how to configure it.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!