Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDocument oh-my-zsh workaround for completion support #716
Comments
|
Hi, you seem to be on the right track, and I don't know why completions are not working for you.
Let us know how it went! |
|
So my Homebrew prefix is |
|
When do you If not, then double-check that you have this line in your zshrc
If yes, then double-check that FPATH is changed before oh-my-zsh gets loaded. |
|
Yes I see the export PATH=/usr/local/homebrew/bin:~/.local/bin:$PATH:/opt/local/bin:/usr/local/mysql/bin:~/Scripts:$GOPATH/bin
# Path to your oh-my-zsh installation.
export ZSH="/Users/nathanielpalmer/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="agnoster"
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
vi-mode
history-substring-search
git
zsh-nvm
npm
timer
vscode
)
# Homebrew completions
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='code'
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
alias zshconfig="$EDITOR ~/.zshrc"
alias ohmyzsh="$EDITOR ~/.oh-my-zsh"
alias reload='source ~/.zshrc'
# Key Bindings
# bind UP and DOWN arrow keys
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
# bind k and j for VI mode
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
prompt_context(){} |
|
@diminutivesloop Thank you for sharing. I see nothing wrong with your setup. The only thing I can suggest is temporarily replacing your zshrc with a minimal one that just modifies FPATH and turns on completions, nothing else, then see if that helps |
|
Ok so the culprit appears to be this block of code in if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user
handle_completion_insecurities
# Load only from secure directories
compinit -i -C -d "${ZSH_COMPDUMP}"
else
# If the user wants it, load from all found directories
compinit -u -C -d "${ZSH_COMPDUMP}"
fiIt doesn’t matter whether So I can fix the problem either by commenting out the above block of code or by adding |
|
I have a similar setup. My workaround in if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
# Despite homebrew docs, running compinit after loading oh-my-zsh
# seems to work, without the need to rebuild zcompdump
#autoload -Uz compinit
#compinit
fi
source $ZSH/oh-my-zsh.sh
if type brew &>/dev/null; then
autoload -Uz compinit
# Use `-u` to silence `zsh compinit: insecure directories`
# See: https://stackoverflow.com/a/19601821/4378637
compinit -u
fi |
|
Thank you both for your input! When you do land on a working solution that feels alright, please report so here so we can update our documentation for setting up zsh |
|
My solution is to add the following to
Unlike the solution provided by @SuaYoo I don’t pass the |
|
It sounds like this is worth documenting in the manual area for gh completion. |


Describe the bug
After following the instructions for enabling shell completion I still can’t get the completion functionality to work. I’ve tried both the
evaland Homebrew options. I’m on Mac OS 10.15.4 using zsh with Oh My Zsh and gh version 0.6.2.Steps to reproduce the behavior
.zshrc. and open a new terminal.gheval "$(gh completion -s zsh)”Expected vs actual behavior
I expect to see completion options for
ghcommands but instead I get my shell’s standard file path completion.