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

68597Re: Behaviour of :normal in operator-pending mode is not defined

Expand Messages
  • Ben Fritz
    Mar 7, 2013
    • 0 Attachment
      On Wednesday, March 6, 2013 4:43:56 PM UTC-6, glts wrote:
      > While investigating an item on the todo list, I found out that the
      >
      > behaviour of :normal[!] in operator-pending mode is not well-defined: it
      >
      > is not documented and is not taken special care of in the source.
      >
      >
      >
      > Consider the following text with the cursor on the first "m":
      >
      >
      >
      > summer
      >
      > ^
      >
      >
      >
      > Then consider these commands and the results:
      >
      >
      >
      > gUe suMMER
      >
      > :norm! gUe<CR> suMMER
      >
      > gU:norm! e<CR> suMMEr
      >

      I'm not sure if this is documented (I couldn't find it mentioned explicitly) but if I recall correctly, any : command in operator-pending mode acts as an exclusive motion. You can force it to be inclusive using v before the : in your command. See:

      :help inclusive
      :help o_v

      >
      > gUiw SUMMER
      > :norm! gUiw<CR> SUMMER
      > gU:norm! iw<CR> suwmmer
      >
      > For gU as for all operators the behaviour is strange and inconsistent.
      >

      I don't see anything wrong here. From normal mode, "iw" does not mean "select the inner word", it means "insert a w character". In operator-pending mode you're just trying to move the cursor, not do insertions. If you want the last one to work you should have done something that in normal mode would move the cursor without side effects, such as viw, not something that only inserts text and doesn't move the cursor.

      --
      --
      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 because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 4 messages in this topic