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

Re: pastetoggle

Expand Messages
  • Chris Allen
    ... No, the advice given applies to console Vim running within XTerm. XTerm can make mouse events visible to console applications. Under GVim all that stuff
    Message 1 of 25 , Dec 1, 2005
      On 01/12/05, Harry Putnam <reader@...> wrote:
      > You are speaking of gvim here right? But I don't normally use gvim.
      > I prefer plain vim from too much work in console mode.

      No, the advice given applies to console Vim running within XTerm.
      XTerm can make mouse events visible to console applications. Under
      GVim all that stuff Just Works(TM) without any special configuration
      or build options.

      Yegappan was quite right, above, you *can* also paste using the X11
      clip board and keys. I believe that requires you to have +X built
      into your console (yes, console) Vim, as well. See :help
      xterm-clipboard for more information. I had forgotten about that
      since it is yet another shiny feature which my system does not support
      ;)

      HTH,
      Chris Allen
    • Justin Randall
      ... __________________________________ Yahoo! Mail - PC Magazine Editors Choice 2005 http://mail.yahoo.com
      Message 2 of 25 , Dec 1, 2005
        --- Gerald Lai <laige@...> wrote:

        > Hi Justin,
        >
        > In order to get those keys to work in all consoles of Vim, you need to
        > know the key bind codes of consoles/terminals. Hence, it is almost
        > impossible to get it working for every console out there.
        >
        > I've included an attachment that contains the setup that lets Vim work for
        > SunOS and RedHat Linux xterms. You'll need to include keys.vim into your
        > vimrc file. Also see ":help terminal-options".
        >
        > bindings.txt is a list of key scan codes. You would notice that having a
        > terminal program like RXVT ensures that the scan codes are consistent
        > across all platforms. A better way is just to use the graphical version of
        > GVim.
        >
        > Hope this helps.
        >
        > -Gerald
        >
        > On Wed, 30 Nov 2005, Justin Randall wrote:
        >
        > > Does anybody know how to make the <Home> <End> <Page Up> and <Page Down> keys useful
        > in
        > > all modes of console VIM? I would love to be able to use these keys as they are ment
        > to
        > > be used. Sadly, when I press them in VIM, they do nothing. Is their a way to map them
        > to
        > > their proper functionallity? I.E. Home takes you to top of file, End takes you to
        > end of
        > > file, Page Up and Page Down are self explanitory. Any help is appreciated.
        > > -Justin
        > >
        > >
        > >
        > >
        > > __________________________________
        > > Yahoo! Mail - PC Magazine Editors' Choice 2005
        > > http://mail.yahoo.com
        > >





        __________________________________
        Yahoo! Mail - PC Magazine Editors' Choice 2005
        http://mail.yahoo.com
      • Harry Putnam
        ... I m probably being very dense here but I don t see what this is supposed to do. Once I ve set mouse=a. I can no longer paste at all with mouse Then
        Message 3 of 25 , Dec 1, 2005
          "Charles E. Campbell, Jr." <drchip@...> writes:

          >>I'm guessing there is some other way to make pasting smooth without
          >>the hack (paste toggle)...
          >>
          > Assuming you have :set mouse=a in your .vimrc:
          >
          > noremap <middlemouse> :set paste<cr><middlemouse>:set nopaste<cr>

          I'm probably being very dense here but I don't see what this is
          supposed to do.

          Once I've set mouse=a. I can no longer paste at all with mouse

          Then following with:
          noremap <middlemouse> :set paste<cr><middlemouse>:set nopaste<cr>

          I still cannot paste at all with mouse.
        • Harry Putnam
          ... I m not seeing either of above here. I ve never had a setup where the modeline could be manipulated with mouse when running plain vim in an xterm. But I
          Message 4 of 25 , Dec 1, 2005
            Chris Allen <c.d.allen@...> writes:

            > On 01/12/05, Harry Putnam <reader@...> wrote:
            >> You are speaking of gvim here right? But I don't normally use gvim.
            >> I prefer plain vim from too much work in console mode.
            >
            > No, the advice given applies to console Vim running within XTerm.
            > XTerm can make mouse events visible to console applications. Under
            > GVim all that stuff Just Works(TM) without any special configuration
            > or build options.
            >
            > Yegappan was quite right, above, you *can* also paste using the X11
            > clip board and keys. I believe that requires you to have +X built
            > into your console (yes, console) Vim, as well. See :help
            > xterm-clipboard for more information. I had forgotten about that
            > since it is yet another shiny feature which my system does not support

            I'm not seeing either of above here. I've never had a setup where the
            modeline could be manipulated with mouse when running plain vim in an
            xterm. But I have, in the past been able to paste with middle mouse
            from xterm output to a vim instance running in another xterm without
            any special stuff such as has been described here.

            Yegappan s suggestion does not paste at all here. That is, if I have
            an instance of vim running in an xterm and in input mode. Now
            highlight text in a different xterm with left mouse.

            In vim press C-R C-O at this point I get the `"' and then I guess I'm
            supposed to type an asterisk and hit enter.

            Here no pasting occurs. Only a screen flash like a visual bell type
            flash.

            The help manual says C-R C-O * <ENTER> is supposed to be the same as
            pasting with middlemouse, but here that is not the case. It pastes
            nothing for me, whereas middle mouse pastes the clipboard text but has
            the stepping problem.
          • Yegappan Lakshmanan
            Hello, ... In insert mode, you have to press CTRL-R followed by CTRL-O followed by the register name. In this case, as you are trying to paste the contents of
            Message 5 of 25 , Dec 2, 2005
              Hello,

              On 12/1/05, Harry Putnam <reader@...> wrote:
              > Yegappan Lakshmanan <yegappanl@...> writes:
              >
              > >> I suspect you would have to paste with the mouse rather than through
              > >> any keyed mechanism.
              > >>
              > >
              > > What about pasting the copied text using the CTRL-R CTRL-O {register}
              > > command? This command inserts the contents of the specified register
              > > without any indentation. To paste the contents of the clipboard (assuming
              > > the * register represents the clipboard), you can use the
              > > CTRL-R CTRL - O * command.
              >
              > What is that? Can you explain what is supposed to happen in the above
              > command? `CTRL-R CTRL - O *'.
              >

              In insert mode, you have to press CTRL-R followed by CTRL-O
              followed by the register name. In this case, as you are trying
              to paste the contents of the clipboard, the name of the register
              is '*' (start). This command will insert the contents of the specified
              register without any indentation.

              >
              > Not it says `same as pasting with the mouse'
              >
              > But I don't want the same behavior. Pasting with mouse gives me the
              > stepping problem.
              >

              If you are using a Vim that is compiled with the support for the
              xterm clipboard and mouse support and you have set the 'mouse'
              option to let Vim handle the mouse, then when you paste with
              the middle mouse button, the text will be pasted without any
              indentation.

              The help text refers to the behavior when Vim is able to access
              the xterm clipboard and is handling the mouse click.

              >
              > My version info below (Note several `mouse' entries):
              >
              > VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
              > +mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg -osfiletype
              > -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
              >

              You are using a Vim compiled without the support for accessing
              the xterm clipboard (-xterm_clipboard). In this version, you cannot
              use the above described command to paste the clipboard
              contents.

              - Yegappan
            • Gerald Lai
              ... [snip] ... Harry, I seem to have the same problem as you, and I think I managed to track it down to the mouse setting. Apparently, middleclick pasting
              Message 6 of 25 , Dec 2, 2005
                On Thu, 1 Dec 2005, Harry Putnam wrote:

                > Chris Allen <c.d.allen@...> writes:
                >
                >> On 01/12/05, Harry Putnam <reader@...> wrote:
                >>> You are speaking of gvim here right? But I don't normally use gvim.
                >>> I prefer plain vim from too much work in console mode.
                [snip]
                > Here no pasting occurs. Only a screen flash like a visual bell type
                > flash.
                >
                > The help manual says C-R C-O * <ENTER> is supposed to be the same as
                > pasting with middlemouse, but here that is not the case. It pastes
                > nothing for me, whereas middle mouse pastes the clipboard text but has
                > the stepping problem.

                Harry,

                I seem to have the same problem as you, and I think I managed to track it down
                to the 'mouse' setting. Apparently, middleclick pasting does not work if
                'mouse=a'. Doing ':set mouse=' will make middleclick pasting work again, but
                we'll lose many mouse funtionalities in console Vim.

                The mapping Chip Campbell provided

                noremap <MiddleMouse> ...<MiddleMouse>...

                will only work if 'mouse' either has the 'a' or 'n' setting. It's a chicken and
                egg problem with the keymap because in order to get middleclick pasting to
                work, we have to get rid of 'a' by ':set mouse-=a', but after getting rid of a,
                we can't do a <MiddleClick> in the keymap.

                The best way I found to balance functionalities is to do the following:

                if has("gui_running")
                set mouse=ra
                else
                set mouse=rn
                nnoremap <MiddleMouse> a<MiddleMouse>
                endif

                This way, whenever a middleclick paste is issued in normal mode, it switches to
                insert mode to do the paste (which would work because it is an 'n' setting).
                While in insert mode, mouse functionality is limited, but that's the sacrifice
                we make. Note that appending "<Esc>" to the end of the nnoremap will kill the
                keymap for some reason.

                Hope this helps.

                -Gerald
              • Yegappan Lakshmanan
                Hi, ... If you are using a Vim compiled with support for accessing the xterm clipboard and support for handling mouse, and you have set the mouse option to
                Message 7 of 25 , Dec 2, 2005
                  Hi,

                  On 12/1/05, Harry Putnam <reader@...> wrote:
                  > Chris Allen <c.d.allen@...> writes:
                  >
                  > > Yegappan was quite right, above, you *can* also paste using the X11
                  > > clip board and keys. I believe that requires you to have +X built
                  > > into your console (yes, console) Vim, as well. See :help
                  > > xterm-clipboard for more information. I had forgotten about that
                  > > since it is yet another shiny feature which my system does not support
                  >
                  > I'm not seeing either of above here. I've never had a setup where the
                  > modeline could be manipulated with mouse when running plain vim in an
                  > xterm. But I have, in the past been able to paste with middle mouse
                  > from xterm output to a vim instance running in another xterm without
                  > any special stuff such as has been described here.
                  >
                  > Yegappan s suggestion does not paste at all here. That is, if I have
                  > an instance of vim running in an xterm and in input mode. Now
                  > highlight text in a different xterm with left mouse.
                  >

                  If you are using a Vim compiled with support for accessing the
                  xterm clipboard and support for handling mouse, and you have
                  set the 'mouse' option to let Vim handle the mouse events,
                  then you can use either the middle mouse button or the
                  CTRL-R CTRL-O * command to paste the contents of the clipboard
                  literally (without any indentation).

                  If you don't have a Vim compiled with the xterm clipboard support
                  or you haven't set the 'mouse' option, then you cannot paste
                  the clipboard contents using the CTRL-R CTRL-O * command or
                  the middle mouse button. In this case, the mouse will be handled
                  by xterm itself.

                  When you click the middle mouse button, xterm will send the
                  contents of the clipboard to Vim, as though the user typed it from
                  the keyboard. In this case, if you have 'autoindent' option set, you
                  will get stair-case effect. You need to set the 'paste' option to paste
                  the text without any indentation.

                  - Yegappan
                • Harry Putnam
                  ... I have the vim cvs sources. The ./configure program doesn t now anything about an -xterm_clipboard option. Nor does Makefile. How does one compile with
                  Message 8 of 25 , Dec 2, 2005
                    Yegappan Lakshmanan <yegappanl@...> writes:

                    >> VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                    >> +mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg -osfiletype
                    >> -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                    >>
                    >
                    > You are using a Vim compiled without the support for accessing
                    > the xterm clipboard (-xterm_clipboard). In this version, you cannot
                    > use the above described command to paste the clipboard
                    > contents.

                    I have the vim cvs sources. The ./configure program doesn't now
                    anything about an -xterm_clipboard option. Nor does Makefile.

                    How does one compile with that option. What does the command line
                    look like?
                  • Yegappan Lakshmanan
                    Hi, ... VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19) Compiled by root@reader Huge version without GUI. Features included (+) or not (-):
                    Message 9 of 25 , Dec 2, 2005
                      Hi,

                      On 12/2/05, Harry Putnam <reader@...> wrote:
                      > Yegappan Lakshmanan <yegappanl@...> writes:
                      >
                      > >> VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                      > >> +mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg -osfiletype
                      > >> -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                      > >>
                      > >
                      > > You are using a Vim compiled without the support for accessing
                      > > the xterm clipboard (-xterm_clipboard). In this version, you cannot
                      > > use the above described command to paste the clipboard
                      > > contents.
                      >
                      > I have the vim cvs sources. The ./configure program doesn't now
                      > anything about an -xterm_clipboard option. Nor does Makefile.
                      >
                      > How does one compile with that option. What does the command line
                      > look like?
                      >

                      From the version output in one of your earlier e-mails:

                      --------------------------------------
                      VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                      Compiled by root@reader
                      Huge version without GUI. Features included (+) or not (-):
                      -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                      --------------------------------------

                      You need to compile Vim with the GUI support to get the xterm_clipboard
                      feature.

                      - Yegappan
                    • A. J. Mechelynck
                      ... To begin with, try and see if you can enable X11 support in console Vim. I think it might be a configure argument something like --with-x11=yes but I m no
                      Message 10 of 25 , Dec 2, 2005
                        Harry Putnam wrote:
                        > Yegappan Lakshmanan <yegappanl@...> writes:
                        >
                        >>> VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                        >>> +mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg -osfiletype
                        >>> -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                        >>>
                        >> You are using a Vim compiled without the support for accessing
                        >> the xterm clipboard (-xterm_clipboard). In this version, you cannot
                        >> use the above described command to paste the clipboard
                        >> contents.
                        >
                        > I have the vim cvs sources. The ./configure program doesn't now
                        > anything about an -xterm_clipboard option. Nor does Makefile.
                        >
                        > How does one compile with that option. What does the command line
                        > look like?
                        >
                        >
                        >
                        >

                        To begin with, try and see if you can enable X11 support in console Vim.
                        I think it might be a configure argument something like --with-x11=yes
                        but I'm no specialist on configuring Vim on Unix-like systems -- you
                        might want to check it, or to get a second opinion.

                        Best regards,
                        Tony.
                      • A. J. Mechelynck
                        ... Not necessarily. Strange as it may seem to you Yegappan, it is possible to make an X11-aware console Vim, and such a build can usually access the X11
                        Message 11 of 25 , Dec 2, 2005
                          Yegappan Lakshmanan wrote:
                          > Hi,
                          >
                          > On 12/2/05, Harry Putnam <reader@...> wrote:
                          >> Yegappan Lakshmanan <yegappanl@...> writes:
                          >>
                          >>>> VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                          >>>> +mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg -osfiletype
                          >>>> -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                          >>>>
                          >>> You are using a Vim compiled without the support for accessing
                          >>> the xterm clipboard (-xterm_clipboard). In this version, you cannot
                          >>> use the above described command to paste the clipboard
                          >>> contents.
                          >> I have the vim cvs sources. The ./configure program doesn't now
                          >> anything about an -xterm_clipboard option. Nor does Makefile.
                          >>
                          >> How does one compile with that option. What does the command line
                          >> look like?
                          >>
                          >
                          >>From the version output in one of your earlier e-mails:
                          >
                          > --------------------------------------
                          > VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                          > Compiled by root@reader
                          > Huge version without GUI. Features included (+) or not (-):
                          > -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                          > --------------------------------------
                          >
                          > You need to compile Vim with the GUI support to get the xterm_clipboard
                          > feature.
                          >
                          > - Yegappan
                          >
                          >
                          >

                          Not necessarily. Strange as it may seem to you Yegappan, it is possible
                          to make an X11-aware "console" Vim, and such a build can usually access
                          the X11 clipboard even if it still displays its output in an xterm.

                          Best regards,
                          Tony.
                        • Yegappan Lakshmanan
                          Hi, ... Yes. When I configure and build Vim with the following commands: $ ./configure --with-features=huge --disable-gui $ make The resulting Vim binary has
                          Message 12 of 25 , Dec 2, 2005
                            Hi,

                            On 12/2/05, A. J. Mechelynck <antoine.mechelynck@...> wrote:
                            > >>
                            > >>>> VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                            > >>>> +mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg -osfiletype
                            > >>>> -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                            > >>>>
                            > >>> You are using a Vim compiled without the support for accessing
                            > >>> the xterm clipboard (-xterm_clipboard). In this version, you cannot
                            > >>> use the above described command to paste the clipboard
                            > >>> contents.
                            > >> I have the vim cvs sources. The ./configure program doesn't now
                            > >> anything about an -xterm_clipboard option. Nor does Makefile.
                            > >>
                            > >> How does one compile with that option. What does the command line
                            > >> look like?
                            > >>
                            > >
                            > >>From the version output in one of your earlier e-mails:
                            > >
                            > > --------------------------------------
                            > > VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Nov 25 2005 17:02:19)
                            > > Compiled by root@reader
                            > > Huge version without GUI. Features included (+) or not (-):
                            > > -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
                            > > --------------------------------------
                            > >
                            > > You need to compile Vim with the GUI support to get the xterm_clipboard
                            > > feature.
                            > >
                            >
                            > Not necessarily. Strange as it may seem to you Yegappan, it is possible
                            > to make an X11-aware "console" Vim, and such a build can usually access
                            > the X11 clipboard even if it still displays its output in an xterm.
                            >

                            Yes. When I configure and build Vim with the following commands:

                            $ ./configure --with-features=huge --disable-gui
                            $ make

                            The resulting Vim binary has the xterm_clipboard support enabled and
                            accessing the X11 primary selection-buffer through the "*" register from
                            Vim works correctly.

                            - Yegappan
                          • Charles E. Campbell, Jr.
                            ... Based on the configure help: configure --help : I believe you need to configure with --with-x (not that I ve tried this myself, I just usually build it
                            Message 13 of 25 , Dec 2, 2005
                              A. J. Mechelynck wrote:

                              >To begin with, try and see if you can enable X11 support in console Vim.
                              >I think it might be a configure argument something like --with-x11=yes
                              >but I'm no specialist on configuring Vim on Unix-like systems -- you
                              >might want to check it, or to get a second opinion.
                              >
                              >
                              Based on the configure help: configure --help :
                              I believe you need to configure with

                              --with-x

                              (not that I've tried this myself, I just usually build it with huge)

                              Regards,
                              Chip Campbell
                            Your message has been successfully submitted and would be delivered to recipients shortly.