Simplest customization of MacOS zsh prompt with git branch name without escape codes

In my previous zsh configuration that I combined from multiple sources there’s an issue with backspace when moving back through a longer line. The cursor jumps up or down a line and behaves weirdly.

From some searches online, it appears I have an issue with the escape codes not starting and ending correctly. Rather than spending time debugging what’s going on, I simplified it to avoid using the escape codes using suggestions in this question:

function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

setopt PROMPT_SUBST
export PROMPT='%n %~ %F{green}$(parse_git_branch)%F{reset_color} > '

This approaches uses the built in color codes, e.g. $F{green} instead of using the escape codes that need to be correctly terminated.

Registering an account and password resets on OFTC irc

Register your account with (steps here)

/msg NickServ REGISTER <password> <e-mail>

Identify with:

/msg NickServ IDENTIFY <password> <nickname>

Password reset with:

/msg NickServ sendpass <nickname>

Check your email for a reset code, then:

/msg NickServ sendpass <nickname> <resetcode> <newpassword>

Some additional notes:

  • in irssi, /msg NickServ will open an additional window in your terminal. To see the output of the command, use Alt-2 or whatever window number is where that command was run
  • If you’re in that window connected to NickServ, you can enter the other commands directly to NickServ without the /msg NickServ prefix