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

RE: put (paste) from windows clipboard into vim

Expand Messages
  • Max Dyckhoff
    Prefixing the yank and put commands with registers works, but I personally prefer the following, which just sets the default register to be the system
    Message 1 of 7 , Jun 1, 2006
      Prefixing the yank and put commands with registers works, but I personally prefer the following, which just sets the default register to be the system clipboard. From :help clipboard,

      When the "unnamed" string is included in the 'clipboard' option, the
      Unnamed register is the same as the "* register. Thus you can yank to
      and paste the selection without prepending "* to commands.

      So just put "set clipboard=unnamed" in your vimrc file, use y and p as normal, and watch them yank to and put from the system clipboard! Woo!

      Max




      > -----Original Message-----
      > From: A.J.Mechelynck [mailto:antoine.mechelynck@...]
      > Sent: Wednesday, May 31, 2006 7:44 PM
      > To: evan@...
      > Cc: vim@...
      > Subject: Re: put (paste) from windows clipboard into vim
      >
      > Evan H. Carmi wrote:
      > > hey all,
      > >
      > > i am wondering how to copy through windows and than paste into vim with
      > > a keyboard command.
      > >
      > > for example: i am running FF and i copy some text, when i go into vim I
      > > don't know how to put (paste) that text without right clicking and
      > > selecting paste. the
      > >
      > > :p
      > >
      > > command doesn't work and seems to be put what is in the vim clipboard (i
      > > don't think clipboard is the correct term for the place where vim has
      > > yanked data. what is it?)
      > >
      > > peace, Evan
      > >
      > >
      > >
      > In Vim, the system clipboard is known as "register plus". On non-Unix
      > versions, "register star" is synonymous with it. So, just prefix your P
      > (put) command with "+ (double-quote plus) or, on non-Unix systems, by "*
      > (double-quote star) and voilĂ ! The clipboard contents get patsed.
      > Conversely, "+y or "+d do a yank (copy) or delete (cut) to the clipboard:
      >
      > "+p paste before cursor
      > "+P paste after cursor
      > "+y copy (visual area, or takes a postfix telling Vim
      > "what" to copy)
      > "+d cut (visual area, or with a postfix)
      >
      > :echo @+ show the contents of the system clipboard _without_
      > pasting
      >
      > etc.
      >
      > And BTW, it's p (put after cursor) or P (put before cursor), _without_ a
      > colon prefix; or you can youse the :pu[t] command, which takes the
      > register-name after the command, and accepts a line number:
      >
      > :put +
      >
      > pastes the clipboard after the current line, and
      >
      > :0put +
      >
      > pastes it at the top of the file (or use ":$put +", without the quotes,
      > to paste at the bottom).
      >
      > And the correct name (in Vim lingo) for where Vim stores data between a
      > yank and a put if you don't explicitly specify a register name, is --
      > the unnamed register.
      >
      > See ":help change.txt", and, in particular, ":help registers".
      >
      >
      > HTH,
      > Tony.
    • Tim Chase
      ... This is nice when you want it, but I find it frequently annoying when I do anything that happens to delete in the process...like ciw to change the current
      Message 2 of 7 , Jun 1, 2006
        > So just put "set clipboard=unnamed" in your vimrc file, use y
        > and p as normal, and watch them yank to and put from the
        > system clipboard! Woo!


        This is nice when you want it, but I find it frequently annoying
        when I do anything that happens to delete in the process...like

        ciw

        to change the current word under the cursor. It tromps over my
        system clipboard, replacing it with the word I've removed. I
        tend to like to keep things of importance in my system clipboard,
        and I'm all to prone to making edits in Vim that would tromp on
        my clipboard.

        At least Vim offers the option, unlike most other editors. :)

        So use it if you like, but be forewarned :)

        -tim
      • Max Dyckhoff
        That seems like a fair warning, although I will say that I have never run into such a problem. I don t tend to keep things in the clipboard for very long at
        Message 3 of 7 , Jun 1, 2006
          That seems like a fair warning, although I will say that I have never
          run into such a problem. I don't tend to keep things in the clipboard
          for very long at all, normally just to move from one place to another.
          If I do want them to be around for a while then I generally want them to
          be around for A Long Time, and so I put them in a named buffer so that
          nothing can stomp on them.

          Choose whatever is better for your workflow, is the solution!

          Max

          > -----Original Message-----
          > From: Tim Chase [mailto:vim@...]
          > Sent: Thursday, June 01, 2006 8:47 AM
          > To: Max Dyckhoff
          > Cc: evan@...; vim@...
          > Subject: Re: put (paste) from windows clipboard into vim
          >
          > > So just put "set clipboard=unnamed" in your vimrc file, use y
          > > and p as normal, and watch them yank to and put from the
          > > system clipboard! Woo!
          >
          >
          > This is nice when you want it, but I find it frequently annoying
          > when I do anything that happens to delete in the process...like
          >
          > ciw
          >
          > to change the current word under the cursor. It tromps over my
          > system clipboard, replacing it with the word I've removed. I
          > tend to like to keep things of importance in my system clipboard,
          > and I'm all to prone to making edits in Vim that would tromp on
          > my clipboard.
          >
          > At least Vim offers the option, unlike most other editors. :)
          >
          > So use it if you like, but be forewarned :)
          >
          > -tim
          >
          >
        • Georg Dahn
          Hi! There is another possibility: Shift-Ins = paste Ctrl-Ins = copy Shift-Del = cut These shortcuts work even without sourcing mswin.vim (BTW, I don t
          Message 4 of 7 , Jun 1, 2006
            Hi!

            There is another possibility:

            Shift-Ins = paste
            Ctrl-Ins = copy
            Shift-Del = cut

            These shortcuts work even without sourcing mswin.vim (BTW, I don't
            recommend sourcing mswin.vim) and have the advantage that they work in
            all Windows applications.

            Best wishes,
            Georg



            Evan H. Carmi wrote:
            > hey all,
            >
            > i am wondering how to copy through windows and than paste into vim with
            > a keyboard command.
            >
            > for example: i am running FF and i copy some text, when i go into vim I
            > don't know how to put (paste) that text without right clicking and
            > selecting paste. the
            >
            > :p
            >
            > command doesn't work and seems to be put what is in the vim clipboard (i
            > don't think clipboard is the correct term for the place where vim has
            > yanked data. what is it?)
            >
            > peace, Evan
            >


            ___________________________________________________________
            Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
          • A.J.Mechelynck
            ... [...] I knew about that but I somehow forgot to mention it (though maybe I should have), because most of my puts and yanks are internal to Vim and I don t
            Message 5 of 7 , Jun 1, 2006
              Max Dyckhoff wrote:
              > Prefixing the yank and put commands with registers works, but I personally prefer the following, which just sets the default register to be the system clipboard. From :help clipboard,
              >
              > When the "unnamed" string is included in the 'clipboard' option, the
              > Unnamed register is the same as the "* register. Thus you can yank to
              > and paste the selection without prepending "* to commands.
              >
              > So just put "set clipboard=unnamed" in your vimrc file, use y and p as normal, and watch them yank to and put from the system clipboard! Woo!
              >
              > Max
              >
              >
              [...]

              I knew about that but I somehow forgot to mention it (though maybe I
              should have), because most of my puts and yanks are internal to Vim and
              I don't like clobbering the system clipboard in that case. "De gustibus
              et coloribus non est disputandum."


              Best regards,
              Tony.
            Your message has been successfully submitted and would be delivered to recipients shortly.