ctrlsf.vim
ctrlsf.vim copied to clipboard
Syntax Highlighting in the Result Panel
It would be great to be able to toggle syntax highlighting in the results pane. Right now the results are printed out in only one color.
It's might be a bit hard to determine the file types among the search results.
That's what I figured. This seems like a difficult ask, but it would be a fantastic addition.
It is not impossible (by using syntax region
) but needs a lot of work.
I'll try to do it sometime, thank you for your suggestion.
+1
+1
On a related note, can I change the colours of the results somehow? The highlighted search term is unreadable for me:
Note also the trailing white-space highlighted red.
Ah ha! You can customise the match colour with the ctrlsfMatch
highlight.
Trailing space issue still stands.
If you are using vim-trailing-whitespace
to highlight trailing spaces, please add ctrlsf to its ignoring files.
let g:extra_whitespace_ignored_filetypes = ['ctrlsf']
Ah! Thanks.
I think I'm using a hand-rolled solution, but I'm happy to switch to using a plugin.
Thanks!
On Wed, 11 Mar 2020, 15:00 Ye Ding, [email protected] wrote:
If you are using vim-trailing-whitespace to highlight trailing spaces, please add ctrlsf to its ignoring files.
let g:extra_whitespace_ignored_filetypes = ['ctrlsf']
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dyng/ctrlsf.vim/issues/26#issuecomment-597684247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAETWG4ABFSP3B2UZNSSLVDRG6RPPANCNFSM4A4W7QAQ .
As a workaround, you can maybe try adding something like this to your vimrc:
" Use syntax of current buffer in CtrlSF output
function CtrlSF_syntax_hi()
let s:syntx = &syntax
execute ':CtrlSF'
windo if &ft == 'ctrlsf' | execute 'set syntax='.s:syntx | endif
endfunction
nnoremap <silent> <leader>sf :call CtrlSF_syntax_hi()<CR>
It's not useful if you're trying to grep over many different kinds of files or looking for a specific term, but for use cases where, e.g. you're trying to find all lines in a code base that invoke the function at the cursor, it's fairly handy since it's most likely that results returned will be in the same language as the file you're grepping from.
Syntax highlighting in result pane would be awesome, anyway thanks for this wonderful plugin. Congratulations, so so useful