Feature Request
Add fish-widget command for Fish shell integration.
Why Fish?
- Fish has native autosuggestion support - can integrate seamlessly
- Growing user base, especially among developers
- Fish's
commandline builtin makes implementation clean
Proposed Command
aprender-shell fish-widget >> ~/.config/fish/config.fish
Implementation
Fish is actually easier than ZSH/Bash because it has native suggestion support:
# aprender-shell Fish widget
function __aprender_suggest --on-event fish_preexec
# Fish handles suggestions natively, we just need to hook
end
function aprender_suggest
set -l cmd (commandline -b)
if test (string length "$cmd") -ge 2
aprender-shell suggest "$cmd" 2>/dev/null | head -1 | cut -f1
end
end
# Override fish's default suggestion
set -g fish_autosuggestion_enabled 0
function fish_commandline_prepopulate --on-event fish_prompt
set -l suggestion (aprender_suggest)
if test -n "$suggestion"
commandline -f repaint
end
end
Alternative: Use Fish's __fish_complete_command integration:
function __fish_aprender_complete
set -l cmd (commandline -cp)
aprender-shell suggest "$cmd" 2>/dev/null | while read -l suggestion score
echo $suggestion
end
end
complete -f -c '*' -a '(__fish_aprender_complete)'
Priority
Medium - Fish has good native suggestions, but aprender's history-trained model could improve them.
Related
Feature Request
Add
fish-widgetcommand for Fish shell integration.Why Fish?
commandlinebuiltin makes implementation cleanProposed Command
Implementation
Fish is actually easier than ZSH/Bash because it has native suggestion support:
Alternative: Use Fish's
__fish_complete_commandintegration:Priority
Medium - Fish has good native suggestions, but aprender's history-trained model could improve them.
Related