Skip to content

Commit

Permalink
Allow overriding FZF variables (#235)
Browse files Browse the repository at this point in the history
`$FZF_DEFAULT_OPTS` won't work in some use cases because it has lower precedence then hardcoded settings such as `--exact`.

Usage:
```
export NAVI_FZF_OVERRIDES=" --no-exact"
navi
```

Fixes #232
  • Loading branch information
denisidoro authored Mar 12, 2020
1 parent 7ae019c commit ce9c221
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "navi"
version = "2.0.5"
version = "2.0.6"
authors = ["Denis Isidoro <[email protected]>"]
edition = "2018"

Expand Down
13 changes: 9 additions & 4 deletions scripts/fix
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -euo pipefail
export NAVI_HOME="$(cd "$(dirname "$0")/.." && pwd)"
source "${NAVI_HOME}/scripts/install"

cd "$NAVI_HOME"

header "Cargo nighly fix..."
cargo +nightly fix --clippy -Z unstable-options 2> /dev/null || true
cargo +nightly fix --clippy -Z unstable-options || true

header "Cargo fix..."
cargo fix 2> /dev/null || true
cargo fix || true

header "Cargo fmt..."
cargo fmt 2> /dev/null || true
cargo fmt || true

header "dot code beautify..."
find scripts -type f | xargs -I% dot code beautify 2> /dev/null || true
find scripts -type f | xargs -I% dot code beautify % || true

header "clippy..."
cargo clippy || true
1 change: 1 addition & 0 deletions src/cmds/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ fn prompt_with_suggestions(config: &Config, suggestion: &cheat::Value) -> String
let mut opts = fzf::Opts {
preview: false,
autoselect: !config.no_autoselect,
overrides: config.fzf_overrides_var.as_ref(),
..Default::default()
};

Expand Down
11 changes: 6 additions & 5 deletions src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ pub struct Config {
#[structopt(long)]
pub no_preview: bool,

// #[structopt(long)]
// pub col_widths: Option<String>,
/// Overrides for fzf commands (must start with an empty space)
#[structopt(long)]
#[structopt(long)]
/// FZF overrides for cheat selection (must start with an empty space)
#[structopt(long, env = "NAVI_FZF_OVERRIDES")]
pub fzf_overrides: Option<String>,

/// FZF overrides for variable selection (must start with an empty space)
#[structopt(long, env = "NAVI_FZF_OVERRIDES_VAR")]
pub fzf_overrides_var: Option<String>,

#[structopt(subcommand)]
pub cmd: Option<Command>,
}
Expand Down

0 comments on commit ce9c221

Please sign in to comment.