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

starting position of cursor

Expand Messages
  • tooth pik
    group: when I start vim on an existing text module I kind of expect it to have the cursor in the 1st column of the first line, but some setting is causing it
    Message 1 of 7 , Sep 1, 2014
    • 0 Attachment
      group:

      when I start vim on an existing text module I kind of expect it to have
      the cursor in the 1st column of the first line, but some setting is
      causing it to start with the cursor on the first non-blank column of the
      first line

      I don't have any cute tricks imported from vimrc_example.vim, it does
      this when I start vim with -u NONE, and I don't know what setting is
      causing this

      any help getting it to start with the cursor in column 1 line 1 will be
      appreciated

      to demonstrate, open a module that has "2014" on line 1, starting in
      column 47 (with 46 blanks in front of it, and lots of text below it) --
      for me, that's where the cursor is (column 47), and when I scroll down
      (using j) I expect to see the cursor on the left, but it's over in
      column 47 where it started, contrary to my expectations

      am I suffering a brain flatulation? if so, please be kind...

      --
      _|_ _ __|_|_ ._ o|
      |_(_)(_)|_| ||_)||<
      |

      --
      --
      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 because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Tim Chase
      ... Strange. Normally I d expect that setting sol / nosol would impact this behavior. However, based on my testing, it doesn t seem to. ... Well, a
      Message 2 of 7 , Sep 2, 2014
      • 0 Attachment
        > when I start vim on an existing text module I kind of expect it to
        > have the cursor in the 1st column of the first line, but some
        > setting is causing it to start with the cursor on the first
        > non-blank column of the first line

        Strange. Normally I'd expect that setting 'sol'/'nosol' would impact
        this behavior. However, based on my testing, it doesn't seem to.

        > any help getting it to start with the cursor in column 1 line 1
        > will be appreciated

        Well, a workaround that feels a little dirty to me:

        augroup StartOfLine
        autocmd StartOfLine BufRead * normal 0
        augroup END

        It seems to do what you want.

        -tim




        --
        --
        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 because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • tooth pik
        ... yes, that does it, but should that be necessary? Is this a ... dare I say it ... bug? -- _|_ _ __|_|_ ._ o| ... -- -- You received this message from the
        Message 3 of 7 , Sep 2, 2014
        • 0 Attachment
          On Tue, Sep 02, 2014 at 05:26:52AM -0500, Tim Chase wrote:
          > > when I start vim on an existing text module I kind of expect it to
          > > have the cursor in the 1st column of the first line, but some
          > > setting is causing it to start with the cursor on the first
          > > non-blank column of the first line

          > Strange. Normally I'd expect that setting 'sol'/'nosol' would impact
          > this behavior. However, based on my testing, it doesn't seem to.

          > > any help getting it to start with the cursor in column 1 line 1
          > > will be appreciated

          > Well, a workaround that feels a little dirty to me:

          > augroup StartOfLine
          > autocmd StartOfLine BufRead * normal 0
          > augroup END

          > It seems to do what you want.

          yes, that does it, but should that be necessary? Is this a ...
          dare I say it ... bug?

          --
          _|_ _ __|_|_ ._ o|
          |_(_)(_)|_| ||_)||<
          |

          --
          --
          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 because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Tim Chase
          ... The documentation for sol does mention buffer changing commands which could ambiguously be interpreted to mean that it should take effect when a file
          Message 4 of 7 , Sep 2, 2014
          • 0 Attachment
            On 2014-09-02 09:13, tooth pik wrote:
            > > Strange. Normally I'd expect that setting 'sol'/'nosol' would
            > > impact this behavior. However, based on my testing, it doesn't
            > > seem to.
            >
            > > augroup StartOfLine
            > > autocmd StartOfLine BufRead * normal 0
            > > augroup END
            >
            > > It seems to do what you want.
            >
            > yes, that does it, but should that be necessary? Is this a ...
            > dare I say it ... bug?

            The documentation for 'sol' does mention "buffer changing commands" which
            could ambiguously be interpreted to mean that it should take
            effect when a file is opened for the first time (after all, it's
            changing from no-loaded-buffer to a now-loaded-buffer). I'm not sure
            I'd go so far as to call it a bug, but perhaps an unfortunate
            inconsistency or documentation ambiguity.

            And I suspect that anybody who flies with 'nosol' set would be irked
            by the behavior much as you mention.

            -tim



            --
            --
            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 because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Christian Brabandt
            Hi Tim! ... I am not sure I follow. What exactly would you call a bug here? I have set nosol in my .vimrc for years and haven t noticed any wrong behaviour.
            Message 5 of 7 , Sep 2, 2014
            • 0 Attachment
              Hi Tim!

              On Di, 02 Sep 2014, Tim Chase wrote:

              > The documentation for 'sol' does mention "buffer changing commands" which
              > could ambiguously be interpreted to mean that it should take
              > effect when a file is opened for the first time (after all, it's
              > changing from no-loaded-buffer to a now-loaded-buffer). I'm not sure
              > I'd go so far as to call it a bug, but perhaps an unfortunate
              > inconsistency or documentation ambiguity.
              >
              > And I suspect that anybody who flies with 'nosol' set would be irked
              > by the behavior much as you mention.

              I am not sure I follow. What exactly would you call a bug here?

              I have set 'nosol' in my .vimrc for years and haven't noticed any wrong
              behaviour.

              Best,
              Christian
              --
              Leitfaden durch die Phraseologie wissenschaftlicher Veröffentlichungen:
              Englisch:
              Our results confirm and extend previous conclusions that
              Deutsch:
              Wir fanden nichts Neues

              --
              --
              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 because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Tim Chase
              ... To reproduce the OP s issue: 1) create a new file with leading whitespace: $ echo x space at the beginning of this line example.txt $ vim -u
              Message 6 of 7 , Sep 2, 2014
              • 0 Attachment
                On 2014-09-02 20:55, Christian Brabandt wrote:
                > On Di, 02 Sep 2014, Tim Chase wrote:
                > > The documentation for 'sol' does mention "buffer changing
                > > commands" which could ambiguously be interpreted to mean that it
                > > should take effect when a file is opened for the first time
                > > (after all, it's changing from no-loaded-buffer to a
                > > now-loaded-buffer). I'm not sure I'd go so far as to call it a
                > > bug, but perhaps an unfortunate inconsistency or documentation
                > > ambiguity.
                > >
                > > And I suspect that anybody who flies with 'nosol' set would be
                > > irked by the behavior much as you mention.
                >
                > I am not sure I follow. What exactly would you call a bug here?
                >
                > I have set 'nosol' in my .vimrc for years and haven't noticed any
                > wrong behaviour.

                To reproduce the OP's issue:

                1) create a new file with leading whitespace:

                $ echo " x space at the beginning of this line" > example.txt
                $ vim -u NONE example.txt

                2) notice that the cursor opens on the first non-whitespace character
                (the "x") with a bunch of whitespace to the left of the cursor.
                Cool, whatever.

                3) create a "nosol" vimrc and try using that:

                $ echo "set nocp nosol" > nosol.vim
                $ vim -u nosol.vim example.txt

                4) notice that the cursor still lands on the first non-whitespace
                character rather than in column 0 (or 1 depending on how you count).

                My "vim intuition" tells me that in example #4 with 'nosol' set, the
                cursor *shouldn't* move to the first non-whitespace. I'm not exactly
                sure it's a *bug*, but it does run against that intuition and the
                documentation doesn't speak clearly one way or the other regarding
                the intended behavior in this situation. The documentation for 'sol'
                does describe that the cursor should be kept in the same column when
                using "buffer changing commands (CTRL-^, :bnext, bNext, etc.)".

                Additionally, in ":help editing.txt", under the argument-list section
                (with most of the buffer-manipulation commands such as ":wn",
                ":args", ":n", etc), the help says that

                """
                If no [+cmd] argument is present, the cursor is positioned at the
                last known cursor position for the file. If 'startofline' is set,
                the cursor will be positioned at the first non-blank in the line,
                otherwise the last know column is used. If there is no last known
                cursor position the cursor will be in the first line (the last line
                in Ex mode).
                """

                which hints that 'nosol' will *not* position the cursor on the
                first non-blank in the line. It may not explicitly say so, but it
                does does waggle its eyebrows suggestively and gesture
                furtively[1]. ;-)

                -tim


                [1] alluding to http://xkcd.com/552/ hover-text







                .

                --
                --
                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 because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • tooth pik
                ... implying it is not a bug and I must live with the autocommand thx tim -- _|_ _ __|_|_ ._ o| ... -- -- You received this message from the vim_use
                Message 7 of 7 , Sep 2, 2014
                • 0 Attachment
                  On Tue, Sep 02, 2014 at 02:52:30PM -0500, Tim Chase wrote:
                  > On 2014-09-02 20:55, Christian Brabandt wrote:
                  > > On Di, 02 Sep 2014, Tim Chase wrote:
                  > > > The documentation for 'sol' does mention "buffer changing
                  > > > commands" which could ambiguously be interpreted to mean that it
                  > > > should take effect when a file is opened for the first time
                  > > > (after all, it's changing from no-loaded-buffer to a
                  > > > now-loaded-buffer). I'm not sure I'd go so far as to call it a
                  > > > bug, but perhaps an unfortunate inconsistency or documentation
                  > > > ambiguity.
                  > > >
                  > > > And I suspect that anybody who flies with 'nosol' set would be
                  > > > irked by the behavior much as you mention.
                  > >
                  > > I am not sure I follow. What exactly would you call a bug here?
                  > >
                  > > I have set 'nosol' in my .vimrc for years and haven't noticed any
                  > > wrong behaviour.

                  > To reproduce the OP's issue:

                  > 1) create a new file with leading whitespace:

                  > $ echo " x space at the beginning of this line" > example.txt
                  > $ vim -u NONE example.txt

                  > 2) notice that the cursor opens on the first non-whitespace character
                  > (the "x") with a bunch of whitespace to the left of the cursor.
                  > Cool, whatever.

                  > 3) create a "nosol" vimrc and try using that:

                  > $ echo "set nocp nosol" > nosol.vim
                  > $ vim -u nosol.vim example.txt

                  > 4) notice that the cursor still lands on the first non-whitespace
                  > character rather than in column 0 (or 1 depending on how you count).

                  > My "vim intuition" tells me that in example #4 with 'nosol' set, the
                  > cursor *shouldn't* move to the first non-whitespace. I'm not exactly
                  > sure it's a *bug*, but it does run against that intuition and the
                  > documentation doesn't speak clearly one way or the other regarding
                  > the intended behavior in this situation. The documentation for 'sol'
                  > does describe that the cursor should be kept in the same column when
                  > using "buffer changing commands (CTRL-^, :bnext, bNext, etc.)".

                  > Additionally, in ":help editing.txt", under the argument-list section
                  > (with most of the buffer-manipulation commands such as ":wn",
                  > ":args", ":n", etc), the help says that

                  > """
                  > If no [+cmd] argument is present, the cursor is positioned at the
                  > last known cursor position for the file. If 'startofline' is set,
                  > the cursor will be positioned at the first non-blank in the line,
                  > otherwise the last know column is used. If there is no last known
                  > cursor position the cursor will be in the first line (the last line
                  > in Ex mode).
                  > """

                  > which hints that 'nosol' will *not* position the cursor on the
                  > first non-blank in the line. It may not explicitly say so, but it
                  > does does waggle its eyebrows suggestively and gesture
                  > furtively[1]. ;-)

                  implying it is not a bug and I must live with the autocommand

                  thx tim

                  --
                  _|_ _ __|_|_ ._ o|
                  |_(_)(_)|_| ||_)||<
                  |

                  --
                  --
                  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 because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                Your message has been successfully submitted and would be delivered to recipients shortly.