JuanPablo
JuanPablo

Reputation: 24774

zsh:vcs_info: branch name in branch format

I use this zsh-theme

in this line

 zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'

set the branch format. In Git, when I are in master branch show

 [master]

how I can change display string from master to M?

Upvotes: 3

Views: 1075

Answers (1)

K-os
K-os

Reputation: 248

I don't think you can accomplish this using just a zstyle, but you can set a hook to modify the branch variable before it is printed like this:

zstyle ':vcs_info:git*+set-message:*' hooks git-abbrv-master
function +vi-git-abbrv-master() {
    hook_com[branch]=${hook_com[branch]/#%master/M}
}

Upvotes: 4

Related Questions