-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Section about "Integration with other tools" (fzf, fd, find, git, ..) #448
Comments
When I do
Is this expected? |
That is expected, yes. You need to use The difference between the two is that To use |
Awesome, thanks for the thoughtful response and for your work on |
Added four of the five points listed above. If somebody has more ideas, please let me know. |
This doesn't work. I guess the reason being |
@Boot-Error It works just fine if you use Here is what I use: export FZF_DEFAULT_OPTS="--ansi --preview-window 'right:60%' --preview 'bat --color=always --style=header,grid --line-range :300 {}'" There are also a few cool things that we can do with |
This is something that I use all the time! I am looking at finding a way to interactively highlighting (changing the background colour) of several lines around the line matching the fuzzy searched for string. However since I am just piping ripgrep, skim and bat into each other and they each rust projects shouldn't I be able to do this within a rust project by using each crate? ripgrep and skim seem to be straightforward enough on their own but I havent been able to figure out how to call bat from a rust project. |
See #423 However, I think that most of this can also be done with a little bit of (shell) scripting. The tools play quite nicely together, I think. If there is anything you miss (from the CLI), let us know. |
@sharkdp Here's a sample of how I use bat as a preview command in fzf. This is a small function that searches over source code with ag, then pipes it into bat with |
Thank you for sharing! |
At the request of @bricewge, here's my script for searching using ripgrep with bat for output printing: https://github.com/eth-p/bat-extras/blob/master/src/batgrep.sh I mainly use it on MacOS, but it should also work on Linux as well. |
seems like a LOT of stuff has been commented out here.
I basically support using tree and bat to preview files and directories using fzf. together with some helpful bindings to toggle preview and paging up and down the preview window. what should be the "oficial way"? |
also this is not needed. The --ansi is needed only if you are using fd with colors to colorize the input. |
Thank you, very helpful. You missed the last
|
updated it :) thank you ! |
Part of sharkdp#448 Thanks to sharkdp#940
It will solve "unknown file types in __fzf_preview_file". It wasn't working because the current directory (see pwd output in __fzf_preview_file function) of the preview context is $HOME (I don't know why ... I just spent 3 hours debugging it). To understand why I removed the colors: sharkdp/bat#448 (comment) Thank you for your work.
I added a section about |
We should add a "Integration with other tools" section to the README to document some of the ways in which
bat
can be combined with other tools:bat
as a--preview
program withfzf
.bat
on the search results offd
/find
viafd pattern -X bat
git show
to view older versions of files:git show v0.6.0:src/main.rs | bat -l rs
xclip
to copy a file to the consoletail -f some-file.ext | bat -l ext --paging=never
with syntax highlighting.git diff --name-only
(see bat --diff #940)The text was updated successfully, but these errors were encountered: