On Do, 30 Aug 2018, Jason Franklin wrote:
> What I mean, specifically, is the words in red. I wanted to have the
> search results in each line highlighted as well as the file name and
> location.
So something like this?
diff --git a/runtime/syntax/qf.vim b/runtime/syntax/qf.vim
index 5c987a97b..9183d6166 100644
--- a/runtime/syntax/qf.vim
+++ b/runtime/syntax/qf.vim
@@ -8,16 +8,38 @@ if exists("b:current_syntax")
finish
endif
+function! s:Highlight_Pattern()
+ try
+ " Search pattern should be the second argument, e.g. ':vimgrep /foobar/
*.c'
+ let pattern=split(get(w:, 'quickfix_title', ''))
+ if len(pattern) > 1
+ " get rid of pattern delimiter
+ if pattern[1][0] == pattern[1][-1:] && pattern[1][0] !~ '\i'
+ let pat=pattern[1][1:-2]
+ else
+ let pat=pattern[1]
+ endif
+ if empty(pat)
+ let pat=@/
+ endif
+ exe 'syn match qfPattern "'.escape(pat, '"').'"'
+ endif
+ endtry
+endfu
+
" A bunch of useful C keywords
syn match qfFileName "^[^|]*" nextgroup=qfSeparator
syn match qfSeparator "|" nextgroup=qfLineNr contained
syn match qfLineNr "[^|]*" contained contains=qfError
syn match qfError "error" contained
+call s:Highlight_Pattern()
+
" The default highlighting.
hi def link qfFileName Directory
hi def link qfLineNr LineNr
hi def link qfError Error
+hi def link qfPattern Constant
let b:current_syntax = "qf"
Mit freundlichen Grüßen
Christian
--
Das Christentum ist die Religion der Sklaven; der Priester ist der
Sklavenhalter, und die Sklaven sind die armen Sünder, die niederknieen
und zu einem Gott beten, der auf ihre Gebete nicht hören wird.
-- Anagãrika Dharmapãla
--
--
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/d/optout.