TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
8.81k stars 693 forks source link

Add shell integration for Fish #447

Open TheR1D opened 5 months ago

TheR1D commented 5 months ago

Current ShellGPT ingeration works only with Zsh and Bash. Add shell integration for Fish as well.

_Originally posted by @endolith in https://github.com/TheR1D/shell_gpt/discussions/268#discussioncomment-7777678_

onewesong commented 3 months ago

I have try wrote this:

function _sgpt_fish
    set -l cmd (echo "$line" | sgpt --shell --no-interaction)
    commandline -r $cmd
end

bind \cl _sgpt_fish

But the $line is empty, don't know how to get the input buffer in fish

onewesong commented 3 months ago

I get, it work now

function _sgpt_fish
    set -l cmd (commandline | sgpt --shell --no-interaction)
    commandline -r $cmd
end

bind \cl _sgpt_fish
andyfr commented 1 month ago

@onewesong I'd like to try it out. Where do I need to place this snipped? Does it go to ~/.config/fish/completions/ ?

onewesong commented 3 weeks ago

@andyfr If you just want to try, you can just paste it to fish terminal image