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

[patch] retain visual mode for :# commands

Expand Messages
  • Christian Brabandt
    Bram, when visual mode is active and one is jumping to another position using : visual mode is unexpectedly ended. Attached patch fixes this issue.
    Message 1 of 12 , Jan 26, 2013
      Bram,
      when visual mode is active and one is jumping to another position
      using :<nr> visual mode is unexpectedly ended.

      Attached patch fixes this issue.

      regards,
      Christian
      --
      Oft besteht die größ(ere) Kraft eines Mannes weniger darin, wie er ein
      Amt verwaltet, als wie [er] in dasselbe gelangte.
      -- Jean Paul

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • James McCoy
      ... Why is this unexpected? You ve changed from visual to cmdline mode. The indication of visual mode is an aid to see the area on which you re operating.
      Message 2 of 12 , Jan 26, 2013
        On Sat, Jan 26, 2013 at 03:17:16PM +0100, Christian Brabandt wrote:
        > Bram,
        > when visual mode is active and one is jumping to another position
        > using :<nr> visual mode is unexpectedly ended.

        Why is this unexpected? You've changed from visual to cmdline mode.
        The indication of visual mode is an aid to see the area on which you're
        operating.

        Cheers,
        --
        James
        GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>
      • Christian Brabandt
        Hi James! ... Because I started visual mode and wanted it to highlight far down to a specific line which was several hundreds lines down. So I entered like
        Message 3 of 12 , Jan 26, 2013
          Hi James!

          On Sa, 26 Jan 2013, James McCoy wrote:

          > On Sat, Jan 26, 2013 at 03:17:16PM +0100, Christian Brabandt wrote:
          > > Bram,
          > > when visual mode is active and one is jumping to another position
          > > using :<nr> visual mode is unexpectedly ended.
          >
          > Why is this unexpected? You've changed from visual to cmdline mode.
          > The indication of visual mode is an aid to see the area on which you're
          > operating.

          Because I started visual mode and wanted it to highlight far down to a
          specific line which was several hundreds lines down. So I entered like
          always :1500 and visual mode ended. This was not nice ;)

          regards,
          Christian

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • James McCoy
          ... 1500G would be how I would recommend doing that, but I ve seen other people try :# before. I ll leave it up to Bram on whether that should work or not.
          Message 4 of 12 , Jan 26, 2013
            On Sat, Jan 26, 2013 at 04:07:32PM +0100, Christian Brabandt wrote:
            > Hi James!
            >
            > On Sa, 26 Jan 2013, James McCoy wrote:
            >
            > > On Sat, Jan 26, 2013 at 03:17:16PM +0100, Christian Brabandt wrote:
            > > > Bram,
            > > > when visual mode is active and one is jumping to another position
            > > > using :<nr> visual mode is unexpectedly ended.
            > >
            > > Why is this unexpected? You've changed from visual to cmdline mode.
            > > The indication of visual mode is an aid to see the area on which you're
            > > operating.
            >
            > Because I started visual mode and wanted it to highlight far down to a
            > specific line which was several hundreds lines down. So I entered like
            > always :1500 and visual mode ended. This was not nice ;)

            1500G would be how I would recommend doing that, but I've seen other
            people try :# before. I'll leave it up to Bram on whether that should
            work or not.

            Cheers,
            --
            James
            GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>
          • Christian Brabandt
            Hi James! ... indeed 1500G should have worked. I just haven t thought about it, since I usually use the :# ex command. But its fair enough. I just found it
            Message 5 of 12 , Jan 26, 2013
              Hi James!

              On Sa, 26 Jan 2013, James McCoy wrote:

              > On Sat, Jan 26, 2013 at 04:07:32PM +0100, Christian Brabandt wrote:
              > > Hi James!
              > >
              > > On Sa, 26 Jan 2013, James McCoy wrote:
              > >
              > > > On Sat, Jan 26, 2013 at 03:17:16PM +0100, Christian Brabandt wrote:
              > > > > Bram,
              > > > > when visual mode is active and one is jumping to another position
              > > > > using :<nr> visual mode is unexpectedly ended.
              > > >
              > > > Why is this unexpected? You've changed from visual to cmdline mode.
              > > > The indication of visual mode is an aid to see the area on which you're
              > > > operating.
              > >
              > > Because I started visual mode and wanted it to highlight far down to a
              > > specific line which was several hundreds lines down. So I entered like
              > > always :1500 and visual mode ended. This was not nice ;)
              >
              > 1500G would be how I would recommend doing that, but I've seen other
              > people try :# before. I'll leave it up to Bram on whether that should
              > work or not.

              indeed 1500G should have worked. I just haven't thought about it, since
              I usually use the :# ex command.
              But its fair enough. I just found it unexpected and think it is more
              logically.

              regards,
              Christian
              --
              Die Erde als Erde ist auch dem Sinnlichsten nichts, sondern seine
              Ideen darüber.
              -- Jean Paul

              --
              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Ingo Karkat
              ... I find the new proposed behavior somewhat unexpected (though I rarely use :#); you had to press to get rid of the
              Message 6 of 12 , Jan 26, 2013
                On 26-Jan-13 22:40:42 +0100, Christian Brabandt wrote:

                > Hi James!
                >
                > On Sa, 26 Jan 2013, James McCoy wrote:
                >
                >> On Sat, Jan 26, 2013 at 04:07:32PM +0100, Christian Brabandt wrote:
                >>> Hi James!
                >>>
                >>> On Sa, 26 Jan 2013, James McCoy wrote:
                >>>
                >>>> On Sat, Jan 26, 2013 at 03:17:16PM +0100, Christian Brabandt wrote:
                >>>>> Bram,
                >>>>> when visual mode is active and one is jumping to another position
                >>>>> using :<nr> visual mode is unexpectedly ended.
                >>>>
                >>>> Why is this unexpected? You've changed from visual to cmdline mode.
                >>>> The indication of visual mode is an aid to see the area on which you're
                >>>> operating.
                >>>
                >>> Because I started visual mode and wanted it to highlight far down to a
                >>> specific line which was several hundreds lines down. So I entered like
                >>> always :1500 and visual mode ended. This was not nice ;)
                >>
                >> 1500G would be how I would recommend doing that, but I've seen other
                >> people try :# before. I'll leave it up to Bram on whether that should
                >> work or not.
                >
                > indeed 1500G should have worked. I just haven't thought about it, since
                > I usually use the :# ex command.
                > But its fair enough. I just found it unexpected and think it is more
                > logically.

                I find the new proposed behavior somewhat unexpected (though I rarely use :#);
                you had to press <C-U> to get rid of the '<,'>, and that signals to me that
                visual mode is done.

                Instead of G, you can use :# today as well; it's just more typing:
                V:<C-U>1500<CR>V'<

                -- regards, ingo

                --
                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Christian Brabandt
                Hi Ingo! ... The new behaviour would only work, with
                Message 7 of 12 , Jan 26, 2013
                  Hi Ingo!

                  On Sa, 26 Jan 2013, Ingo Karkat wrote:

                  > I find the new proposed behavior somewhat unexpected (though I rarely use :#);
                  > you had to press <C-U> to get rid of the '<,'>, and that signals to me that
                  > visual mode is done.
                  >
                  > Instead of G, you can use :# today as well; it's just more typing:
                  > V:<C-U>1500<CR>V'<

                  The new behaviour would only work, with '<,'> in front of the line
                  number. If you press <C-U> it wouldn't work and would work as before.

                  regards,
                  Christian
                  --
                  Die Altersweisheit gibt es nicht. Wenn man altert, wird man nicht
                  weise, sondern nur vorsichtig.
                  -- Ernest Hemingway

                  --
                  --
                  You received this message from the "vim_dev" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • John Little
                  ... (Assuming you don t mean the ancient non-visual mode command :#, a synonym for :number.) See :help :[range], you seem to imply by but I ve seen other
                  Message 8 of 12 , Jan 26, 2013
                    On Sunday, January 27, 2013 4:31:04 AM UTC+13, James McCoy wrote:
                    > 1500G would be how I would recommend doing that, but I've seen other
                    > people try :# before.

                    (Assuming you don't mean the ancient non-visual mode command :#, a synonym for :number.)

                    See :help :[range], you seem to imply by "but I've seen other people try" that it's not a kosher movement.

                    Regards, John Little

                    --
                    --
                    You received this message from the "vim_dev" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php
                  • James McCoy
                    ... Yes, I meant :[range]. I was being consistent with the synatx in the subject of the email, although the body of the OP used : . ... Not that it isn t a
                    Message 9 of 12 , Jan 26, 2013
                      On Sat, Jan 26, 2013 at 08:22:15PM -0800, John Little wrote:
                      > On Sunday, January 27, 2013 4:31:04 AM UTC+13, James McCoy wrote:
                      > > 1500G would be how I would recommend doing that, but I've seen other
                      > > people try :# before.
                      >
                      > (Assuming you don't mean the ancient non-visual mode command :#, a synonym for :number.)
                      >
                      > See :help :[range],

                      Yes, I meant :[range]. I was being consistent with the synatx in the
                      subject of the email, although the body of the OP used :<nr>.

                      > you seem to imply by "but I've seen other people try" that it's not a kosher movement.

                      Not that it isn't a kosher movement, but that (I don't think) it should
                      be a valid method to extend the range of a visual selection. As I
                      stated in my earlier email, changing to cmdline mode ends visual mode.

                      Also, I guess Christian isn't intending to solely extend the selection
                      to that specific line, otherwise changing the ":'<,'>" command line to
                      ":'<,1500" would be sufficient.

                      Cheers,
                      --
                      James
                      GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>
                    • Ingo Karkat
                      ... Ah, okay, that mitigates my concerns. It s a quite strange syntax, and I probably wouldn t have been able to deduce the behavior upon seeing :
                      Message 10 of 12 , Jan 27, 2013
                        On 26-Jan-13 23:36:02 +0100, Christian Brabandt wrote:

                        > Hi Ingo!
                        >
                        > On Sa, 26 Jan 2013, Ingo Karkat wrote:
                        >
                        >> I find the new proposed behavior somewhat unexpected (though I rarely
                        >> use :#); you had to press <C-U> to get rid of the '<,'>, and that
                        >> signals to me that visual mode is done.
                        >>
                        >> Instead of G, you can use :# today as well; it's just more typing:
                        >> V:<C-U>1500<CR>V'<
                        >
                        > The new behaviour would only work, with '<,'> in front of the line
                        > number. If you press <C-U> it wouldn't work and would work as before.

                        Ah, okay, that mitigates my concerns. It's a quite strange syntax, and I
                        probably wouldn't have been able to deduce the behavior upon seeing :'<,'>1500
                        before this discussion, but if it helps you (and others), you'd have my blessing :-)

                        -- regards, ingo

                        --
                        --
                        You received this message from the "vim_dev" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php
                      • John Little
                        ... I kind of see your point now, but while you re in that cmdline mode, the visual selection is still displayed; it is surprising that on completion of the
                        Message 11 of 12 , Jan 27, 2013
                          On Sunday, January 27, 2013 5:44:38 PM UTC+13, James McCoy wrote:

                          > Not that it isn't a kosher movement, but that (I don't think) it should
                          > be a valid method to extend the range of a visual selection. As I
                          > stated in my earlier email, changing to cmdline mode ends visual mode.

                          I kind of see your point now, but while you're in that cmdline mode, the visual selection is still displayed; it is surprising that on completion of the command line, not on entering it, is the visual selection deselected. Also, when searching, having pressed / one is in command-line mode, but the visual selection remains and is extended on a successful search.

                          Regards, John

                          --
                          --
                          You received this message from the "vim_dev" maillist.
                          Do not top-post! Type your reply below the text you are replying to.
                          For more information, visit http://www.vim.org/maillist.php
                        • Bram Moolenaar
                          ... Do we really need this? It adds an exception. Next would be jumping to a mark with :, m and probably other Ex commands that only move the cursor. --
                          Message 12 of 12 , Jan 27, 2013
                            Christian Brabandt wrote:

                            > Bram,
                            > when visual mode is active and one is jumping to another position
                            > using :<nr> visual mode is unexpectedly ended.
                            >
                            > Attached patch fixes this issue.

                            Do we really need this? It adds an exception. Next would be jumping to
                            a mark with :,'m and probably other Ex commands that only move the
                            cursor.


                            --
                            WOMAN: I didn't know we had a king. I thought we were an autonomous
                            collective.
                            DENNIS: You're fooling yourself. We're living in a dictatorship. A
                            self-perpetuating autocracy in which the working classes--
                            WOMAN: Oh there you go, bringing class into it again.
                            DENNIS: That's what it's all about if only people would--
                            The Quest for the Holy Grail (Monty Python)

                            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                            \\\ an exciting new programming language -- http://www.Zimbu.org ///
                            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                            --
                            --
                            You received this message from the "vim_dev" maillist.
                            Do not top-post! Type your reply below the text you are replying to.
                            For more information, visit http://www.vim.org/maillist.php
                          Your message has been successfully submitted and would be delivered to recipients shortly.