a simple summary is in the title but to further explain:
Whenever i open my terminal (iterm2) i load into zsh but completions don't seem to work, then when i manually run source .zshrc
it does fully load. I've tried moving stuff around in my .zshrc file to see if the order of loading was incorrect but it didn't fix anything.
My .zshrc file:
# ZSH customization
export ZSH="/Users/user/.oh-my-zsh"
source $ZSH/oh-my-zsh.sh
plugins=(git docker asdf zsh-autosuggestions zsh-completions zsh-history-substring-search zsh-syntax-highlighting)
autoload -U compinit && compinit
# color
. "/Users/user/.bin/lscolors.sh" #big color file
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# alias
alias ip="curl ifconfig.me"
alias ls="gls --color --group-directories-first -hp"
alias ydl="youtube-dl"
alias py="python"
alias code="codium"
# env
export PATH="/usr/local/opt/ncurses/bin:/usr/local/sbin:/usr/local/opt/[email protected]/bin:$PATH:/opt/metasploit-framework/bin:$HOME/.bin:$HOME/.cargo/bin"
export EDITOR=/usr/local/bin/codium
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export LDFLAGS="-L/usr/local/opt/[email protected]/lib -L/usr/local/opt/ncurses/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include -I/usr/local/opt/ncurses/include"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/ncurses/lib/pkgconfig"
# fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# inits
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
eval "$(starship init zsh)"
Any help would be appreciated, if i should provide more info please tell me.
You're making two mistakes in your .zshrc
file:
source $ZSH/oh-my-zsh.sh
, then you shouldn't also autoload -U compinit && compinit
, because the former includes the latter.
compinit
more than once can cause problems and slows down your shell’s startup. Each time you run it, it reinitializes the completion system. This will erase any completion entries that were added programmatically (as opposed to picked up automatically from your $fpath
) after the previous compinit
was run.plugins=( ... )
should be set before running source $ZSH/oh-my-zsh.sh
.
$plugins
is not special to your shell in any way. Rather, it’s a parameter that’s read by OMZ.So, change the top of your .zshrc
file to this:
ZSH="/Users/user/.oh-my-zsh"
plugins=(
foo
bar
...
)
source $ZSH/oh-my-zsh.sh