DEV Community

Discussion on: Create an Interactive Bash Command for searching and checking out Git Branches on the Terminal using fzf

Collapse
 
b2aff6009 profile image
b2aff6009

Hey Albert,
that' pretty cool. I used fzf already for searching and opening files with vim or vscode, but until now without preview. Here a short question, the preview is not updating when I switch the line? Do I need to config something for it?
NOTE: I added a ' after color=always as there was a missing ' and for me it looked like it should close the preview command.

A more detailed point: Is there a way to even go down into folders? I already thought about a keybind, which would basically retrigger the command itself, but with a different path.

git brs works like a charm!

Thank you!

Collapse
 
aalises profile image
Albert Alises • Edited

Thanks for the words!!

The command for ls contained a typo. For the preview to work, you need to pass the path to bat using {}, that is: --preview 'bat --style=numbers --color=always {}'.

I have updated the command in the article, thanks for noticing!

As for the navigation, I guess you could trigger the command recursively when clicking on the right arrow, with the new path, and abort the current command. Clicking the left arrow would trigger ls .., hit me up if you manage to get it working!