Skip to content

Commit

Permalink
fzf: enable colors in preview when possible on macOS / BSD
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeetdsouza committed Dec 8, 2022
1 parent 82d4f73 commit 7af4da1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]);
}
}

Expand Down
7 changes: 3 additions & 4 deletions templates/zsh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 -/
Expand All @@ -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
Expand Down

0 comments on commit 7af4da1

Please sign in to comment.