mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
a5d295f828
Add “smart replace” functionality to the fish shell widget
23 lines
405 B
Fish
23 lines
405 B
Fish
#!/usr/bin/env fish
|
|
|
|
function __call_navi
|
|
navi --print
|
|
end
|
|
|
|
function navi-widget -d "Show cheat sheets"
|
|
begin
|
|
set ttysettings (stty -g)
|
|
stty sane
|
|
__call_navi | perl -pe 'chomp if eof' | read -lz result
|
|
and commandline -- $result
|
|
|
|
stty $ttysettings
|
|
end
|
|
commandline -f repaint
|
|
end
|
|
|
|
bind \cg navi-widget
|
|
if bind -M insert > /dev/null 2>&1
|
|
bind -M insert \cg navi-widget
|
|
|
|
end
|