diff options
author | Denis Isidoro <denisidoro@users.noreply.github.com> | 2020-03-12 14:57:02 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-12 14:57:02 -0300 |
commit | ce9c22100aff86bf50c68b525cd345031e83b632 (patch) | |
tree | 8c5e7c1963cdc5b8a6b63fbbec4fcc4ea7fbed8b | |
parent | 7ae019cf0ea319fafcb88c58aed3719720d5a508 (diff) |
Allow overriding FZF variables (#235)v2.0.6
`$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
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rwxr-xr-x | scripts/fix | 13 | ||||
-rw-r--r-- | src/cmds/core.rs | 1 | ||||
-rw-r--r-- | src/option.rs | 11 |
5 files changed, 18 insertions, 11 deletions
@@ -89,7 +89,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "navi" -version = "2.0.5" +version = "2.0.6" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "raw_tty 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1,6 +1,6 @@ [package] name = "navi" -version = "2.0.5" +version = "2.0.6" authors = ["Denis Isidoro <denis_isidoro@live.com>"] edition = "2018" diff --git a/scripts/fix b/scripts/fix index 4886a17..99bd147 100755 --- a/scripts/fix +++ b/scripts/fix @@ -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
\ No newline at end of file +find scripts -type f | xargs -I% dot code beautify % || true + +header "clippy..." +cargo clippy || true diff --git a/src/cmds/core.rs b/src/cmds/core.rs index fe0208f..504c025 100644 --- a/src/cmds/core.rs +++ b/src/cmds/core.rs @@ -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() }; diff --git a/src/option.rs b/src/option.rs index 8b95c81..68468da 100644 --- a/src/option.rs +++ b/src/option.rs @@ -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>, } |