mirror of
https://github.com/denisidoro/navi
synced 2024-11-21 19:13:07 +00:00
Update navi.plugin.fish
This commit is contained in:
parent
38f807c1f6
commit
5e3215466d
1 changed files with 24 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# navi widget fish | source
|
||||
|
||||
function __call_navi
|
||||
navi --print
|
||||
|
@ -16,25 +17,32 @@ function navi-widget -d "Show cheat sheets"
|
|||
commandline -f repaint
|
||||
end
|
||||
|
||||
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)
|
||||
# set -g navi_last_cmd ""
|
||||
|
||||
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
|
||||
function smart_replace
|
||||
set -l current_process (commandline -p)
|
||||
|
||||
if [ $current_process = "" ]
|
||||
commandline -p (navi --print)
|
||||
commandline -f repaint
|
||||
else
|
||||
# echo "false"
|
||||
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
|
||||
# commandline -p ' '$best_match
|
||||
# navi-widget
|
||||
else if [ $current_process = $best_match ]
|
||||
commandline -p (navi --print --query $current_process)
|
||||
commandline -f repaint
|
||||
# else
|
||||
# commandline -p $current_process
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue