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

Re: "ce" deletes two words if the current one is 1-letter long?

Expand Messages
  • Benjamin Fritz
    ... The problem with this would be that e needs to be able to move from word to word. If it stays in place when the cursor is on a 1-letter word, the cursor
    Message 1 of 10 , Jun 3, 2008
      On 6/3/08, François Ingelrest <athropos@...> wrote:
      >
      > Hi all,
      >
      > I frequently use "ce" to replace the current word, so I go to the the
      > beginning of that word and type "ce". I've noticed that when the
      > current word is 1-letter long, the following word gets deleted too.
      > For instance, if I place the cursor on the 'a' of "an objective" and
      > type "ce", I replace only "an". If I do the same thing with "a
      > server", I replace both words.
      >
      > Is that really the intended behavior? Shouldn't "changing until the
      > end of the current word" stop at the current cursor position if that
      > current word is 1-letter long?
      >

      The problem with this would be that 'e' needs to be able to move from
      word to word. If it stays in place when the cursor is on a 1-letter
      word, the cursor would be "stuck" on that word, unable to progress to
      the next with a subsequent keypress. Note, for changing a
      single-letter word, you can train yourself to use the "s" command
      instead, which is a synonym for "cl".

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • François Ingelrest
      On Tue, Jun 3, 2008 at 5:51 PM, Benjamin Fritz wrote: On 6/3/08, François Ingelrest wrote: Hi all,
      Message 2 of 10 , Jun 3, 2008
        On Tue, Jun 3, 2008 at 5:51 PM, Benjamin Fritz <fritzophrenic@...> wrote:
        > On 6/3/08, François Ingelrest <athropos@...> wrote:
        >> Hi all,
        >>
        >> I frequently use "ce" to replace the current word, so I go to the the
        >> beginning of that word and type "ce". I've noticed that when the
        >> current word is 1-letter long, the following word gets deleted too.
        >> For instance, if I place the cursor on the 'a' of "an objective" and
        >> type "ce", I replace only "an". If I do the same thing with "a
        >> server", I replace both words.
        >>
        >> Is that really the intended behavior? Shouldn't "changing until the
        >> end of the current word" stop at the current cursor position if that
        >> current word is 1-letter long?
        >
        > The problem with this would be that 'e' needs to be able to move from
        > word to word. If it stays in place when the cursor is on a 1-letter
        > word, the cursor would be "stuck" on that word, unable to progress to
        > the next with a subsequent keypress. Note, for changing a
        > single-letter word, you can train yourself to use the "s" command
        > instead, which is a synonym for "cl".

        While I understand your argument about jumping through words, it seems
        quite strange to me that I need to take care of whether the current
        word has multiple letters or not. Of course I can get used to "s", but
        it's just strange that I need to take care of that. Maybe I can remap
        "ce" to use either "ce" or "s" based on the length of the current
        word?

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Benjamin Fritz
        ... Actually, an alternate idea that has proved infinitely more useful to me: Use text-objects. Instead of ce try using ciw which will work on words of all
        Message 3 of 10 , Jun 3, 2008
          On 6/3/08, François Ingelrest <athropos@...> wrote:
          > On Tue, Jun 3, 2008 at 5:51 PM, Benjamin Fritz <fritzophrenic@...> wrote:
          > > On 6/3/08, François Ingelrest <athropos@...> wrote:
          > >> Hi all,
          > >>
          > >> I frequently use "ce" to replace the current word, so I go to the the
          > >> beginning of that word and type "ce". I've noticed that when the
          > >> current word is 1-letter long, the following word gets deleted too.
          > >> For instance, if I place the cursor on the 'a' of "an objective" and
          > >> type "ce", I replace only "an". If I do the same thing with "a
          > >> server", I replace both words.
          > >>
          > >> Is that really the intended behavior? Shouldn't "changing until the
          > >> end of the current word" stop at the current cursor position if that
          > >> current word is 1-letter long?
          > >
          > > The problem with this would be that 'e' needs to be able to move from
          > > word to word. If it stays in place when the cursor is on a 1-letter
          > > word, the cursor would be "stuck" on that word, unable to progress to
          > > the next with a subsequent keypress. Note, for changing a
          > > single-letter word, you can train yourself to use the "s" command
          > > instead, which is a synonym for "cl".
          >
          >
          > While I understand your argument about jumping through words, it seems
          > quite strange to me that I need to take care of whether the current
          > word has multiple letters or not. Of course I can get used to "s", but
          > it's just strange that I need to take care of that. Maybe I can remap
          > "ce" to use either "ce" or "s" based on the length of the current
          > word?
          >

          Actually, an alternate idea that has proved infinitely more useful to me:

          Use text-objects. Instead of "ce" try using "ciw" which will work on
          words of all lengths and is (I have found) usually what I want to do
          anyway.

          See :help text-objects and :help iw

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Benjamin Fritz
          ... In addition, text-objects can be used with the cursor _anywhere_ within the word, instead of requiring you to place the cursor at the beginning of the
          Message 4 of 10 , Jun 3, 2008
            On 6/3/08, Benjamin Fritz <fritzophrenic@...> wrote:
            > On 6/3/08, François Ingelrest <athropos@...> wrote:
            > > On Tue, Jun 3, 2008 at 5:51 PM, Benjamin Fritz <fritzophrenic@...> wrote:
            > > > On 6/3/08, François Ingelrest <athropos@...> wrote:
            > > >> Hi all,
            > > >>
            > > >> I frequently use "ce" to replace the current word, so I go to the the
            > > >> beginning of that word and type "ce". I've noticed that when the
            > > >> current word is 1-letter long, the following word gets deleted too.
            > > >> For instance, if I place the cursor on the 'a' of "an objective" and
            > > >> type "ce", I replace only "an". If I do the same thing with "a
            > > >> server", I replace both words.
            > > >>
            > > >> Is that really the intended behavior? Shouldn't "changing until the
            > > >> end of the current word" stop at the current cursor position if that
            > > >> current word is 1-letter long?
            > > >
            > > > The problem with this would be that 'e' needs to be able to move from
            > > > word to word. If it stays in place when the cursor is on a 1-letter
            > > > word, the cursor would be "stuck" on that word, unable to progress to
            > > > the next with a subsequent keypress. Note, for changing a
            > > > single-letter word, you can train yourself to use the "s" command
            > > > instead, which is a synonym for "cl".
            > >
            > >
            > > While I understand your argument about jumping through words, it seems
            > > quite strange to me that I need to take care of whether the current
            > > word has multiple letters or not. Of course I can get used to "s", but
            > > it's just strange that I need to take care of that. Maybe I can remap
            > > "ce" to use either "ce" or "s" based on the length of the current
            > > word?
            > >
            >
            >
            > Actually, an alternate idea that has proved infinitely more useful to me:
            >
            > Use text-objects. Instead of "ce" try using "ciw" which will work on
            > words of all lengths and is (I have found) usually what I want to do
            > anyway.
            >
            > See :help text-objects and :help iw
            >

            In addition, text-objects can be used with the cursor _anywhere_
            within the word, instead of requiring you to place the cursor at the
            beginning of the word.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Charles E Campbell Jr
            ... Its a philosophy thing, IMHO. I think you re thinking of ce as a command; ce is not a command. c is. e is a motion. The combination ce may be
            Message 5 of 10 , Jun 3, 2008
              François Ingelrest wrote:
              > While I understand your argument about jumping through words, it seems
              > quite strange to me that I need to take care of whether the current
              > word has multiple letters or not. Of course I can get used to "s", but
              > it's just strange that I need to take care of that. Maybe I can remap
              > "ce" to use either "ce" or "s" based on the length of the current
              > word?
              >
              Its a philosophy thing, IMHO. I think you're thinking of "ce" as a
              command; "ce" is not a command. "c" is. "e" is a motion. The
              combination "ce" may be interpreted to mean: "change from here to
              wherever the "e" motion takes the cursor".

              Regards,
              Chip Campbell


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Gary Johnson
              ... The problem is your misunderstanding of the meaning of e . It does not mean go to the end of the word. It means go forward to the next end of a
              Message 6 of 10 , Jun 3, 2008
                On 2008-06-03, Franois Ingelrest <athropos@...> wrote:
                > On Tue, Jun 3, 2008 at 5:51 PM, Benjamin Fritz <fritzophrenic@...> wrote:
                > > On 6/3/08, François Ingelrest <athropos@...> wrote:
                > >> Hi all,
                > >>
                > >> I frequently use "ce" to replace the current word, so I go to the the
                > >> beginning of that word and type "ce". I've noticed that when the
                > >> current word is 1-letter long, the following word gets deleted too.
                > >> For instance, if I place the cursor on the 'a' of "an objective" and
                > >> type "ce", I replace only "an". If I do the same thing with "a
                > >> server", I replace both words.
                > >>
                > >> Is that really the intended behavior? Shouldn't "changing until the
                > >> end of the current word" stop at the current cursor position if that
                > >> current word is 1-letter long?
                > >
                > > The problem with this would be that 'e' needs to be able to move from
                > > word to word. If it stays in place when the cursor is on a 1-letter
                > > word, the cursor would be "stuck" on that word, unable to progress to
                > > the next with a subsequent keypress. Note, for changing a
                > > single-letter word, you can train yourself to use the "s" command
                > > instead, which is a synonym for "cl".
                >
                > While I understand your argument about jumping through words, it seems
                > quite strange to me that I need to take care of whether the current
                > word has multiple letters or not. Of course I can get used to "s", but
                > it's just strange that I need to take care of that. Maybe I can remap
                > "ce" to use either "ce" or "s" based on the length of the current
                > word?

                The problem is your misunderstanding of the meaning of 'e'. It does
                not mean "go to the end of the word." It means "go forward to the
                next end of a word." You have assumed a meaning from your
                experience with e's behavior when your cursor is at the start of a
                multi-letter word. That assumption was reasonable in that context,
                but it was incorrect.

                You may find it useful to use 'cw' in place of your current use of
                'ce'. 'cw' should behave consistently and always change from the
                cursor to the end of the current word. See

                :help w
                :help iw

                'ciw' will change the entire current word even when the cursor is
                not at the start of the word.

                Regards,
                Gary


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • François Ingelrest
                ... Thanks, I wasn t aware of that. That s what is nice with Vim, you always learn something new :) ... Once again something new :) I actually never tried cw
                Message 7 of 10 , Jun 3, 2008
                  On Tue, Jun 3, 2008 at 6:30 PM, Benjamin Fritz <fritzophrenic@...> wrote:
                  > Actually, an alternate idea that has proved infinitely more useful to me:
                  >
                  > Use text-objects. Instead of "ce" try using "ciw" which will work on
                  > words of all lengths and is (I have found) usually what I want to do
                  > anyway.
                  >
                  > See :help text-objects and :help iw

                  Thanks, I wasn't aware of that. That's what is nice with Vim, you
                  always learn something new :)

                  On Tue, Jun 3, 2008 at 6:43 PM, Gary Johnson <garyjohn@...> wrote:
                  > You may find it useful to use 'cw' in place of your current use of
                  > 'ce'. 'cw' should behave consistently and always change from the
                  > cursor to the end of the current word. See

                  Once again something new :)
                  I actually never tried "cw" since I would have thought it would have
                  eaten the space as well.

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • John Little
                  ... cw is a special case, inherited from vi. It breaks the usual operator - motion separation. Note that :help cw explains the special case, but is
                  Message 8 of 10 , Jun 3, 2008
                    On Jun 4, 6:22 am, "François Ingelrest" <athro...@...> wrote:
                    > I actually never tried "cw" since I would have thought it would have
                    > eaten the space as well.

                    "cw" is a special case, inherited from vi. It breaks the usual
                    operator - motion separation. Note that :help cw explains the special
                    case, but is inaccurate in your extra-special case, in that it says cw
                    works the same as ce; for one character words, cw does what you want,
                    not ce.

                    It's worth learning the "s" though, especially in code. I used vi for
                    years before discovering "s", then found myself using it to save a
                    keystroke very often, often with a count.

                    HTH, John

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Ben Schmidt
                    ... Hehe. I had never realised that cw behaves consistently in this fashion, but it is very nice. I will be using it, as I had the same problem with e and
                    Message 9 of 10 , Jun 3, 2008
                      > The problem is your misunderstanding of the meaning of 'e'. It does
                      > not mean "go to the end of the word." It means "go forward to the
                      > next end of a word." You have assumed a meaning from your
                      > experience with e's behavior when your cursor is at the start of a
                      > multi-letter word. That assumption was reasonable in that context,
                      > but it was incorrect.
                      >
                      > You may find it useful to use 'cw' in place of your current use of
                      > 'ce'. 'cw' should behave consistently and always change from the
                      > cursor to the end of the current word. See
                      >
                      > :help w
                      > :help iw

                      Hehe. I had never realised that 'cw' behaves consistently in this fashion, but it
                      is very nice. I will be using it, as I had the same problem with 'e' and none of
                      the other solutions work for me: I usually use 'ce' or 'de' once and then '.' a
                      whole stack of times, so substituting 's' when I come to a single letter word is
                      not an option, nor are text objects as I am often changing or removing word tails
                      or suffixes.

                      Pity it's completely inconsistent with the usual motion of 'w', and with 'w' with
                      other operators, though. That was the assumption I made: that 'cw' would change
                      the same text that 'dw' deleted. Wrong!

                      Grins,

                      Ben.




                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    Your message has been successfully submitted and would be delivered to recipients shortly.