Skip to content

Instantly share code, notes, and snippets.

@disco0
Last active February 4, 2021 08:54
Show Gist options
  • Save disco0/184ef99bf9e48ed2e4f2373d5951da40 to your computer and use it in GitHub Desktop.
Save disco0/184ef99bf9e48ed2e4f2373d5951da40 to your computer and use it in GitHub Desktop.
Boilerplate for zsh completion scripts
{
"#compdef":
{
"scope": "shellscript",
"prefix": "!compdef",
"body":
[
"#compdef ${TM_FILENAME/^_(.+)(\\.[\\w]*sh)?/$1/}",
"",
"###",
"### Completion for ${TM_FILENAME/^_(.+)(\\.[\\w]*sh)?/$1/}",
"###",
"",
"# Uncomment to disable reloading on every completion call",
"# (( $+functions[_$TM_FILENAME] )) ||",
"function _$TM_FILENAME()",
"{",
" $0",
"}",
"",
"_$TM_FILENAME ${(@)^@}"
],
"description": "Boilerplate for zsh completion script."
}
}
// code: language=jsonc insertSpaces=true tabSize=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment