mirror of
https://github.com/denisidoro/navi
synced 2024-11-21 19:13:07 +00:00
finished/working with extra comments
This commit is contained in:
parent
b756573be8
commit
38f807c1f6
1 changed files with 14 additions and 18 deletions
|
@ -17,31 +17,27 @@ 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
|
||||
bind -M insert \cg smart_replace
|
||||
|
|
Loading…
Reference in a new issue