shell_gpt icon indicating copy to clipboard operation
shell_gpt copied to clipboard

Add shell integration for Fish

Open TheR1D opened this issue 1 year ago • 7 comments

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

TheR1D avatar Jan 15 '24 02:01 TheR1D

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 avatar Mar 15 '24 09:03 onewesong

I get, it work now

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

bind \cl _sgpt_fish

onewesong avatar Mar 15 '24 09:03 onewesong

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

andyfr avatar May 30 '24 13:05 andyfr

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

onewesong avatar Jun 11 '24 11:06 onewesong

Didn't work for me (I hit the key after typing "change git branch"):

change git branch Usage: sgpt [OPTIONS] [PROMPT]
Try 'sgpt --help' for help.
╭─ Error ───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ No such option: --no-interaction (Possible options: --install-integration, --no-install-functions,        │
│ --no-install-integration)                                                                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯

hugows avatar Jul 15 '24 11:07 hugows

pip install shell-gpt --upgrade and its working now... The only thing I miss is the animation :)

hugows avatar Jul 19 '24 09:07 hugows