question about `] after inserting text

15 views
Skip to first unread message

Yukihiro Nakadaira

unread,
Dec 9, 2011, 5:09:27 AM12/9/11
to vim...@googlegroups.com
:help `] says
*']* *`]*
'] `] To the last character of the previously changed or
yanked text. {not in Vi}

But with the following command

execute "normal! iaaa\<Esc>Ibbb\<Esc>`]"

Cursor is moved at first "a".
I expected that cursor is moved at last "b".
Is it intended behavior?

When yank or paste "bbb", `] moves cursor at last "b".

--
Yukihiro Nakadaira - yukihiro....@gmail.com

Andy Wokula

unread,
Dec 9, 2011, 5:32:42 AM12/9/11
to vim...@googlegroups.com
Am 09.12.2011 11:09, schrieb Yukihiro Nakadaira:
> :help `] says
> *']* *`]*
> '] `] To the last character of the previously changed or
> yanked text. {not in Vi}
>
> But with the following command
>
> execute "normal! iaaa\<Esc>Ibbb\<Esc>`]"
>
> Cursor is moved at first "a".
> I expected that cursor is moved at last "b".
> Is it intended behavior?
>
> When yank or paste "bbb", `] moves cursor at last "b".

I also think this is a bug! I have a script that doesn't work correctly
in some cases, because `] places the cursor *after* the change (instead
of the last character of the change).

The script maps a key that basically executes n.n.n.n. ... until the
end of the buffer (for example: "repeat the last c//e (<- sort of!) for
all remaining matches").

Now if match A is immediately followed by the next match B, and A was
just changed, "n" will skip B, because search started at `] (= at the
first character of B).

--
Andy

Reply all
Reply to author
Forward
0 new messages