Skip to content

Commit

Permalink
feat: Added ability to customize color scheme
Browse files Browse the repository at this point in the history
Signed-off-by: Sibin Grasic <[email protected]>
  • Loading branch information
seebeen committed Jan 28, 2024
1 parent c27a98f commit c3d2195
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents

- [Contents](#contents)
- [Installing](#installing)
- [Zgenom](#zgenom)
- [Antigen](#antigen)
- [Oh-My-Zsh](#oh-my-zsh)
- [Without using a framework](#without-using-a-framework)
- [(optional) Install recommended tools](#optional-install-recommended-tools)
- [Customization](#customization)
- [A note on `lessfilter-fzf`](#a-note-on-lessfilter-fzf)
- [Other FZF resources](#other-fzf-resources)
- [fzf-zsh-plugin](#fzf-zsh-plugin)
- [Table of Contents](#table-of-contents)
- [Contents](#contents)
- [Installing](#installing)
- [Zgenom](#zgenom)
- [Antigen](#antigen)
- [Oh-My-Zsh](#oh-my-zsh)
- [Without using a framework](#without-using-a-framework)
- [(optional) Install recommended tools](#optional-install-recommended-tools)
- [Customization](#customization)
- [A note on `lessfilter-fzf`](#a-note-on-lessfilter-fzf)
- [Other FZF resources](#other-fzf-resources)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -105,9 +107,10 @@ You can customize a few features by exporting the following environment variable

| Export variable | Description |
| ---------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `export FZF_PREVIEW_ADVANCED=true` | Use `less` viewer with a pre-processor to display improved previews for a wide range of files (requires you to install at least `exa`, `bat`, `chafa`, `exiftool`; and very recommended `lesspipe.sh` and the tools it uses underneath: `mdcat`, `in2csv`,...). _This is an opt-in feature._ |
| `export FZF_PREVIEW_WINDOW=''` | Set any value supported by `fzf --preview-window` option, e.g. `right:65%:nohidden` will show the preview by default. |
| `export FZF_PATH=''` | Path to install fzf binary and script, e.g. `${HOME}/.config/fzf`. |
| `FZF_PREVIEW_ADVANCED` | Use `less` viewer with a pre-processor to display improved previews for a wide range of files (requires you to install at least `exa`, `bat`, `chafa`, `exiftool`; and very recommended `lesspipe.sh` and the tools it uses underneath: `mdcat`, `in2csv`,...). _This is an opt-in feature._ |
| `FZF_PREVIEW_WINDOW` | Set any value supported by `fzf --preview-window` option, e.g. `right:65%:nohidden` will show the preview by default. |
| `FZF_PATH` | Path to install fzf binary and script, e.g. `${HOME}/.config/fzf`. |
| `FZF_COLOR_SCHEME` | Color scheme for fzf, e.g. `--color='hl:148,hl+:154,pointer:032,marker:010,bg+:237,gutter:008'` |

### A note on `lessfilter-fzf`

Expand Down
3 changes: 2 additions & 1 deletion fzf-zsh-plugin.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ _fzf_preview() {
}

# Don't step on user's defined variables. Export to potentially leverage them by other scripts.
[[ -z "$FZF_COLOR_SCHEME" ]] && export FZF_COLOR_SCHEME="--color='hl:148,hl+:154,pointer:032,marker:010,bg+:237,gutter:008'"
[[ -z "$FZF_PREVIEW" ]] && export FZF_PREVIEW="$(_fzf_preview)"
[[ -z "$FZF_PREVIEW_WINDOW" ]] && export FZF_PREVIEW_WINDOW=':hidden'
if [[ -z "$FZF_DEFAULT_OPTS" ]]; then
Expand All @@ -116,7 +117,7 @@ if [[ -z "$FZF_DEFAULT_OPTS" ]]; then
"--multi"
"--preview='${FZF_PREVIEW}'"
"--preview-window='${FZF_PREVIEW_WINDOW}'"
"--color='hl:148,hl+:154,pointer:032,marker:010,bg+:237,gutter:008'"
"$FZF_COLOR_SCHEME"
"--prompt='∼ '"
"--pointer='▶'"
"--marker='✓'"
Expand Down

0 comments on commit c3d2195

Please sign in to comment.