[vim/vim] Why vim search exclude the letter in current cursor? (Discussion #14871)

17 views
Skip to first unread message

ElwinGao4444

unread,
May 29, 2024, 6:04:10 AM5/29/24
to vim/vim, Subscribed

when I search text like this:

  1. www.github.com
  2. www.google.com

current cursor(cursor type is block) on the first "w" in first line,and then I using "/" to search target words: "www"
when I type "enter" to search,the cursor jump to the first "w" in second line
I think vim will scan word from current letter(not jump to next "www"), but vim will search word exclude current letter
I don't understand why design like this?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/14871@github.com>

Gary Johnson

unread,
May 29, 2024, 11:45:42 AM5/29/24
to reply+ACY5DGEGMEXRESBHYR...@reply.github.com, vim...@googlegroups.com
On 2024-05-29, ElwinGao4444 wrote:
> when I search text like this:
>
> 1. www.github.com
> 2. www.google.com
>
> -------------------------------------------------------------------------------
>
> current cursor(cursor type is block) on the first "w" in first line,and then I
> using "/" to search target words: "www"
> when I type "enter" to search,the cursor jump to the first "w" in second line
> I think vim will scan word from current letter(not jump to next "www"), but vim
> will search word exclude current letter
> I don't understand why design like this?

If Vim included the current location in the search and stopped at
the first "w" of the "www" in the first line, typing "n" to find the
next match would find that same match at the same location and the
search would never progress.

Regards,
Gary

vim-dev ML

unread,
May 29, 2024, 11:46:07 AM5/29/24
to vim/vim, vim-dev ML, Your activity

On 2024-05-29, ElwinGao4444 wrote:
> when I search text like this:
>
> 1. www.github.com
> 2. www.google.com
>
> -------------------------------------------------------------------------------
>
> current cursor(cursor type is block) on the first "w" in first line,and then I
> using "/" to search target words: "www"
> when I type "enter" to search,the cursor jump to the first "w" in second line
> I think vim will scan word from current letter(not jump to next "www"), but vim
> will search word exclude current letter
> I don't understand why design like this?

If Vim included the current location in the search and stopped at
the first "w" of the "www" in the first line, typing "n" to find the
next match would find that same match at the same location and the
search would never progress.

Regards,
Gary


Reply to this email directly, view it on GitHub,.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/14871/comments/9595542@github.com>

Reply all
Reply to author
Forward
0 new messages