cygwin - colorization of Quickfix results in Vim -
how can have results in quickfix colorized when use grep
in vim?
i have tried:
set grepprg=grep\ --color=always\ -n\ $*\ /dev/null
but it's not working.
i using vim 7.4 on cygwin , have tried in linux mint 15. please help, thanks.
with --color=always
, instruct grep output ansi color sequences (stuff looks ^[[32;40m
), though output not terminal.
unfortunately, vim not understand these sequences; has own (regular expression-based) syntax highlighting.
though ansiesc.vim plugin can translate former latter, don't think helpful here. (i've briefly tried it, , didn't work expected).
solution
you write custom :grep
command feeds passed arguments :grep
, , defines appropriate syntax highlighting quickfix window. problem regular expression dialects of grep
, vim different. can avoid problem using :vimgrep
.
in fact, simplest solution first search pattern inside vim:
/pattern
and follow actual grep:
:vimgrep // file1 file2
with :set hlsearch
, you'll have matches automatically highlighted (in windows, including quickfix window, though long don't search else).
Comments
Post a Comment