diff --git a/docs/tmux.md b/docs/tmux.md index 415f3a9..657561e 100644 --- a/docs/tmux.md +++ b/docs/tmux.md @@ -5,7 +5,7 @@ You can use **navi** as a [Tmux](https://github.com/tmux/tmux/wiki) widget to re Add these lines to your Tmux config file to access **navi** by pressing `prefix + C-g`. ```sh -bind-key -T prefix C-g split-window \ +bind-key -N "Open Navi (cheat sheets)" -T prefix C-g split-window \ "$SHELL --login -i -c 'navi --print | head -n 1 | tmux load-buffer -b tmp - ; tmux paste-buffer -p -t {last} -b tmp -d'" ``` diff --git a/shell/navi.plugin.fish b/shell/navi.plugin.fish index 5ee6c89..2de4c74 100644 --- a/shell/navi.plugin.fish +++ b/shell/navi.plugin.fish @@ -1,29 +1,19 @@ function _navi_smart_replace - set -l current_process (commandline -p | string trim) + set --local query (commandline --current-process | string trim) - if test -z "$current_process" - commandline -i (navi --print) - else - set -l best_match (navi --print --best-match --query "$current_process") - - if not test "$best_match" >/dev/null + if test -n "$query" + set --local best_match (navi --print --query "$query" --best-match) + if test -n "$best_match" + commandline --current-process $best_match return end - - if test -z "$best_match" - commandline -p (navi --print --query "$current_process") - else if test "$current_process" != "$best_match" - commandline -p $best_match - else - commandline -p (navi --print --query "$current_process") - end end - commandline -f repaint + set --local candidate (navi --print --query "$query") + if test -n "$candidate" + commandline --current-process $candidate + end end -if test $fish_key_bindings = fish_default_key_bindings - bind \cg _navi_smart_replace -else - bind -M insert \cg _navi_smart_replace -end +bind \cg _navi_smart_replace +bind --mode insert \cg _navi_smart_replace diff --git a/src/clients/tldr.rs b/src/clients/tldr.rs index 160ab36..97c2b9b 100644 --- a/src/clients/tldr.rs +++ b/src/clients/tldr.rs @@ -7,7 +7,8 @@ lazy_static! { pub static ref NON_VAR_CHARS_REGEX: Regex = Regex::new(r"[^\da-zA-Z_]").expect("Invalid regex"); } -static VERSION_DISCLAIMER: &str = "tldr-c-client (the default one in Homebrew) doesn't support markdown files, so navi can't use it. +static VERSION_DISCLAIMER: &str = + "tldr-c-client (the default one in Homebrew) doesn't support markdown files, so navi can't use it. The recommended client is tealdeer(https://github.com/dbrgn/tealdeer)."; fn convert_tldr_vars(line: &str) -> String { diff --git a/src/common/shell.rs b/src/common/shell.rs index 064f28f..ba6dc65 100644 --- a/src/common/shell.rs +++ b/src/common/shell.rs @@ -12,7 +12,7 @@ pub enum Shell { Fish, Elvish, Nushell, - PowerShell + PowerShell, } #[derive(Error, Debug)]