After a really long journey I decided to retire my long-lasting and trustworthy companion, my 2012 MacBook Air. I spent quite some time to decide which new model to buy; in the end the presence of the touch bar made me avoid all other models and going for the latest 2020 MacBook Air.
I didn’t want to use one of my time capsule backup but have a new clean env to setup and so first thing first: git, bash-completion and customization of the prompt on zsh shell on macOs Catalina. I used brew to do it.
brew install git bash-completion
And then to make the completion available in zsh
as suggested by homebrew website you must get the Homebrew-managed zsh site-functions on your FPATH
before initialising zsh
’s completion facility, so I added the following in the ~/.zshrc
file:
if type brew &>/dev/null; then FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH autoload -Uz compinit && compinit fi
Compinit was complaining about insecure directories, so I listed the insecure directory and added the correct permission for those.
zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? compaudit This is because those folders are group writable, so I changes it: compaudit | xargs chmod g-w
I do like do see in my prompt both the user and the machine name, the path I’m on and if it’s a git repository the branch name and adding some color. Next step will be adding some more icon to show the status of the git repository.
# Load version control information autoload -Uz vcs_info precmd() { vcs_info } # Format the vcs_info_msg_0_ variable zstyle ':vcs_info:git:*' formats '(%b)' autoload -U colors && colors # Set up the prompt (with git branch name) setopt PROMPT_SUBST PROMPT='%n@%m %F{green}${PWD/#$HOME/~}%f %F{yellow}${vcs_info_msg_0_}%f > '