On Thursday, March 21, 2013 5:51:50 PM UTC+8, 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...).

function! PrintWithHighlighting()
  let line = getline('.')
  let ms = match(line, @/)
  let me = matchend(line, @/)

  while ms != -1
    echohl none
    echon strpart(line, 0, ms)
    echohl Search
    echon strpart(line, ms, me - ms)
    echohl none
    let line = strpart(line, me)
    let ms = match(line, @/)
    let me = matchend(line, @/)
  endwhile
  echon line . "\n"
endfunction

command! P call PrintWithHighlighting()

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui