GitHub CLI auto-completion with Oh-My-Zsh

Setup GitHub CLI auto-completion with Oh-My-Zsh on Linux

GitHub CLI auto-completion with Oh-My-Zsh
GitHub CLI auto-completion

I can not live without Oh-My-Zsh and in general auto-completion. It just save so many hours and typos.

And I know I will not remember this after I set this up. Therefore I can just as well write it down, maybe it will be helpful for me or others in some day.

Check if the completion folder is in your fpath, this should be the case with Oh-My-Zsh:

print -l $fpath | grep completion
/home/andrej/.oh-my-zsh/custom/plugins/git-flow-completion
/home/andrej/.oh-my-zsh/completions
/usr/share/zsh/vendor-completions

Create the completions folder if not it is not existing:

mkdir ~/.oh-my-zsh/completions

Create auto-completion script for GitHub CLI:

gh completion -s zsh > ~/.oh-my-zsh/completions/_gh

Add this to your ~/.zshrc (Source: https://cli.github.com/manual/gh_completion)

# github cli
autoload -U compinit
compinit -i

Tadaaa! Now you can manage GitHub issues and pull requests with ease via the command line and WITH auto-completion.