Update navi.plugin.fish

This commit is contained in:
DevAtDawn 2021-12-16 10:43:52 -07:00 committed by GitHub
parent 38f807c1f6
commit 5e3215466d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
#!/usr/bin/env fish
# navi widget fish | source
function __call_navi function __call_navi
navi --print navi --print
@ -16,25 +17,32 @@ function navi-widget -d "Show cheat sheets"
commandline -f repaint commandline -f repaint
end end
# set -g navi_last_cmd ""
function smart_replace function smart_replace
# set -l current_buffer (commandline -b)
set -l current_process (commandline -p) set -l current_process (commandline -p)
# set -l current_job (commandline -j)
set -l best_match (navi --print --best-match --query $current_process) if [ $current_process = "" ]
commandline -p (navi --print)
if [ $current_process = $best_match ]
# if [ $current_process != $best_match ]
# echo "true"
set -l new_process (navi --print --query $current_process)
# echo $new_process
commandline -p $new_process
commandline -f repaint commandline -f repaint
else else
# echo "false" set -l best_match (navi --print --best-match --query $current_process)
commandline -p $best_match # if [ $navi_last_cmd = $current_process ]
commandline -f repaint if [ $best_match = "" ]
# commandline -p ' '$best_match # set navi_last_cmd (commandline -p)
# navi-widget # commandline -p $current_process
commandline -p (navi --print --query $current_process)
commandline -f repaint
# else
else if [ $current_process != $best_match ]
commandline -p $best_match
commandline -f repaint
else if [ $current_process = $best_match ]
commandline -p (navi --print --query $current_process)
commandline -f repaint
# else
# commandline -p $current_process
end
end end
end end