# bash: Place this in .bashrc.
# zsh: Place this in .zshrc.
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
function iterm2_print_user_vars() {
iterm2_set_user_var gitLastCommitMessage "$(if [ -d .git ]; then; git show --format=%s -s 2>/dev/null; fi)"
}
In iTerm2...
- Right-click on the status bar and click "Configure Status Bar".
- Click and drag the "Interpolated String" component onto the "Active Components"
- Click to select it and click the "Configure Component" button at the bottom left of he dialog box.
- Set the string value to
𐌒 \(user.gitLastCommitMessage)
, optionally configure the display details, and click "OK".
That's it. 🙂