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

efficiently navigating and the jumplist

Expand Messages
  • Jeroen Budts
    ... Hash: SHA256 Hi all, Although I have been using Vim now for over two years now as my main text editor, I often still have the feeling that I m not very
    Message 1 of 5 , Jan 10, 2013
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA256

      Hi all,

      Although I have been using Vim now for over two years now as my main
      text editor, I often still have the feeling that I'm not very efficient
      in navigating through a file, more specifically through the part of the
      file which is on my screen.
      Most of the time when I can see the line where I want to jump to I will
      use a count together with the j or k command. I use 'relativenumber', so
      I can easily see the correct count. However, this still feels a little
      inefficient, as my eyes first have to find the line I want to jump to,
      then carefully (without loosing track of the line) look to the left to
      find the correct number, then my fingers have to enter the correct
      number and finally I can press j or k.
      So far the jumplist has also always felt rather confusing to me.
      Yesterday I finally discovered why: I think of the method how I move to
      specific lines as being a 'jump', because in fact, the cursor jumps to
      another line in the file. However, Vim doesn't think of this as being a
      jump. The reason for this is that a j and a k without a count are
      obviously not jumps.

      So now I'm wondering what my options are to navigate efficiently and be
      able to use the jumplist correctly at the same time?
      Some ideas:
      - - maybe I should simply use search a lot more? Just typing what I want
      to find is probably equally fast as looking at linenumbers, and
      searches are jumps
      - - Make use of H M L to jump 'near' the line I want and then use j / k?
      that would at least add some positions to the jumplist, but feels very
      inefficient also.
      - - stop using 'relativenumber' and use a count with the G command. This
      fixes the jumplist but then I would have to enter longer numbers in
      most cases and I loose the benefits of relativenumber (for deletions
      etc).
      - - remap j and k so that they would calculate the correct linenumber and
      use the G command instead, but only if the count is larger then 5 for
      example?

      Wouldn't it be possible to add a configuration option to Vim to make the
      jumplist recognize 'jumps' with j and k? For example 'minimumjumplines'
      which can be set to an int. When 0 the behaviour is as it is now; when
      set to a value greater than 0, it will add a position to the jumplist
      when using j and k to move the cursor up/down at least that number of
      lines (when not in operator pending mode)

      Thanks a lot for any suggestions!
      Jeroen
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v2.0.17 (GNU/Linux)

      iQIcBAEBCAAGBQJQ7u6xAAoJEBrqc/v4ufiMT3sQALLlrotfAwnzukTQVAJpingi
      x8cEWLxuCRAIEz6+UUDUW1Nz8lZRjF2s6r568g9rQbGUcmHgrrMynnkspO0SuFmb
      Fo7Sr4u5jSSsMKv5BymS2FoXLQ0aNDNUmoABosb0LiLxexmWe7Foj3FHAg+Lum7L
      CtQEpwKyQ0VaVMEUkSw2kHHswXu9kfvbttcAPcrCMY58c+pJFx07VRXwG4nYFLDP
      2tzZgUDds7KtOExC4uDGvU8mwM+qIdWYAUGAgjzkqpUMg9Wt5N7PNPPOh5N4d+i0
      sL55l4U3G4vt57FblpSKCMYMssg49fG/gx3y/IfdzQPqyJamxPdbF9NZ+fhMJA+U
      /8r1zWJgsjWWr84Qc1rU/16b8FYPM0ei65jE7oimWpCy9qthWihM3fvUsXpwmKHg
      sxZaiclhhP97oT/yH8a0cHsay7KE5RaI/0cjWLpoEhmeFPAxbUTP6G3HKl/u3ki7
      AE5F+klnX6YmqCZLx+gSW2qZhpubjKqmsoUxPT4E6VMtASXmLMv/1+hp/CURCcow
      qENpgmfL7JYEyuYuijo1N6EYiSYjuyUCfocioQWC+lSnWFWokdzml4vFsrzxfGbN
      xRCVeVAbWFhVVwbBQFnW4gigNN1V8u/E/H2ZTGn1fGa+2Em1a4ngmGu+BlMbm1ij
      KnOEap1GHf2kN5ukaFw0
      =Jzcq
      -----END PGP SIGNATURE-----

      --
      You received this message from the "vim_use" 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
    • Jeroen Budts
      ... Hash: SHA256 TL;DR: I often use j and k to jump to other lines (with relativenumber enabled). Is it possible to add those jumps to the
      Message 2 of 5 , Jan 11, 2013
        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA256

        TL;DR: I often use <count>j and <count>k to jump to other lines (with
        'relativenumber' enabled).
        Is it possible to add those jumps to the jumplist?
        And/or what are more efficient ways of jumping to lines which are
        visible on the screen?

        Thanks, and my excuses for my previous mail which was obviously too
        long :)
        Jeroen

        On 01/10/2013 05:39 PM, Jeroen Budts wrote:
        > Hi all,
        >
        > Although I have been using Vim now for over two years now as my
        > main text editor, I often still have the feeling that I'm not very
        > efficient in navigating through a file, more specifically through
        > the part of the file which is on my screen. Most of the time when
        > I can see the line where I want to jump to I will use a count
        > together with the j or k command. I use 'relativenumber', so I can
        > easily see the correct count. However, this still feels a little
        > inefficient, as my eyes first have to find the line I want to jump
        > to, then carefully (without loosing track of the line) look to the
        > left to find the correct number, then my fingers have to enter the
        > correct number and finally I can press j or k. So far the jumplist
        > has also always felt rather confusing to me. Yesterday I finally
        > discovered why: I think of the method how I move to specific lines
        > as being a 'jump', because in fact, the cursor jumps to another
        > line in the file. However, Vim doesn't think of this as being a
        > jump. The reason for this is that a j and a k without a count are
        > obviously not jumps.
        >
        > So now I'm wondering what my options are to navigate efficiently
        > and be able to use the jumplist correctly at the same time? Some
        > ideas: - maybe I should simply use search a lot more? Just typing
        > what I want to find is probably equally fast as looking at
        > linenumbers, and searches are jumps - Make use of H M L to jump
        > 'near' the line I want and then use j / k? that would at least add
        > some positions to the jumplist, but feels very inefficient also. -
        > stop using 'relativenumber' and use a count with the G command.
        > This fixes the jumplist but then I would have to enter longer
        > numbers in most cases and I loose the benefits of relativenumber
        > (for deletions etc). - remap j and k so that they would calculate
        > the correct linenumber and use the G command instead, but only if
        > the count is larger then 5 for example?
        >
        > Wouldn't it be possible to add a configuration option to Vim to
        > make the jumplist recognize 'jumps' with j and k? For example
        > 'minimumjumplines' which can be set to an int. When 0 the
        > behaviour is as it is now; when set to a value greater than 0, it
        > will add a position to the jumplist when using j and k to move the
        > cursor up/down at least that number of lines (when not in operator
        > pending mode)
        >
        > Thanks a lot for any suggestions! Jeroen
        >

        - --
        website: http://budts.be/ - twitter: @teranex
        ___________________________________
        Registered Linux User #482240 - GetFirefox.com - ubuntu.com

        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v2.0.17 (GNU/Linux)

        iQIcBAEBCAAGBQJQ79UsAAoJEBrqc/v4ufiMslgP/2vRsSUM6bKc2/v1WpBTjEia
        oYtYfbRReF+oCO0E4FCNGtU/mBLv5V1IAqLNO0DuhLmAW8E0clg4n3aBUK+YQ6Nx
        bvnvoPQ/eTLs8A2ZCtR2IVN+7elZZReF3dvQ/cMy6fDJu/lWnCHDzI1ig7hV6yas
        cNsPqFOBnx2Dx5ym9lpOYIGA5CCD3/rKZg0KMSxjXAYanKk/Gcmiy3vpsiPK+yj4
        DMGvj3nNHkRkmv9vrBvhDIp1+kUopU1eV6jSc/VgmVMq6wPerDp2RtB58+tfyCCU
        xDeaSPCtSey+wcSMBIo2MB7dJYN9q/fOXc09CRpdiu8z+x5LGUWfGzE1wXftJiCw
        m9et+vx2+8Dfkt5hQKTkO7irbVXFQgAfL4EZ4GnAirHxKwX1kQOHOdszLTafRdtt
        ul24JOs7Iy1ioNnH86sPRyhuEugGR4pgn3sGCzp8HyDrnU9IbuacU19zYe0utL6i
        1wtk9UHTD62KAw9xfb/5hVNoqPuYIsDiLWu/ANScNLq/4WRGGvmKILQNKDEsxRuM
        VvJcjCr1MFnYLG9IM3Y2wH0t72CHDvLm9EfkD2ebQi0QnqQj0K7CVy7BaKslTmxv
        U8QoJ+xJoeHwH9rYZ0xrijSWjOT5hpltuQ2FrIiaC5YrSTrL+OeceoWFYN90lbDA
        p0ng4QqlNlbpsYxEDa9X
        =ph3S
        -----END PGP SIGNATURE-----

        --
        You received this message from the "vim_use" 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
      • Ethan Hereth
        You might look into the Easymotion plugin. It makes motions on a window of text quite a bit quicker once you get the hang of it. I use it quite regularly. ...
        Message 3 of 5 , Jan 12, 2013
          You might look into the Easymotion plugin. It makes motions on a window of text quite a bit quicker once you get the hang of it. I use it quite regularly. 

          On Friday, January 11, 2013, Jeroen Budts wrote:
          -----BEGIN PGP SIGNED MESSAGE-----
          Hash: SHA256

          TL;DR: I often use <count>j and <count>k to jump to other lines (with
          'relativenumber' enabled).
          Is it possible to add those jumps to the jumplist?
          And/or what are more efficient ways of jumping to lines which are
          visible on the screen?

          Thanks, and my excuses for my previous mail which was obviously too
          long :)
          Jeroen

          On 01/10/2013 05:39 PM, Jeroen Budts wrote:
          > Hi all,
          >
          > Although I have been using Vim now for over two years now as my
          > main text editor, I often still have the feeling that I'm not very
          > efficient in navigating through a file, more specifically through
          > the part of the file which is on my screen. Most of the time when
          > I can see the line where I want to jump to I will use a count
          > together with the j or k command. I use 'relativenumber', so I can
          > easily see the correct count. However, this still feels a little
          > inefficient, as my eyes first have to find the line I want to jump
          > to, then carefully (without loosing track of the line) look to the
          > left to find the correct number, then my fingers have to enter the
          > correct number and finally I can press j or k. So far the jumplist
          > has also always felt rather confusing to me. Yesterday I finally
          > discovered why: I think of the method how I move to specific lines
          > as being a 'jump', because in fact, the cursor jumps to another
          > line in the file. However, Vim doesn't think of this as being a
          > jump. The reason for this is that a j and a k without a count are
          > obviously not jumps.
          >
          > So now I'm wondering what my options are to navigate efficiently
          > and be able to use the jumplist correctly at the same time? Some
          > ideas: - maybe I should simply use search a lot more? Just typing
          > what I want to find is probably equally fast as looking at
          > linenumbers, and searches are jumps - Make use of H M L to jump
          > 'near' the line I want and then use j / k? that would at least add
          > some positions to the jumplist, but feels very inefficient also. -
          > stop using 'relativenumber' and use a count with the G command.
          > This fixes the jumplist but then I would have to enter longer
          > numbers in most cases and I loose the benefits of relativenumber
          > (for deletions etc). - remap j and k so that they would calculate
          > the correct linenumber and use the G command instead, but only if
          > the count is larger then 5 for example?
          >
          > Wouldn't it be possible to add a configuration option to Vim to
          > make the jumplist recognize 'jumps' with j and k? For example
          > 'minimumjumplines' which can be set to an int. When 0 the
          > behaviour is as it is now; when set to a value greater than 0, it
          > will add a position to the jumplist when using j and k to move the
          > cursor up/down at least that number of lines (when not in operator
          > pending mode)
          >
          > Thanks a lot for any suggestions! Jeroen
          >

          - --
          website: http://budts.be/ - twitter: @teranex
          ___________________________________
          Registered Linux User #482240 - GetFirefox.com - ubuntu.com

          -----BEGIN PGP SIGNATURE-----
          Version: GnuPG v2.0.17 (GNU/Linux)

          iQIcBAEBCAAGBQJQ79UsAAoJEBrqc/v4ufiMslgP/2vRsSUM6bKc2/v1WpBTjEia
          oYtYfbRReF+oCO0E4FCNGtU/mBLv5V1IAqLNO0DuhLmAW8E0clg4n3aBUK+YQ6Nx
          bvnvoPQ/eTLs8A2ZCtR2IVN+7elZZReF3dvQ/cMy6fDJu/lWnCHDzI1ig7hV6yas
          cNsPqFOBnx2Dx5ym9lpOYIGA5CCD3/rKZg0KMSxjXAYanKk/Gcmiy3vpsiPK+yj4
          DMGvj3nNHkRkmv9vrBvhDIp1+kUopU1eV6jSc/VgmVMq6wPerDp2RtB58+tfyCCU
          xDeaSPCtSey+wcSMBIo2MB7dJYN9q/fOXc09CRpdiu8z+x5LGUWfGzE1wXftJiCw
          m9et+vx2+8Dfkt5hQKTkO7irbVXFQgAfL4EZ4GnAirHxKwX1kQOHOdszLTafRdtt
          ul24JOs7Iy1ioNnH86sPRyhuEugGR4pgn3sGCzp8HyDrnU9IbuacU19zYe0utL6i
          1wtk9UHTD62KAw9xfb/5hVNoqPuYIsDiLWu/ANScNLq/4WRGGvmKILQNKDEsxRuM
          VvJcjCr1MFnYLG9IM3Y2wH0t72CHDvLm9EfkD2ebQi0QnqQj0K7CVy7BaKslTmxv
          U8QoJ+xJoeHwH9rYZ0xrijSWjOT5hpltuQ2FrIiaC5YrSTrL+OeceoWFYN90lbDA
          p0ng4QqlNlbpsYxEDa9X
          =ph3S
          -----END PGP SIGNATURE-----

          --
          You received this message from the "vim_use" 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

          --
          You received this message from the "vim_use" 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
        • Jeroen Budts
          ... Hi Ethan! Thanks for you suggestion! I know the EasyMotion plugin and have tested it once in the past. While it is a really cool plugin, I m a bit
          Message 4 of 5 , Jan 12, 2013
            On 01/12/2013 08:15 PM, Ethan Hereth wrote:
            > You might look into the Easymotion plugin. It makes motions on a window
            > of text quite a bit quicker once you get the hang of it. I use it quite
            > regularly.
            Hi Ethan!
            Thanks for you suggestion! I know the EasyMotion plugin and have tested
            it once in the past. While it is a really cool plugin, I'm a bit
            reluctant to using plugins that significantly change the way how you use
            Vim, because I regularly use Vim on other servers where I don't have my
            own config. Once I would get used to such a plugin I guess I would feel
            rather uncomfortable on a server without those plugins.

            Jeroen
            >
            > On Friday, January 11, 2013, Jeroen Budts wrote:
            >
            > TL;DR: I often use <count>j and <count>k to jump to other lines (with
            > 'relativenumber' enabled).
            > Is it possible to add those jumps to the jumplist?
            > And/or what are more efficient ways of jumping to lines which are
            > visible on the screen?
            >
            > Thanks, and my excuses for my previous mail which was obviously too
            > long :)
            > Jeroen
            >
            > On 01/10/2013 05:39 PM, Jeroen Budts wrote:
            >> Hi all,
            >
            >> Although I have been using Vim now for over two years now as my
            >> main text editor, I often still have the feeling that I'm not very
            >> efficient in navigating through a file, more specifically through
            >> the part of the file which is on my screen. Most of the time when
            >> I can see the line where I want to jump to I will use a count
            >> together with the j or k command. I use 'relativenumber', so I can
            >> easily see the correct count. However, this still feels a little
            >> inefficient, as my eyes first have to find the line I want to jump
            >> to, then carefully (without loosing track of the line) look to the
            >> left to find the correct number, then my fingers have to enter the
            >> correct number and finally I can press j or k. So far the jumplist
            >> has also always felt rather confusing to me. Yesterday I finally
            >> discovered why: I think of the method how I move to specific lines
            >> as being a 'jump', because in fact, the cursor jumps to another
            >> line in the file. However, Vim doesn't think of this as being a
            >> jump. The reason for this is that a j and a k without a count are
            >> obviously not jumps.
            >
            >> So now I'm wondering what my options are to navigate efficiently
            >> and be able to use the jumplist correctly at the same time? Some
            >> ideas: - maybe I should simply use search a lot more? Just typing
            >> what I want to find is probably equally fast as looking at
            >> linenumbers, and searches are jumps - Make use of H M L to jump
            >> 'near' the line I want and then use j / k? that would at least add
            >> some positions to the jumplist, but feels very inefficient also. -
            >> stop using 'relativenumber' and use a count with the G command.
            >> This fixes the jumplist but then I would have to enter longer
            >> numbers in most cases and I loose the benefits of relativenumber
            >> (for deletions etc). - remap j and k so that they would calculate
            >> the correct linenumber and use the G command instead, but only if
            >> the count is larger then 5 for example?
            >
            >> Wouldn't it be possible to add a configuration option to Vim to
            >> make the jumplist recognize 'jumps' with j and k? For example
            >> 'minimumjumplines' which can be set to an int. When 0 the
            >> behaviour is as it is now; when set to a value greater than 0, it
            >> will add a position to the jumplist when using j and k to move the
            >> cursor up/down at least that number of lines (when not in operator
            >> pending mode)
            >
            >> Thanks a lot for any suggestions! Jeroen
            >
            >
            >
            > --
            > You received this message from the "vim_use" 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
            >
            > --
            > You received this message from the "vim_use" 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

            --
            website: http://budts.be/ - twitter: @teranex
            ___________________________________
            Registered Linux User #482240 - GetFirefox.com - ubuntu.com



            --
            You received this message from the "vim_use" 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
          • Jeroen Budts
            ... I wrote a small plugin jk-jumps to add j and k as jumps to the jumplist. I m not very good at vimscript so I m not sure if it has any
            Message 5 of 5 , Jan 12, 2013
              On 01/11/2013 10:02 AM, Jeroen Budts wrote:
              > TL;DR: I often use <count>j and <count>k to jump to other lines (with
              > 'relativenumber' enabled).
              > Is it possible to add those jumps to the jumplist?
              > And/or what are more efficient ways of jumping to lines which are
              > visible on the screen?
              >
              I wrote a small plugin 'jk-jumps' to add <count>j and <count>k as jumps
              to the jumplist. I'm not very good at vimscript so I'm not sure if it
              has any sideeffects, but it seems to work. The plugin can be found on
              vim.org: http://www.vim.org/scripts/script.php?script_id=4395

              While I should probably start using other commands to move efficiently,
              this at least already fixes the confusion with the jumplist when moving
              with <count>j / <count>k.

              Jeroen

              --
              website: http://budts.be/ - twitter: @teranex
              ___________________________________
              Registered Linux User #482240 - GetFirefox.com - ubuntu.com

              --
              You received this message from the "vim_use" 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.