user3496433
user3496433

Reputation:

Brew Git Bash Completion with zsh

I changed from Mac Port to Homebrew

I am using zsh, I installed brew git git-extra and bash-completion. i still don't see git auto completion like mac ports used to show it.

Upvotes: 6

Views: 5174

Answers (3)

Christopher Graf
Christopher Graf

Reputation: 2219

Configuring Completions in zsh

To make Homebrew’s completions available in zsh, you must get the Homebrew-managed zsh site-functions on your FPATH before initialising zsh’s completion facility. Add the following to your ~/.zshrc file:

if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi

Additionally, if you receive “zsh compinit: insecure directories” warnings when attempting to load these completions, you may need to run this:

chmod -R go-w "$(brew --prefix)/share"

Source: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh

Upvotes: 4

Meabed
Meabed

Reputation: 3928

You need to add the configs to you .zshrc as below

zstyle ':completion:*:*:git:*' script
/usr/local/etc/bash_completion.d/git-completion.bash


fpath=(/usr/local/share/zsh/site-functions $fpath)

Upvotes: 2

cnd
cnd

Reputation: 33714

Seems like you need to get zsh-completions

Upvotes: 5

Related Questions