Skip to content

Commit

Permalink
Update navi.plugin.fish
Browse files Browse the repository at this point in the history
  • Loading branch information
DevAtDawn authored Dec 16, 2021
1 parent 38f807c commit 5e32154
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions shell/navi.plugin.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env fish

# navi widget fish | source

function __call_navi
navi --print
Expand All @@ -16,25 +17,32 @@ function navi-widget -d "Show cheat sheets"
commandline -f repaint
end

# set -g navi_last_cmd ""

function smart_replace
# set -l current_buffer (commandline -b)
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 = $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

if [ $current_process = "" ]
commandline -p (navi --print)
commandline -f repaint
else
# echo "false"
commandline -p $best_match
commandline -f repaint
# commandline -p ' '$best_match
# navi-widget
set -l best_match (navi --print --best-match --query $current_process)
# if [ $navi_last_cmd = $current_process ]
if [ $best_match = "" ]
# set navi_last_cmd (commandline -p)
# 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

Expand Down

0 comments on commit 5e32154

Please sign in to comment.