mirror of
https://github.com/denisidoro/navi.git
synced 2026-01-23 02:14:19 +00:00
fix: add version check for fish v4+
This commit is contained in:
parent
023e52d1fb
commit
0076018ada
1 changed files with 17 additions and 2 deletions
|
|
@ -1,11 +1,24 @@
|
|||
function _navi_smart_replace
|
||||
set --local query (commandline --current-process | string trim)
|
||||
set --local version_parts ""
|
||||
if test -n "$version"
|
||||
set version_parts (string split '.' $version)
|
||||
else
|
||||
set version_parts (string split '.' (string match -r '\d+\.\d+\.\d+' (fish --version)))
|
||||
end
|
||||
|
||||
set --local force_repaint false
|
||||
if test $version_parts[1] -ge 4
|
||||
set force_repaint true
|
||||
end
|
||||
|
||||
if test -n "$query"
|
||||
set --local best_match (navi --print --query "$query" --best-match)
|
||||
if test -n "$best_match"
|
||||
commandline --current-process $best_match
|
||||
commandline -f repaint
|
||||
if test "$force_repaint" = true
|
||||
commandline -f repaint
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
@ -13,7 +26,9 @@ function _navi_smart_replace
|
|||
set --local candidate (navi --print --query "$query")
|
||||
if test -n "$candidate"
|
||||
commandline --current-process $candidate
|
||||
commandline -f repaint
|
||||
if test "$force_repaint" = true
|
||||
commandline -f repaint
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue