fzf: enable colors in preview when possible on macOS / BSD

This commit is contained in:
Ajeet D'Souza 2022-12-09 01:36:32 +05:30
parent 82d4f73aae
commit 7af4da1dab
3 changed files with 9 additions and 5 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nushell: upgrade minimum supported version to v0.73.0.
- Zsh: fix extra space in interactive completions when no match is found.
- Fzf: `<TAB>` now cycles through completions.
- Fzf: enable colors in preview when possible on macOS / BSD.
## [0.8.3] - 2022-09-02

View File

@ -61,7 +61,11 @@ impl Fzf {
} else {
r"\command -p ls -Cp {2..}"
};
command.args(["--preview", PREVIEW_CMD, "--preview-window=down,30%"]).env("SHELL", "sh");
command.args(["--preview", PREVIEW_CMD, "--preview-window=down,30%"]).envs([
("CLICOLOR", "1"),
("CLICOLOR_FORCE", "1"),
("SHELL", "sh"),
]);
}
}

View File

@ -100,7 +100,7 @@ if [[ -o zle ]]; then
function __zoxide_z_complete() {
# Only show completions when the cursor is at the end of the line.
# shellcheck disable=SC2154
[[ "{{ "${#words[@]}" }}" -eq "${CURRENT}" ]] || return
[[ "{{ "${#words[@]}" }}" -eq "${CURRENT}" ]] || return 0
if [[ "{{ "${#words[@]}" }}" -eq 2 ]]; then
_files -/
@ -111,14 +111,13 @@ if [[ -o zle ]]; then
result="${__zoxide_z_prefix}${result}"
# shellcheck disable=SC2296
compadd -Q "${(q-)result}"
else
return 0
fi
\builtin printf '\e[5n'
fi
return 0
}
\builtin bindkey "\e[0n" 'reset-prompt'
\builtin bindkey '\e[0n' 'reset-prompt'
if [[ "${+functions[compdef]}" -ne 0 ]]; then
\compdef -d {{cmd}}
\compdef -d {{cmd}}i