-
-
Notifications
You must be signed in to change notification settings - Fork 576
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
Support bat for syntax highlighting in preview #712
Conversation
Thanks. Now with a few more changes, we no longer need the ruby version, right? |
I agree with you that we can eventually remove the ruby script. One may still want to use For configuration points, let's discuss on #707 (comment). |
Trying out bat, highlight, ..., finally cat in turn should be good enough for most users. It works out of the box without any configuration, and that's a big plus from my perspective. It's a little hard for me to imagine that someone installed |
This looks brilliant, what is missing for this to get merged? 😄 |
In the preview.sh script (used when ruby is not installed), `bat` (a clone of `cat` with syntax highlighting, etc.) can be used for the sake of syntax highlighting. If bat is not available, just fallback to the plain cat as before. [bat]: https://github.com/sharkdp/bat
One can still take advantage of `bat` as a syntax highlighter, when ruby is available but other ruby-based highlighter packages are not installed.
- Use preview.sh instead of preview.rb by default - Try bat syntax highlighter with the highest priority - Remove "-v" option as the latest version of fzf sets up $LINES - Allow users to customize the preview command via $FZF_PREVIEW_COMMAND - *EXPERIMENTAL / EVOLVING / UNDOCUMENTED* - Should be a command template with {} placeholder expression - e.g. "nl {}"
7a48db5
to
4316cef
Compare
Made a few changes. Please see the commit message for details. Thanks. |
Looks very good, thanks! |
Similar to this PR from fzf.vim: junegunn/fzf.vim#712
Similar to this PR from fzf.vim: junegunn/fzf.vim#712
bat is a very nice clone of
cat
that supports syntax highlighting feature. If bat is available, one may want to have it as a syntax highlighter used inpreview.sh
orpreview.rb
. This PR adds the support.I have implemented the functionality to be close to what
preview.sh
is doing, withawk
. Of course, the use ofbat
is absolutely optional. It allows us to have a syntax highlighting feature even without ruby.Another note: it might conflict with #707.