Loading ...
Sorry, an error occurred while loading the content.

RE: Register usage

Expand Messages
  • Halim, Salman
    ... This says that IF there is a modeless selection (:help modeless-selection), ctrl-y will copy it to the clipboard. For your purposes, the only real way you
    Message 1 of 4 , May 8 11:05 PM
      To get help on a key used on the command-line (in command mode, in other words), prepend a c_ to the help directive; in this case:

      :help c_ctrl-y

      This says that IF there is a modeless selection (:help modeless-selection), ctrl-y will copy it to the clipboard. For your purposes, the only real way you can get a modeless selection is to enter the command-line (by hitting :) and then click and drag (with the mouse) to select some text in the text window. Now, hitting ctrl-y will copy this text. Obviously, typing "a before the ctrl-y will not have the desired effect because it will type the "a onto the command-line and then execute the ctrl-y (and copy it into the regular clipboard). There is no direct way to get this selection into the register of choice; however, I didn't even know about this selection until you asked this question, so it's possible that this isn't the sort of thing you have to worry about often.

      If you MUST copy it into a specific register, then what you can do is to clobber the command-line and execute another command to copy the clipboard into the register of choice; change the right side of the menu from <c-y> to:

      <c-y><c-u>:let @a=@*<cr>

      I have never delved into menus, so I'm not sure if this will work as is.

      For the append version, just use @A instead of @a.

      Hope this helps,


      > -----Original Message-----
      > From: KenCheri Randall [mailto:kencheri@...]
      > Sent: Sunday, May 09, 2004 12:26 AM
      > To: VIM VIM
      > Subject: Register usage
      > Hello Benji
      > Thanks for your reply. Looking at what I wrote I was not clear. I am
      > new to Vim so I copy code from here and there don't understand all
      > that going on in that code. Anyway, the windows clipboard can hold
      > only 1 clip at a time. I wanted to build a "clipboard" that would
      > hold several entries and then paste that combination where needed. I
      > needed to "start" series of entries and then "add" to them. I used
      > register a to hold the selections. I used menu.vim as a starting
      > point. I copied the PopUp.Cut, PopUp.Copy and PopUp.Paste entries
      > replacing each with 2 entries one for "a and the other for "A. I also
      > assumed that the PopUp entries covered the necessary modes. My logic
      > was fine for each entry but the "cnoremenu - Copy" entry. This entry
      > has "<C-Y>" as the target action, I didn't/don't know what to do about
      > that. So that is my question, what does <C-Y> do and how do I split
      > that into and initial copy (a") and the next copy into the "A reg?
      > I've been using my changes and cannot tell if I have a problem. When
      > I do a :map of <C-Y> Vim shows " <C-Y> * <C-R>".
      > Here is the original menu.vim code and my changes to it in my code.
      > VIM vnoremenu 1.20 PopUp.Cu&t "+x
      > me vnoremenu 1.24 PopUp.1st\ Cut\ to\ A "ax
      > me vnoremenu 1.25 PopUp.Next\ Cut\ to\ A "Ax
      > VIM vnoremenu 1.30 PopUp.&Copy "+y
      > me vnoremenu 1.35 PopUp.1st\ Copy\ to\ A "ay
      > me vnoremenu 1.35 PopUp.Next\ Copy\ to\ A "Ay
      > VIM cnoremenu 1.30 PopUp.&Copy <C-Y>
      > me cnoremenu 1.35 PopUp.1st\ Copy\ to\ A <C-Y>
      > me cnoremenu 1.35 PopUp.Next\ Copy\ to\ A <C-Y>
      > VIM nnoremenu 1.40 PopUp.&Paste "+gP
      > me nnoremenu 1.41 PopUp.Paste\ from\ A "AgP
      > VIM cnoremenu 1.40 PopUp.&Paste <C-R>+
      > me cnoremenu 1.41 PopUp.Paste\ from\ A <C-R>A
      > VIM vnoremenu <script> 1.40 PopUp.&Paste <SID>vPaste
      > me vnoremenu <script> 1.41 PopUp.Paste\ from\ A <SID>vPasteReg
      > VIM inoremenu <script> 1.40 PopUp.&Paste <SID>iPaste
      > me inoremenu <script> 1.41 PopUp.Paste\ from\ A <SID>iPasteReg
      > I had read the on-line help files several times looking for answers to
      > my questions. It takes me several times before I figure what the
      > manual says. This manual is complete, but, VIM is very complex, so
      > we must read very carefully. I thank you and others for your help in
      > this ML; I learn from other's questions and your answers to them.
      > Looking at code is a real help.
      > Thank you for your time,
      > Ken Randall
      > email: kencheri at austin dot rr dot com
    Your message has been successfully submitted and would be delivered to recipients shortly.