Skip to content

Instantly share code, notes, and snippets.

@nbonfire
Created March 19, 2026 15:37
Show Gist options
  • Select an option

  • Save nbonfire/3d1a6cd407bce53b7d750aaec20bcda9 to your computer and use it in GitHub Desktop.

Select an option

Save nbonfire/3d1a6cd407bce53b7d750aaec20bcda9 to your computer and use it in GitHub Desktop.
very basic opencode completions for fish
# Disable default file completion unless yargs gives nothing
complete -c opencode -f
function __opencode_yargs_completions
# Tokens up to cursor (excluding current token)
set -l tokens (commandline -opc)
# Current token (may be empty or '-')
set -l cur (commandline -ct)
# If there *is* a current token, append it
if test -n "$cur"
set tokens $tokens $cur
end
opencode --get-yargs-completions $tokens 2>/dev/null
end
complete -c opencode -f -k -a "(__opencode_yargs_completions)"
complete -c opencode --force-files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment