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 b6fdfc7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 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
5 changes: 2 additions & 3 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,11 +111,10 @@ 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'
Expand Down

0 comments on commit b6fdfc7

Please sign in to comment.