mirror of
https://github.com/denisidoro/navi.git
synced 2026-08-03 15:34:44 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
10ddffbe72
4 changed files with 15 additions and 24 deletions
|
|
@ -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'"
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub enum Shell {
|
|||
Fish,
|
||||
Elvish,
|
||||
Nushell,
|
||||
PowerShell
|
||||
PowerShell,
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue