Created
February 21, 2025 12:59
-
-
Save Frosthaven/eb60410297b319fa8253991c77d08cc6 to your computer and use it in GitHub Desktop.
[S]earch [F]iles (sf) command - leveraging fzf and bat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # sf [s]earch [f]iles command (sf) | |
| # this will use the output of the fzf command to open the file in nvim. You can | |
| # - change the editor launch command to whatever you want. | |
| # - see: https://github.com/junegunn/fzf | |
| # - see: https://github.com/sharkdp/bat | |
| function sf { | |
| $file = fzf --preview "bat --color=always {}" --preview-window=right:50%:wrap --height 50% --border --prompt="Search Files: " --query="$args" | |
| if ($file) { | |
| nvim $file # or with your editor of choice | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do this on whatever os or shell you want. This is just an example under Windows + PowerShell.