1

I enabled vcs_info like so:

autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats '(%b)'

set_prompt() {
    vcs_info

    print -n "[%~]${vcs_info_msg_0_}%# " # Directory and VCS info (if any).
}

PROMPT=$'$(set_prompt)'

This works well, but I recently made my $HOME a git repository to manage my dotfile better, so now every time the working directory is /home/martin or a subdirectory that doesn't have a git repo of its own, it prints the branch name of the /home/martin repo.

I'd like to ignore the repo in /home/martin, but not any others, such as /home/martin/code/project. I tried using disable-patterns:

zstyle ':vcs_info:*' disable-patterns "${(b)HOME}/(|/*)"

But that will disable it for git repos in a subdirectory of $HOME too, which isn't what I want.

I tried disabling it with:

zstyle ':vcs_info:git:*:martin' enable NONE

But that doesn't seem to take any effect. I also tried blanking the message:

zstyle ':vcs_info:git:*:martin' formats ''

And now my prompt is [~]a:%, so I set it to a zero-width space:

zstyle ':vcs_info:git:*:martin' formats "\u200b"

And that seems to work; but it seems a bit of a hack.

How can I disable vcs_info for a specific repo?

1 Answer 1

1

The following works

zstyle ':vcs_info:*:*:martin' formats "%0.0r"

In this case the %0.0r specifier says to use the repository name but display it as 0 width string.

See the zsh zformat utility as this is what formats uses.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .