Open vinhant opened 1 year ago
Using -z
along with --read0
is the only option, but unfortunately, that disables colored output.
# Colors
git -c color.status=always status --short --no-branch | fzf --ansi
# No colors
git -c color.status=always status -z --short --no-branch | fzf --read0 --ansi
The "git files" preview command uses
{-1}
which creates an issue if the filename has space characters in it. e.g. if filename is "two words" then{-1}
will returnwords"
I tried fixing this by 1. using
{2..}
which skips the git status flag and 2. piping the output of "git ls-files" tosed 's/"\(.*\)"$/\1/'
in order to remove the double-quotes from filenames. For example if git status isM "two words"
then the sed command will giveM two words
and then{2..}
should givetwo words
. Then the preview command should work because it adds its own single quote.Other options I looked at is
git ls-files -z
but I don't know how to send that to fzf