Skip to content

Commit 2b93535

Browse files
authored
Introduce GrepperQuery highlight group (#252)
The behavior changed in this commit: `8b78347`. The decision was to unconditionally highlight the query like the user's colorscheme highlights string literals. I'd like to be able to customize this without changing how all string literals look, so I've introduced a new `GrepperQuery` highlight group that links to `String` by default. This means that there should be no change by default. I have not written tests for this but I have tested it in my own configuration files by adding this line: ```vim hi link GrepperQuery Normal ``` As seen in the diff, there is prior art for introducing new highlighting groups in grepper already--`GrepperPrompt` is a highlight group that controls the color of everything before the `>` (which displays the search program and flags). There do not appear to be any tests for that feature either, otherwise I would have cargo culted some to test this feature.
1 parent 1c3c4c6 commit 2b93535

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

doc/grepper.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,13 +590,19 @@ COLORS *grepper-colors*
590590

591591
Prompt:~
592592

593-
Default highlight group: GrepperPrompt linked to |hl-Question|.
593+
Default highlight group: GrepperPrompt linked to |hl-Question|. To change:
594594
>
595595
highlight GrepperPrompt ctermfg=160 guifg=#ff0000 cterm=NONE
596596
>
597+
Query:~
598+
599+
Default highlight group: GrepperQuery linked to |hl-String|. To change:
600+
>
601+
highlight link GrepperQuery Normal
602+
>
597603
Error messages:~
598604

599-
Default highlight group: |hl-ErrorMsg|
605+
Default highlight group: |hl-ErrorMsg|. To change:
600606
>
601607
highlight ErrorMsg ctermfg=160 ctermbg=NONE cterm=NONE
602608
<

plugin/grepper.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ let g:loaded_grepper = 1
99
" ..ad\\f40+$':-# @=,!;%^&&*()_{}/ /4304\'""?`9$343%$ ^adfadf[ad)[(
1010

1111
highlight default link GrepperPrompt Question
12+
highlight default link GrepperQuery String
1213

1314
"
1415
" Default values that get used for missing values in g:grepper.
@@ -804,7 +805,7 @@ function! s:prompt(flags)
804805
\ 'prompt': prompt_text,
805806
\ 'default': a:flags.query,
806807
\ 'completion': 'customlist,grepper#complete_files',
807-
\ 'highlight': { cmdline -> [[0, len(cmdline), 'String']] },
808+
\ 'highlight': { cmdline -> [[0, len(cmdline), 'GrepperQuery']] },
808809
\ })
809810
else
810811
let a:flags.query = input(prompt_text, a:flags.query,

0 commit comments

Comments
 (0)