On Jun 6, 10:37 pm, tyru <[email protected]> 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:

:%s/foo//gen

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

:%s/foo/eral/gen

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

Raspunde prin e-mail lui