Skip to content

Commit

Permalink
finished/working with extra comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DevAtDawn authored Dec 16, 2021
1 parent b756573 commit 38f807c
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions shell/navi.plugin.fish
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,26 @@ function navi-widget -d "Show cheat sheets"
end

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

if [ $current_process != $best_match ]
echo "true"
commandline -i $best_match
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
else
echo "false"
navi-widget
# echo "false"
commandline -p $best_match
commandline -f repaint
# commandline -p ' '$best_match
# navi-widget
end
end



#cli_buffer = commandline -
# split at last | left/right str
# set $user_input
# if query = answer : call Navi-widget
# else smart_replace :
# set output (navi --print --best-match --query $user_input)
# replace userinput string in clibuff or left string += output
# commandline append repaint

bind \cg smart_replace
if bind -M insert > /dev/null 2>&1
Expand Down

0 comments on commit 38f807c

Please sign in to comment.