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

Re: Cursor and Insert-Mode ( cursor is back-spacing ) ( version 7.3.382 )

Expand Messages
  • James McCoy
    ... Then don t do that? In all seriousness, though, this is due to the different cursor positions in normal vs. insert mode, which isn t displayed well in the
    Message 1 of 9 , Apr 2, 2012
    • 0 Attachment
      On Mon, Apr 02, 2012 at 05:45:41PM +0000, Bovy, Stephen wrote:
      > Every Time I switch IN and OUT-OF Insert-Mode ( THE-CURSOR ) moves (
      > BACK-WARDS ) ( ONE-POSITION )

      Then don't do that?

      In all seriousness, though, this is due to the different cursor
      positions in normal vs. insert mode, which isn't displayed well in the
      terminal.

      In normal mode, your cursor sits on top of characters as that it what
      normal mode operates on. In insert mode, your cursor sits between
      characters (and this is represented in gvim be a thin vertical cursor
      instead of a block cursor).

      So, when you leave insert mode, the cursor has to move from "between
      characters" to "on top of characters" and that happens by sitting on
      topo of the character to the left of where the cursor was in insert mode
      -- i.e. the last character that was insert/edited.

      If you want to toggle between insert and normal mode without the cursor
      moving, then enter insert mode by using "a" instead of "i". That will
      start insert mode after, instead of before, the cursor the character was
      resting on in normal mode. So, when you leave insert mode, your cursor
      will be back on the character it was before entering insert mode.

      --
      James
      GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>
    • Bovy, Stephen
      Hmm That means I need to change the key-bindings for the Insert-Key to use (a) instead of (i) ??? ... From: vim_dev@googlegroups.com
      Message 2 of 9 , Apr 2, 2012
      • 0 Attachment
        Hmm

        That means I need to change the key-bindings for the "Insert-Key" to use (a) instead of (i) ???

        -----Original Message-----
        From: vim_dev@... [mailto:vim_dev@...] On Behalf Of James McCoy
        Sent: Monday, April 02, 2012 5:23 PM
        To: vim_dev@...
        Subject: Re: Cursor and Insert-Mode ( cursor is back-spacing ) ( version 7.3.382 )

        On Mon, Apr 02, 2012 at 05:45:41PM +0000, Bovy, Stephen wrote:
        > Every Time I switch IN and OUT-OF Insert-Mode ( THE-CURSOR ) moves
        > ( BACK-WARDS ) ( ONE-POSITION )

        Then don't do that?

        In all seriousness, though, this is due to the different cursor positions in normal vs. insert mode, which isn't displayed well in the terminal.

        In normal mode, your cursor sits on top of characters as that it what normal mode operates on. In insert mode, your cursor sits between characters (and this is represented in gvim be a thin vertical cursor instead of a block cursor).

        So, when you leave insert mode, the cursor has to move from "between characters" to "on top of characters" and that happens by sitting on topo of the character to the left of where the cursor was in insert mode
        -- i.e. the last character that was insert/edited.

        If you want to toggle between insert and normal mode without the cursor moving, then enter insert mode by using "a" instead of "i". That will start insert mode after, instead of before, the cursor the character was resting on in normal mode. So, when you leave insert mode, your cursor will be back on the character it was before entering insert mode.

        --
        James
        GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>

        --
        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
      • Bovy, Stephen
        I guess observationally it does not make much sense And actually I kind-of disagree If you are on X You switch to Insert mode ( then you
        Message 3 of 9 , Apr 2, 2012
        • 0 Attachment
          I guess observationally it does not make much sense

          And actually I kind-of disagree If you are on X You switch to Insert mode ( then you insert some blanks )

          When you switch out of insert mode you should still be on X

          The insert mode "caret" indicates where the insertion takes place not the character the "cursor" is on (which has not changed)
          So when you switch out of insert mode the cursor should still be on the same character ( not the previous character)

          -----Original Message-----
          From: vim_dev@... [mailto:vim_dev@...] On Behalf Of James McCoy
          Sent: Monday, April 02, 2012 5:23 PM
          To: vim_dev@...
          Subject: Re: Cursor and Insert-Mode ( cursor is back-spacing ) ( version 7.3.382 )

          On Mon, Apr 02, 2012 at 05:45:41PM +0000, Bovy, Stephen wrote:
          > Every Time I switch IN and OUT-OF Insert-Mode ( THE-CURSOR ) moves
          > ( BACK-WARDS ) ( ONE-POSITION )

          Then don't do that?

          In all seriousness, though, this is due to the different cursor positions in normal vs. insert mode, which isn't displayed well in the terminal.

          In normal mode, your cursor sits on top of characters as that it what normal mode operates on. In insert mode, your cursor sits between characters (and this is represented in gvim be a thin vertical cursor instead of a block cursor).

          So, when you leave insert mode, the cursor has to move from "between characters" to "on top of characters" and that happens by sitting on topo of the character to the left of where the cursor was in insert mode
          -- i.e. the last character that was insert/edited.

          If you want to toggle between insert and normal mode without the cursor moving, then enter insert mode by using "a" instead of "i". That will start insert mode after, instead of before, the cursor the character was resting on in normal mode. So, when you leave insert mode, your cursor will be back on the character it was before entering insert mode.

          --
          James
          GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>

          --
          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
          ... That depends on *why* you are entering insert mode. If you want to start editing after the character the cursor is on, then use a , otherwise use i . --
          Message 4 of 9 , Apr 3, 2012
          • 0 Attachment
            On Tue, Apr 03, 2012 at 01:06:20AM +0000, Bovy, Stephen wrote:
            > Hmm
            >
            > That means I need to change the key-bindings for the "Insert-Key" to use (a) instead of (i) ???

            That depends on *why* you are entering insert mode. If you want to
            start editing after the character the cursor is on, then use "a",
            otherwise use "i".

            --
            James
            GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>
          • Ben Fritz
            ... Are you using i in a mapping to switch to insert mode? If so, what is your mapping? Give us the full and exact command you use to set up the mapping,
            Message 5 of 9 , Apr 3, 2012
            • 0 Attachment
              On Monday, April 2, 2012 8:06:20 PM UTC-5, Bovy, Stephen wrote:
              > Hmm
              >
              > That means I need to change the key-bindings for the "Insert-Key" to use (a) instead of (i) ???
              >

              Are you using 'i' in a mapping to switch to insert mode? If so, what is your mapping? Give us the full and exact command you use to set up the mapping, containing both the left and right hand side of the mapping; there may be a better way to accomplish what you're trying to do. Without seeing the mapping, I'd say "maybe" you'll need to change 'i' to 'a' within the mapping.

              If you're not talking about a mapping, then no, you need not change any key bindings. You just need to train yourself to use a different command to enter insert mode depending on what you are trying to do. There are many ways to enter insert mode. See :help inserting and :help replacing for the list.

              --
              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
            • Ben Fritz
              ... This is not, and never has been, how Vim or vi works. Vim, like vi, has only one cursor position. The caret in insert mode is in fact this One and Only
              Message 6 of 9 , Apr 3, 2012
              • 0 Attachment
                On Monday, April 2, 2012 8:26:14 PM UTC-5, Bovy, Stephen wrote:
                > I guess observationally it does not make much sense
                >
                > And actually I kind-of disagree If you are on X You switch to Insert mode ( then you insert some blanks )
                >
                > When you switch out of insert mode you should still be on X
                >
                > The insert mode "caret" indicates where the insertion takes place not the character the "cursor" is on (which has not changed)
                > So when you switch out of insert mode the cursor should still be on the same character ( not the previous character)
                >

                This is not, and never has been, how Vim or vi works. Vim, like vi, has only one cursor position. The "caret" in insert mode is in fact this One and Only Cursor. Vim does not track two separate cursor locations, and in fact doing so would break expectations even more. If you're in insert mode and use the arrow keys to move the cursor up 357 lines, then leave insert mode, would you really expect Vim to jump 357 lines down to where you entered insert mode?

                Regardless of how it should conceptually act, Vim and vi have ALWAYS acted the way they have now, with i<Esc>i<Esc>i<Esc> moving the cursor to the left. Doing otherwise would break many scripts and mappings which assume the cursor will always end up on the last character typed in insert mode (or it will move one character to the left from the point where insert mode was ended, in the general case where no text was inserted or the cursor was moved inside insert mode). In other words, changing i<Esc> to not move the cursor would be a major interface change. Changing Vim to track two separate cursor positions (one for insert mode and one for normal mode) would be an even bigger one.

                If you really want to always jump back to the position at which you entered insert mode in a general case, you could try setting a mark in an InsertEnter autocmd and jumping back to the mark on InsertLeave. If you're having a problem with a specific mapping, tweaks to the mapping to use a different insert mode entry or avoid leaving insert mode altogether can probably fix it. If you just don't like that i<Esc> does something you don't expect, change your expectations or use a different insert mode entry command.

                --
                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
              • Bovy, Stephen
                Thank you for the explanation :) ... From: vim_dev@googlegroups.com [mailto:vim_dev@googlegroups.com] On Behalf Of Ben Fritz Sent: Tuesday, April 03, 2012
                Message 7 of 9 , Apr 3, 2012
                • 0 Attachment
                  Thank you for the explanation :)


                  -----Original Message-----
                  From: vim_dev@... [mailto:vim_dev@...] On Behalf Of Ben Fritz
                  Sent: Tuesday, April 03, 2012 8:56 AM
                  To: vim_dev@...
                  Subject: Re: Cursor and Insert-Mode ( cursor is back-spacing ) ( version 7.3.382 )

                  On Monday, April 2, 2012 8:26:14 PM UTC-5, Bovy, Stephen wrote:
                  > I guess observationally it does not make much sense
                  >
                  > And actually I kind-of disagree If you are on X You switch to Insert mode ( then you insert some blanks )
                  >
                  > When you switch out of insert mode you should still be on X
                  >
                  > The insert mode "caret" indicates where the insertion takes place not
                  > the character the "cursor" is on (which has not changed) So when you
                  > switch out of insert mode the cursor should still be on the same
                  > character ( not the previous character)
                  >

                  This is not, and never has been, how Vim or vi works. Vim, like vi, has only one cursor position. The "caret" in insert mode is in fact this One and Only Cursor. Vim does not track two separate cursor locations, and in fact doing so would break expectations even more. If you're in insert mode and use the arrow keys to move the cursor up 357 lines, then leave insert mode, would you really expect Vim to jump 357 lines down to where you entered insert mode?

                  Regardless of how it should conceptually act, Vim and vi have ALWAYS acted the way they have now, with i<Esc>i<Esc>i<Esc> moving the cursor to the left. Doing otherwise would break many scripts and mappings which assume the cursor will always end up on the last character typed in insert mode (or it will move one character to the left from the point where insert mode was ended, in the general case where no text was inserted or the cursor was moved inside insert mode). In other words, changing i<Esc> to not move the cursor would be a major interface change. Changing Vim to track two separate cursor positions (one for insert mode and one for normal mode) would be an even bigger one.

                  If you really want to always jump back to the position at which you entered insert mode in a general case, you could try setting a mark in an InsertEnter autocmd and jumping back to the mark on InsertLeave. If you're having a problem with a specific mapping, tweaks to the mapping to use a different insert mode entry or avoid leaving insert mode altogether can probably fix it. If you just don't like that i<Esc> does something you don't expect, change your expectations or use a different insert mode entry command.

                  --
                  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

                  --
                  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
                • Bee
                  ... Bill -- 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,
                  Message 8 of 9 , Apr 3, 2012
                  • 0 Attachment
                    On Apr 2, 10:45 am, "Bovy, Stephen" <Stephen.B...@...> wrote:
                    > Every Time I switch  IN and OUT-OF  Insert-Mode  ( THE-CURSOR ) moves ( BACK-WARDS )  ( ONE-POSITION )

                    :help gi

                    Bill

                    --
                    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.