The option 'incsearch' just jumps to the first matching place and highlights it.
We then press enter, all the matches are get highlighted (if we set hlsearch on).
If Vim highlights all the matching strings, it would be nice.
There's already an implementation in Vim script (
https://github.com/haya14busa/incsearch.vim).
However, this plugin uses its own command-line like interface thus very limited and the code is too complicated.
If this feature will be implemented with a small patch, it would be nice and I hope it merged.
Here's a simple patch I wrote.
I noticed that just removing the SEARCH_KEEP flag enables Vimt to highlight the
matches while searching (search.c:L1149, ex_getln.c:L1795).
Of course, as you notice, the following patch overwrites the default behavior
and it must be fixed if the feature will be merged to Vim.
Does anyone get interested in implementing the followings?
- new option ('incsearchhlall' or something like that)to highlight all the matches
while searching (disabled by default)
- related documents and helps
diff -r cd5eff09c1ae src/ex_getln.c
--- a/src/ex_getln.c Thu Feb 05 20:29:59 2015 +0100
+++ b/src/ex_getln.c Sat Feb 07 02:09:58 2015 +0900
@@ -1778,8 +1778,10 @@
curwin->w_cursor = old_cursor; /* start at old position */
/* If there is no command line, don't do anything */
- if (ccline.cmdlen == 0)
+ if (ccline.cmdlen == 0) {
i = 0;
+ SET_NO_HLSEARCH(TRUE);
+ }
else
{
cursor_off(); /* so the user knows we're busy */
@@ -1790,7 +1792,7 @@
profile_setlimit(500L, &tm);
#endif
i = do_search(NULL, firstc, ccline.cmdbuff, count,
- SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK,
+ SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK,
#ifdef FEAT_RELTIME
&tm
Regards, itchyny.
Thanks.