dyng / ctrlsf.vim

A text searching plugin mimics Ctrl-Shift-F on Sublime Text 2
1.59k stars 86 forks source link

Syntax Highlighting in the Result Panel #26

Open damassi opened 9 years ago

damassi commented 9 years ago

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.

Menghongli commented 9 years ago

It's might be a bit hard to determine the file types among the search results.

damassi commented 9 years ago

That's what I figured. This seems like a difficult ask, but it would be a fantastic addition.

dyng commented 9 years ago

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.

Leeiio commented 7 years ago

+1

blayz3r commented 4 years ago

+1

vext01 commented 4 years ago

On a related note, can I change the colours of the results somehow? The highlighted search term is unreadable for me:

image

Note also the trailing white-space highlighted red.

vext01 commented 4 years ago

Ah ha! You can customise the match colour with the ctrlsfMatch highlight.

Trailing space issue still stands.

dyng commented 4 years ago

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']
vext01 commented 4 years ago

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, notifications@github.com 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 .

HawkinsT commented 4 years ago

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.

jugarpeupv commented 2 years ago

Syntax highlighting in result pane would be awesome, anyway thanks for this wonderful plugin. Congratulations, so so useful