[vim/vim] Visually highlight search and replace (Issue #10205)

8 views
Skip to first unread message

jclsn

unread,
Apr 16, 2022, 4:32:32 AM4/16/22
to vim/vim, Subscribed

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
When using the search and replace function, it sometimes takes a few shots to get it right, because you only see if it worked after you hit enter.

Describe the solution you'd like
It would be nice to have all matches highlighted in real time when either using the search via / or the search and replace function.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10205@github.com>

Bram Moolenaar

unread,
Apr 16, 2022, 4:22:20 PM4/16/22
to vim/vim, Subscribed

Have you enabled 'incsearch' ? If that's not what you want, please explain what you mean with "search and replace function".


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10205/1100749145@github.com>

jclsn

unread,
Apr 16, 2022, 4:36:19 PM4/16/22
to vim/vim, Subscribed

Well, kind of, but I would like it to be extended to the following functionality:

  1. Provide an option to highlight all occurrences of the search. Currently it just highlights the first one. This might be a matter of taste.
  2. More importantly: When using search and replace, it would be great to preview the replacement. So after you type ```:%s/someword/`` all occurences should instantly show a preview. This would immensely help with strings that contain a lot of escaped characters.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10205/1100751224@github.com>

Gary Johnson

unread,
Apr 16, 2022, 5:48:45 PM4/16/22
to reply+ACY5DGAWI2YWP7JVOT...@reply.github.com, vim...@googlegroups.com
On 2022-04-16, jclsn wrote:
> Well, kind of, but I would like it to be extended to the following
> functionality:
>
> 1. Provide an option to highlight all occurrences of the search. Currently it
> just highlights the first one. This might be a matter of taste.

:set hlsearch

See

:help 'hlsearch'

> 2. More importantly: When using search and replace, it would be great to
> preview the replacement. So after you type ```:%s/someword/`` all
> occurences should instantly show a preview. This would immensely help with
> strings that contain a lot of escaped characters.

Since you can easily undo the effects of a :substitute command,
I don't see much advantage to having a preview. If you don't like
the results, undo them and try again. You can also try it on one
line at a time instead of the whole file while you're experimenting
with it. Another approach to finding out if the command is what you
want is to use the :DiffOrig command,

:help :DiffOrig

to see a side-by-side comparison of the before and after states of
your file.

HTH,
Gary

vim-dev ML

unread,
Apr 16, 2022, 5:49:03 PM4/16/22
to vim/vim, vim-dev ML, Your activity


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10205/1100759988@github.com>

lacygoill

unread,
Apr 16, 2022, 6:02:25 PM4/16/22
to vim/vim, vim-dev ML, Comment

FWIW traces.vim provides this feature.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/10205/1100761644@github.com>

jclsn

unread,
Apr 17, 2022, 4:10:17 AM4/17/22
to vim/vim, vim-dev ML, Comment

@lacygoill: Noice! Thanks! I guess I can close this now


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/10205/1100828470@github.com>

jclsn

unread,
Apr 17, 2022, 4:10:21 AM4/17/22
to vim/vim, vim-dev ML, Comment

Closed #10205.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issue/10205/issue_event/6444259684@github.com>

Reply all
Reply to author
Forward
0 new messages