Insert when not doing smart replace

This commit is contained in:
Kid 2022-01-16 19:02:36 +08:00
parent 9186d7bb7c
commit 0160a44b3e

View file

@ -1,29 +1,25 @@
function _navi_smart_replace function _navi_smart_replace
set -l current_process (commandline -p | string trim) set -l current_process (commandline -p | string trim)
if test $current_process = "" if test -z $current_process
commandline -p (navi --print) commandline -i (navi --print)
commandline -f repaint
else else
set -l best_match (navi --print --best-match --query $current_process) set -l best_match (navi --print --best-match --query $current_process)
if not test $best_match > /dev/null if not test $best_match > /dev/null
commandline -p $current_process
commandline -f repaint
return return
end end
if test $best_match = "" if test $best_match = ""
commandline -p (navi --print --query $current_process) commandline -p (navi --print --query $current_process)
commandline -f repaint
else if test $current_process != $best_match else if test $current_process != $best_match
commandline -p $best_match commandline -p $best_match
commandline -f repaint
else else
commandline -p (navi --print --query $current_process) commandline -p (navi --print --query $current_process)
commandline -f repaint
end end
end end
commandline -f repaint
end end
bind \cg _navi_smart_replace bind \cg _navi_smart_replace