Closed LangLangBart closed 1 month ago
The issue with the current
refs
is that thesed
command is missing the$'
in front of the term so that\t
(tabs) can be expanded, as mysed
version is unable to do so.
Strange, I don't have the problem. Both BSD sed and GNU sed work as expected both on bash and zsh.
echo -e 'foo\tbar' | sed 's/\t/xx/'
echo -e 'foo\tbar' | gsed 's/\t/xx/'
Are you using a different implementation of sed?
Are you using a different implementation of sed?
Yes, I am using an outdated version of sed
, found under text_cmds-101.40.1
[^1] (macOS 10.15[^2]).
The explicit handling of \t
as a tab character was introduced in text_cmds-106
[^3] (macOS 11).
echo -e 'foo\tbar' | ./sed-101 's/\t/xx/'
# foo bar
echo -e 'foo\tbar' | ./sed-106 's/\t/xx/'
# fooxxbar
Using a more modern sed
version solves the first issue described in the description.
[^1]: Tags · apple-oss-distributions/text_cmds · GitHub [^2]: Apple Open Source - Releases [^3]: text_cmds-106 · apple-oss-distributions/text_cmds@26b7439 · GitHub
rebased
Thanks, that clarifies. Patch looks good and works well, thanks, and thanks for the patience!
Should other
refs
likerefs/bisect
even be listed at all ?
I'm not sure, I rarely use bisect, so I don't know if it's desirable or not.
Are the colors okay ?
Tags used to be brightcyan, let me fix it.
Would you like me to add a toogle to the ⌥ Option + A keybind in an extra PR or is the feature still too young4 ?
It would be nice. I just didn't implement toggling because I didn't feel it's much needed because I can just close the window and re-trigger the binding.
description
The issue with the current
refs
is that thesed
command is missing the$'
in front of the term so that\t
(tabs) can be expanded, as mysed
version is unable to do so.Another issue is that assigning
FZF_GIT_COLOR=never
has no effect because the colorization takes place in thesed
part.Additionally, other
refs
, for example when doing agit bisect
, weren't colorized and would disrupt the columnization.intended solution
sed
and use the built-in%(if) … %(then) … %(else) … %(end)
syntax[^1][^2] to colorize[^3] the possible values of%(refname)
:refs/remotes
(magenta)refs/heads
(brightgreen)refs/tags
(brightblue)refs/stash
(brightred)Unfortunately, there is no
%(else if)
construct available, so one has to construct nested%(if)
terms.open questions
Should other
refs
likerefs/bisect
even be listed at all ?Are the colors okay ?
Would you like me to add a toogle to the ⌥ Option + A keybind in an extra PR or is the feature still too young[^4] ?
[^1]: [PATCH 00/15] port branch.c to use ref-filter's printing options [^2]: Git - git-for-each-ref Documentation - %(if) [^3]: Git - git-config Documentation - color [^4]: Add environment variables: FZF_{BORDER,PREVIEW}_LABEL (#3693) · junegunn/fzf@f625c5a · GitHub