0

On m1 pro macbook using zsh, was trying to get git autocomplete to work by pasting autoload -Uz compinit && compinit in my .zshrc however I am getting the error compinit:141: parse error: condition expected: $1

$FPATH is not being set in .zshrc so that shouldn't be the issue.

It's clear the problem is with compinit, since when I run just compinit in the shell I get the same error.

  • I've tried to comb through the functions in fpath to find an issue, no luck
  • Tried installing zsh-completion and setting the fpath, no luck
  • Also upgraded zsh from 5.8.1 to 5.9 and manually set the fpath to the corresponding functions, no luck
  • Even left the issue with compinit and tried autoload -Uz vcs_info instead, no luck
raf
  • 11
  • 2
  • 1
    The high line number is strange. Could it be that you have your own `compinit` function, which kind of dominates the builtin one? Does it give some insight when you do a `whence -f compinit`? – user1934428 Apr 18 '23 at 06:37
  • 1
    The error also appears after the shell is launched with [`zsh --emulate sh`](https://www.zsh.org/mla/workers/2021/msg00072.html). This suggests that something else in `~/.zshrc` is [setting options](https://unix.stackexchange.com/a/663726) that are causing the issue, possibly due to an interaction with [`oh-my-zsh`](https://github.com/ohmyzsh/ohmyzsh/issues/10611). You may need to rebuild`~/.zshrc` one piece at a time to find the problem. – Gairfowl Apr 18 '23 at 08:23

1 Answers1

1

Solved

The issue was this line in my .zprofile which I thought I had to add after installing posh-git-sh (step 3) [[ -e ~/.zshrc ]] && emulate sh -c 'source ~/.zshrc'

Once I removed it the expected behaviour returned

raf
  • 11
  • 2