Loading ...
Sorry, an error occurred while loading the content.
Skip to search.
 

Re: Copy/Paste text between Vim running in two rxvts

Expand Messages
  • Yegappan Lakshmanan
    ... The minimum set of operations that should work are: 1. Copying from xterm/rxvt and pasting into a vim running in a rxvt. 2. Copying from vim running in
    Message 1 of 13 , Mar 28, 2001
      Neil Bird wrote:
      >
      > Yegappan Lakshmanan wrote:
      > > When I am using xterm I don't have this problem. When I run rxvt,
      > > I have this problem. I am running rxvt 2.6.2. I am using vnc
      > > to connect to Unix system from my PC. I am using Vim 6.0z.
      > > I am not able copy and paste from Vim running in a xterm or a
      > > rxvt to a Vim running in a rxvt and vice versa. Note that
      > > I am able to copy and paste from rxvt itself to another rxvt
      > > or xterm.
      >
      > *Please* tell us *exactly* the minimum set of operations that /should/
      > work but don't. Also check that you're not, for some bizarre reason,
      > running diff. versions of vim if you use xterm/rxvt [well, you never know
      > ...]. Try "+Y in one and "+p in the other. Does the vim mouse stuff work
      > when in rxvt?
      >

      The minimum set of operations that should work are:

      1. Copying from xterm/rxvt and pasting into a vim running in a rxvt.
      2. Copying from vim running in rxvt and pasting into any other
      application running in rxvt/xterm.

      I am using only one version of Vim (vim 6.0z). Yes, the mouse
      works in rxvt. I can place the cursor at any location by a
      mouse click in Vim. I can also select the text using the mouse
      in Vim.

      Note that, if I set the TERM to xterm instead of rxvt for the
      rxvt terminal, then copy/paste works.

      - Yegappan
    • Mark Waggoner
      ... For what it is worth, in my VNC X session, if I start rxvt, for some reason it comes up with TERM set to xterm. If I then: setenv TERM rxvt When I start
      Message 2 of 13 , Mar 28, 2001
        > > Yegappan Lakshmanan wrote:
        > > > When I am using xterm I don't have this problem. When I run rxvt,
        > > > I have this problem. I am running rxvt 2.6.2. I am using vnc
        > > > to connect to Unix system from my PC. I am using Vim 6.0z.
        > > > I am not able copy and paste from Vim running in a xterm or a
        > > > rxvt to a Vim running in a rxvt and vice versa. Note that
        > > > I am able to copy and paste from rxvt itself to another rxvt
        > > > or xterm.

        > Neil Bird wrote:
        > > *Please* tell us *exactly* the minimum set of operations that /should/
        > > work but don't. Also check that you're not, for some bizarre reason,
        > > running diff. versions of vim if you use xterm/rxvt [well, you never know
        > > ...]. Try "+Y in one and "+p in the other. Does the vim mouse stuff work
        > > when in rxvt?
        > >

        On Wed, 28 Mar 2001, Yegappan Lakshmanan wrote:
        > The minimum set of operations that should work are:
        >
        > 1. Copying from xterm/rxvt and pasting into a vim running in a rxvt.
        > 2. Copying from vim running in rxvt and pasting into any other
        > application running in rxvt/xterm.
        >
        > I am using only one version of Vim (vim 6.0z). Yes, the mouse
        > works in rxvt. I can place the cursor at any location by a
        > mouse click in Vim. I can also select the text using the mouse
        > in Vim.
        >
        > Note that, if I set the TERM to xterm instead of rxvt for the
        > rxvt terminal, then copy/paste works.

        For what it is worth, in my VNC X session, if I start rxvt, for some
        reason it comes up with TERM set to xterm. If I then:

        setenv TERM rxvt

        When I start vim, it also has term=rxvt, and as a result I am unable
        to use the mouse for any vim actions - it just uses the rxvt/xterm
        selection/copy/paste. Perhaps I am missing terminal information for
        rxvt.

        Then, if, in vim, I 'set term=xterm', then all is well and I can
        copy/paste between vims and xterm/rxvt without any problems, in spite
        of the fact that the TERM environment variable is still set to rxvt.

        --------------------------------------------------------------------------
        Mark Waggoner waggoner@... (503) 712-3335
        "Humpf!" humpfed a voice. 'Twas a sour kangaroo.
      • Yegappan Lakshmanan
        Hi Mark, When rxvt comes up, it sets the TERM to xterm, to be compatible with xterm. You have to set TERM to rxvt in either .profile or .cshrc or using -tn
        Message 3 of 13 , Mar 28, 2001
          Hi Mark,

          When rxvt comes up, it sets the TERM to xterm, to be compatible
          with xterm. You have to set TERM to rxvt in either .profile
          or .cshrc or using -tn command line option. This is mentioned
          in the rxvt FAQ.

          To use mouse in Vim in rxvt with TERM set to rxvt, I am setting
          the 'ttymouse' option to xterm in my .vimrc, if term is rxvt

          if &term == "rxvt"
          set ttymouse=xterm
          endif

          I think, the mouse support in Vim works only if the TERM is
          set to xterm or something similar.

          - Yegappan

          >
          > For what it is worth, in my VNC X session, if I start rxvt, for some
          > reason it comes up with TERM set to xterm. If I then:
          >
          > setenv TERM rxvt
          >
          > When I start vim, it also has term=rxvt, and as a result I am unable
          > to use the mouse for any vim actions - it just uses the rxvt/xterm
          > selection/copy/paste. Perhaps I am missing terminal information for
          > rxvt.
          >
          > Then, if, in vim, I 'set term=xterm', then all is well and I can
          > copy/paste between vims and xterm/rxvt without any problems, in spite
          > of the fact that the TERM environment variable is still set to rxvt.
          >
          > --------------------------------------------------------------------------
          > Mark Waggoner waggoner@... (503) 712-3335
          > "Humpf!" humpfed a voice. 'Twas a sour kangaroo.
        • Mark Waggoner
          OK, with the setup below: rxvt window setenv TERM rxvt vim set ttymouse=xterm I see the behavior you describe: using the mouse to do visual select in vim does
          Message 4 of 13 , Mar 28, 2001
            OK, with the setup below:

            rxvt window
            setenv TERM rxvt
            vim
            set ttymouse=xterm

            I see the behavior you describe: using the mouse to do visual select
            in vim does not put the text into the X primary selection - in fact it
            doesn't seem to access the X resources at all. You can see this by
            selecting text in a regular xterm or rxvt window (not running vim) and
            then selecting text in the vim you are running. The text previously
            selected in the term window does NOT get deselected, indicating that
            vim is not taking ownership of the primary selection.

            Neil & Bram could comment on whether vim _should_ take control of the
            X primary selection when:
            term != xterm
            ttymouse == xterm*

            On Wed, 28 Mar 2001, Yegappan Lakshmanan wrote:

            > Date: Wed, 28 Mar 2001 09:49:05 -0800
            > From: Yegappan Lakshmanan <yega@...>
            > To: Mark Waggoner <waggoner@...>
            > Cc: Neil Bird <neil.bird@...>, Vim-Dev Mailing List <vim-dev@...>
            > Subject: Re: Copy/Paste text between Vim running in two rxvts
            >
            > Hi Mark,
            >
            > When rxvt comes up, it sets the TERM to xterm, to be compatible
            > with xterm. You have to set TERM to rxvt in either .profile
            > or .cshrc or using -tn command line option. This is mentioned
            > in the rxvt FAQ.
            >
            > To use mouse in Vim in rxvt with TERM set to rxvt, I am setting
            > the 'ttymouse' option to xterm in my .vimrc, if term is rxvt
            >
            > if &term == "rxvt"
            > set ttymouse=xterm
            > endif
            >
            > I think, the mouse support in Vim works only if the TERM is
            > set to xterm or something similar.
            >
            > - Yegappan
            >
            > >
            > > For what it is worth, in my VNC X session, if I start rxvt, for some
            > > reason it comes up with TERM set to xterm. If I then:
            > >
            > > setenv TERM rxvt
            > >
            > > When I start vim, it also has term=rxvt, and as a result I am unable
            > > to use the mouse for any vim actions - it just uses the rxvt/xterm
            > > selection/copy/paste. Perhaps I am missing terminal information for
            > > rxvt.
            > >
            > > Then, if, in vim, I 'set term=xterm', then all is well and I can
            > > copy/paste between vims and xterm/rxvt without any problems, in spite
            > > of the fact that the TERM environment variable is still set to rxvt.
            > >
            > > --------------------------------------------------------------------------
            > > Mark Waggoner waggoner@... (503) 712-3335
            > > "Humpf!" humpfed a voice. 'Twas a sour kangaroo.
            >

            --------------------------------------------------------------------------
            Mark Waggoner waggoner@... (503) 712-3335
            "Humpf!" humpfed a voice. 'Twas a sour kangaroo.
          • Yegappan Lakshmanan
            Hi Mark, It is good that another person is also able to reproduce this problem. I thought only I am seeing this problem. ... Note that I also have clipboard
            Message 5 of 13 , Mar 28, 2001
              Hi Mark,

              It is good that another person is also able to reproduce this
              problem. I thought only I am seeing this problem.

              Mark Waggoner wrote:
              >
              > OK, with the setup below:
              >
              > rxvt window
              > setenv TERM rxvt
              > vim
              > set ttymouse=xterm
              >
              > I see the behavior you describe: using the mouse to do visual select
              > in vim does not put the text into the X primary selection - in fact it
              > doesn't seem to access the X resources at all. You can see this by
              > selecting text in a regular xterm or rxvt window (not running vim) and
              > then selecting text in the vim you are running. The text previously
              > selected in the term window does NOT get deselected, indicating that
              > vim is not taking ownership of the primary selection.
              >
              > Neil & Bram could comment on whether vim _should_ take control of the
              > X primary selection when:
              > term != xterm
              > ttymouse == xterm*
              >

              Note that I also have clipboard set to 'autoselect'.

              set clipboard=autoselect

              - Yegappan
            • Neil Bird
              ... Ah-ha. Well, strictly speaking - no, as ttymouse is for, erm, the mouse, and not selections. But with the enhanced Xselection stuff now, ttymouse being
              Message 6 of 13 , Mar 29, 2001
                Mark Waggoner wrote:
                > Neil & Bram could comment on whether vim _should_ take control of the
                > X primary selection when:
                > term != xterm
                > ttymouse == xterm*

                Ah-ha. Well, strictly speaking - no, as 'ttymouse' is for, erm, the
                mouse, and not selections. But with the enhanced Xselection stuff now,
                ttymouse being 'xterm[2]' seems as good a check as any to make vim try to
                use Xselections (as well as term=xterm).

                It's that or add *another* option to force xselections on. The only
                people who might complain are those that want (say) rxvt xselection
                functionality, but not mouse. But then they can set nomouse, can't they?


                ----

                <later>

                OK, well, this will work (patch on 6.0y).

                But I'm no longer happy with hanging the functionality off of
                ttymouse=xterm.

                Thing is, accessing the X selection is actually nothing to do with
                either the mouse or being in an xterm. It works in anything when there's
                access to an X server. (e.g., I tried it in a sun cmdtool, and that
                worked).

                If it's going to be a formal change, I don't really see any pther way of
                doing it *than* having a new option (or value for an exisitng option - say
                'clipboard'? - e.g., set clipboard+=xselection).

                Bram? Is there something I've missed that ties xclipboard to xterm?

                --
                =====================- http://www.thalesgroup.com/ -=====================
                Neil Bird Principal Engineer |
                work - mailto:neil.bird@... | $> cd /pub
                personal - mailto:neil@... | $> more beer
              • Bram Moolenaar
                ... Strictly speaking the clipboard could be used whenever there is an X server to connect to. Any Visual selection (when clipboard has autoselect ) or
                Message 7 of 13 , Mar 29, 2001
                  Neil Bird wrote:

                  > Mark Waggoner wrote:
                  > > Neil & Bram could comment on whether vim _should_ take control of the
                  > > X primary selection when:
                  > > term != xterm
                  > > ttymouse == xterm*
                  >
                  > Ah-ha. Well, strictly speaking - no, as 'ttymouse' is for, erm, the
                  > mouse, and not selections. But with the enhanced Xselection stuff now,
                  > ttymouse being 'xterm[2]' seems as good a check as any to make vim try to
                  > use Xselections (as well as term=xterm).
                  >
                  > It's that or add *another* option to force xselections on. The only
                  > people who might complain are those that want (say) rxvt xselection
                  > functionality, but not mouse. But then they can set nomouse, can't they?
                  >
                  > <later>
                  >
                  > OK, well, this will work (patch on 6.0y).
                  >
                  > But I'm no longer happy with hanging the functionality off of
                  > ttymouse=xterm.
                  >
                  > Thing is, accessing the X selection is actually nothing to do with
                  > either the mouse or being in an xterm. It works in anything when there's
                  > access to an X server. (e.g., I tried it in a sun cmdtool, and that
                  > worked).
                  >
                  > If it's going to be a formal change, I don't really see any pther way of
                  > doing it *than* having a new option (or value for an exisitng option - say
                  > 'clipboard'? - e.g., set clipboard+=xselection).
                  >
                  > Bram? Is there something I've missed that ties xclipboard to xterm?

                  Strictly speaking the clipboard could be used whenever there is an X server to
                  connect to. Any Visual selection (when 'clipboard' has "autoselect") or using
                  the "* or "+ register could use the selection. This has nothing to do with
                  the presence of a mouse or an xterm.

                  Somehow the connection to the clipboard stuff to the xterm is how it was
                  originally setup. One thing led to another...

                  There is one potential problem: Connecting to the X server can be slow. So
                  far only people using an xterm could notice this. If we connect to the X
                  server for any terminal more people will run into this problem.

                  The "-X" argument can be used to prevent setting up the connection. Do we
                  also need an option to disable it?

                  --
                  The problem with political jokes is that they get elected.

                  /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                  ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                  \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                • Neil Bird
                  ... I think probaly the converse might be better; add a value to clipboard that ll make vim try and access an Xserver nomatter the terminal. Then if we leave
                  Message 8 of 13 , Mar 30, 2001
                    Bram Moolenaar wrote:
                    > There is one potential problem: Connecting to the X server can be slow. So
                    > far only people using an xterm could notice this. If we connect to the X
                    > server for any terminal more people will run into this problem.
                    >
                    > The "-X" argument can be used to prevent setting up the connection. Do we
                    > also need an option to disable it?

                    I think probaly the converse might be better; add a value to 'clipboard'
                    that'll make vim try and access an Xserver nomatter the terminal. Then if
                    we leave it as it is for xterms, anyone else (rxvt users) who wants
                    Xselection can set this option (implemented in the same manner as the way
                    I attached it to ttym).


                    Do we have any angle on *why* some X connections take a while?

                    --
                    =====================- http://www.thalesgroup.com/ -=====================
                    Neil Bird Principal Engineer |
                    work - mailto:neil.bird@... | $> cd /pub
                    personal - mailto:neil@... | $> more beer
                  • Bram Moolenaar
                    ... The problem is that there are many xterm look-a-likes, where the name of the terminal should not really have side effects. If you call an rxvt terminal
                    Message 9 of 13 , Mar 30, 2001
                      Neil Bird wrote:

                      > Bram Moolenaar wrote:
                      > > There is one potential problem: Connecting to the X server can be slow. So
                      > > far only people using an xterm could notice this. If we connect to the X
                      > > server for any terminal more people will run into this problem.
                      > >
                      > > The "-X" argument can be used to prevent setting up the connection. Do we
                      > > also need an option to disable it?
                      >
                      > I think probaly the converse might be better; add a value to 'clipboard'
                      > that'll make vim try and access an Xserver nomatter the terminal. Then if
                      > we leave it as it is for xterms, anyone else (rxvt users) who wants
                      > Xselection can set this option (implemented in the same manner as the way
                      > I attached it to ttym).

                      The problem is that there are many xterm look-a-likes, where the name of the
                      terminal should not really have side effects. If you call an rxvt terminal
                      "rxvt" instead of "xterm" should not have the side effect of disabling the
                      clipboard.

                      I think most people expect the X selection to work, thus that should be the
                      default. Only few people will run into the slow connection problem. But when
                      someone does run into this problem, it's difficult to find out why it happens
                      and how to avoid it.

                      > Do we have any angle on *why* some X connections take a while?

                      Unreliable or slow network connections. Sending the character you type then
                      still works reasonable well (although a CTRL-L might also be slow), but
                      apparently setting up the connection to the X server requires some talking
                      back and forth. That's annoying if you start Vim and have to wait a couple of
                      seconds.

                      I have thought of a way to start Vim without the X connection and try to make
                      the connection when starting for the user to type. But this quickly gets
                      complicated. Doing something with threads or forking also isn't simple.

                      Another solution would be popping up a dialog: "Starting a connection to the
                      X server could be slow. Do want to connect to the X server now?" :-)

                      --
                      LARGE MAN: Who's that then?
                      CART DRIVER: (Grudgingly) I dunno, Must be a king.
                      LARGE MAN: Why?
                      CART DRIVER: He hasn't got shit all over him.
                      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                      ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                    • Neil Bird
                      ... I can only suggest, then, the Xselection is attempted if DISPLAY is set to something nun-null, which would seem the be the most logical check [for an
                      Message 10 of 13 , Mar 30, 2001
                        Bram Moolenaar wrote:
                        > The problem is that there are many xterm look-a-likes, where the name of the
                        > terminal should not really have side effects. If you call an rxvt terminal
                        > "rxvt" instead of "xterm" should not have the side effect of disabling the
                        > clipboard.

                        I can only suggest, then, the Xselection is attempted if 'DISPLAY' is
                        set to something nun-null, which would seem the be the most logical check
                        [for an Xserver].

                        Users who then discover they currently have a slow connection can then
                        either unset DISPLAY or use/alias 'vim -X'.


                        Vim could always time the connection call & warn the use what actions
                        they may want to take.

                        --
                        =====================- http://www.thalesgroup.com/ -=====================
                        Neil Bird Principal Engineer |
                        work - mailto:neil.bird@... | $> cd /pub
                        personal - mailto:neil@... | $> more beer
                      • Bram Moolenaar
                        ... That happens automatically, since when $DISPLAY isn t set it s impossible to locate the X server and the XOpenDisplay() will fail. ... It already happened
                        Message 11 of 13 , Mar 30, 2001
                          Neil Bird wrote:

                          > I can only suggest, then, the Xselection is attempted if 'DISPLAY' is
                          > set to something nun-null, which would seem the be the most logical check
                          > [for an Xserver].

                          That happens automatically, since when $DISPLAY isn't set it's impossible to
                          locate the X server and the XOpenDisplay() will fail.

                          > Vim could always time the connection call & warn the use what actions
                          > they may want to take.

                          It already happened then... Although it might be a hint for people who don't
                          understand why startup is slow. But the warning could be annoying as well.
                          Perhaps only do it when using "-V"?

                          What time limit could be used? One second? The call to open the connection
                          for restoring the Window title has a timeout of two seconds.

                          --
                          ARTHUR: Be quiet! I order you to shut up.
                          OLD WOMAN: Order, eh -- who does he think he is?
                          ARTHUR: I am your king!
                          OLD WOMAN: Well, I didn't vote for you.
                          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                          ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                        • Neil Bird
                          ... Nah, the person who knows to turn on -V knows how to find -X. This d be aimed at the general user who s suffering every time it starts up. Is it not
                          Message 12 of 13 , Mar 30, 2001
                            Bram Moolenaar wrote:
                            > > Vim could always time the connection call & warn the user what
                            > > actions they may want to take.
                            >
                            > It already happened then... Although it might be a hint for people who
                            > don't understand why startup is slow. But the warning could be annoying
                            > as well. Perhaps only do it when using "-V"?

                            Nah, the person who knows to turn on -V knows how to find -X. This'd be
                            aimed at the general user who's suffering every time it starts up.

                            Is it not possible to have the warning come up on the status line
                            without (other errors notwithstanding) the user hitting return? I.e., it's
                            just 'there'?


                            > What time limit could be used? One second? The call to open the
                            > connection for restoring the Window title has a timeout of two seconds.

                            2s. sounds fair, but really it's up to someone who's suffered it to say
                            what they might prefer.

                            --
                            =====================- http://www.thalesgroup.com/ -=====================
                            Neil Bird Principal Engineer |
                            work - mailto:neil.bird@... | $> cd /pub
                            personal - mailto:neil@... | $> more beer
                          • Bram Moolenaar
                            ... But you first have to find out that -X will solve the problem. Suppose someone complains that Vim starts up slow. We could then say try the -V
                            Message 13 of 13 , Mar 30, 2001
                              Neil Bird wrote:

                              > > It already happened then... Although it might be a hint for people who
                              > > don't understand why startup is slow. But the warning could be annoying
                              > > as well. Perhaps only do it when using "-V"?
                              >
                              > Nah, the person who knows to turn on -V knows how to find -X. This'd be
                              > aimed at the general user who's suffering every time it starts up.

                              But you first have to find out that -X will solve the problem. Suppose
                              someone complains that Vim starts up slow. We could then say "try the -V
                              argument", so that he can see if Vim reports a long startup time for the
                              X server.

                              A more rigorous approach would be to include time stamps in all the
                              verbose messages. I didn't need that until now, and it messes up the
                              output, thus it doesn't seem very useful.

                              > Is it not possible to have the warning come up on the status line
                              > without (other errors notwithstanding) the user hitting return? I.e., it's
                              > just 'there'?

                              No, any message will cause the hit-return prompt. The logic for which
                              message can be overwritten and which can't is already too complicated.
                              And when you do "vim file" the message for reading "file" would always
                              overwrite the message.

                              --
                              BLACK KNIGHT: None shall pass.
                              ARTHUR: I have no quarrel with you, brave Sir knight, but I must cross
                              this bridge.
                              BLACK KNIGHT: Then you shall die.
                              "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                              /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                              ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
                              \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                            Your message has been successfully submitted and would be delivered to recipients shortly.