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

61594Re: Fix bug: %s/get_foo/ /g inserts "et_foo" not "get_foo"

Expand Messages
  • Ben Fritz
    Jun 7, 2011
      On Jun 6, 10:37 pm, tyru <tyru....@...> wrote:
      > Sorry, I should have said about more details.
      > This problem occurs in the following circumstances:
      > - 'incsearch' is on
      > - "get_foo" is under the cursor
      > - the last character on the command-line is "g" like %s/get_foo//g
      > - cursor position is <cursor>: %s/get_foo/<cursor>/g
      > - type <C-r><C-w>
      > The reason why this problem occurred is,
      > that Vim looks for the part of inserted cword
      > from the end of command-line.
      > So I fixed that looks for from the current position of the command-line.

      Oh wow, this is fun! If you also add other flags, it will remove any
      of those characters as well. For example, with a new buffer containing
      only the word, "general", with the cursor on this word, type on the
      command line:


      Then position the cursor between the final two '/' characters and
      press <C-R><C-W> and get:


      Shouldn't the fix actually look to see whether the current command-
      line mode is search, rather than any of the other command-line modes?
      See :help getcmdtype() for all of them. I can't see how the "feature"
      of only inserting the remainder of the word is desirable in any of the
      other modes, really.

      Well, maybe it is somewhat useful...it would allow you to change your
      mind if you start typing a word already under the cursor, and complete
      the rest of the word automatically instead of inserting the entire
      word. But it sure is unexpected! And I don't think 'incsearch' should
      affect anything except for a search, that just doesn't make sense.

      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
    • Show all 7 messages in this topic