Im trying to create git aliases with autocomplete using The Ultimate Git Alias Setup. I did everything in the instructions, but putting the following in my .zshrc file results in an error:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
function_exists() {
declare -f -F $1 > /dev/null
return $?
}
for al in `__git_aliases`; do
alias g$al="git $al"
complete_func=_git_$(__git_aliased_command $al)
function_exists $complete_fnc && __git_complete g$al $complete_func
done
The error is not intuitive: .zshrc:153: parse error near
\n'`
but trying to run __git_aliases
in the command line gives: zsh: command not found: __git_aliases
so i figured that was the problem.
I then found online that this might been deprecated from git and that this line is supposed to give the same out put:
git config --global alias.aliases "config --get-regex 'alias*'"
,
but that didnt work.
I also tried
git config --list | grep -oP '(?<=alias\.)\w+'
with no success.
EDIT:
Trying this command:
(git config -l | grep '^alias\.' | cut -d'=' -f1 | cut -d'.' -f2)
gave me the list of aliases but only the aliase name. I still get the same error so im guessing there are 2 things to sort out here, one related to the git aliases list and one related to zsh.
\.
. Eg.list-aliases = config --get-regexp '^alias\\.'
– Heliometer