Brew Git Bash Completion with zsh
Asked Answered
F

3

6

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.

Ferrell answered 4/4, 2014 at 4:31 Comment(0)
Z
2

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)
Zygodactyl answered 4/4, 2014 at 4:45 Comment(1)
See the answer below.Kalman
M
5

Seems like you need to get zsh-completions

Medrano answered 4/4, 2014 at 4:34 Comment(1)
Nope, zsh-completions (as the page says) is all about extra completions. git zsh completion is built in to zsh (and git comes with a better bash completion as well, but you can use the bash completion in zsh with some work)Crash
A
4

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

Amateur answered 25/10, 2021 at 14:51 Comment(0)
Z
2

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)
Zygodactyl answered 4/4, 2014 at 4:45 Comment(1)
See the answer below.Kalman

© 2022 - 2024 — McMap. All rights reserved.