Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Highlighting in the Result Panel #26

Open
damassi opened this issue Feb 25, 2015 · 11 comments
Open

Syntax Highlighting in the Result Panel #26

damassi opened this issue Feb 25, 2015 · 11 comments

Comments

@damassi
Copy link

damassi commented Feb 25, 2015

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
Copy link

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

@damassi
Copy link
Author

damassi commented Feb 25, 2015

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

@dyng
Copy link
Owner

dyng commented Mar 2, 2015

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
Copy link

Leeiio commented Oct 15, 2016

+1

1 similar comment
@blayz3r
Copy link

blayz3r commented Dec 22, 2019

+1

@vext01
Copy link

vext01 commented Mar 11, 2020

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
Copy link

vext01 commented Mar 11, 2020

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

Trailing space issue still stands.

@dyng
Copy link
Owner

dyng commented Mar 11, 2020

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
Copy link

vext01 commented Mar 11, 2020 via email

@HawkinsT
Copy link

HawkinsT commented May 6, 2020

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants