68797Re: Suggestion: Highlight the search pattern in :g/.../# or :g/.../p
- Mar 21, 2013Hi again,
Jürgen Krämer wrote:
>it misses at least one feature: it only highlights the first match on a
> Axel Bender wrote:
>> How about implementing a hightlighting of the pattern searched for in
>> :g/.../ expressions? At times the resulting list is quite long and it
>> is difficult to identify the pattern. Highlighting it would be of
>> great benefit (at least for me...).
> the last time somebody asked this question I wrote this little function
> function! PrintWithHighlighting()
> let line = getline('.')
> let ms = match(line, @/)
> let me = matchend(line, @/)
> if ms != -1
> echohl none
> echo strpart(line, 0, ms)
> echohl Search
> echon strpart(line, ms, me - ms)
> echohl none
> echon strpart(line, me, strlen(line))
> echo line
> command! P call PrintWithHighlighting()
> You can use it like this
> :g/you pattern/P
> I have never tested it much and I think I did not get any feedback if
> it behaved as wanted.
> In the same thread somebody else replied with suggesting a script thatFound it: http://vim.wikia.com/wiki/VimTip1141
> probably can be found on vim.org and might be tested more.
> Alas, I cannot find the original thread at the moment.
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
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
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>