mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
Insert when not doing smart replace
This commit is contained in:
parent
9186d7bb7c
commit
0160a44b3e
1 changed files with 5 additions and 9 deletions
|
@ -1,29 +1,25 @@
|
|||
function _navi_smart_replace
|
||||
set -l current_process (commandline -p | string trim)
|
||||
|
||||
if test $current_process = ""
|
||||
commandline -p (navi --print)
|
||||
commandline -f repaint
|
||||
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
|
||||
commandline -p $current_process
|
||||
commandline -f repaint
|
||||
return
|
||||
end
|
||||
|
||||
if test $best_match = ""
|
||||
commandline -p (navi --print --query $current_process)
|
||||
commandline -f repaint
|
||||
else if test $current_process != $best_match
|
||||
commandline -p $best_match
|
||||
commandline -f repaint
|
||||
else
|
||||
commandline -p (navi --print --query $current_process)
|
||||
end
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
bind \cg _navi_smart_replace
|
||||
|
|
Loading…
Reference in a new issue