#StackBounty: #zsh #oh-my-zsh Interactively switching zsh themes while running powerline

Bounty: 50

I’m a long-time bash user just getting used to running zsh, oh-my-zsh, and powerline. I like the setup very much, but have one frustration I can’t figure out how to solve.

I occasionally need to copy & paste terminal sessions into emails, text documents, etc. With the default powerline setup, the special characters cause grief, so my thought is to switch my zsh theme to a plain ascii theme. Unfortunately, I can’t figure out how to do that from the command line. I’m sure it’s possible, but I can’t quite figure out the interaction between powerline and the shell to wire it up.

My suggested workflow would be:

  • Open shell session
  • Do work as normal
  • Switch themes to an “ascii only” theme (which powerline includes apparently)
  • Do work for copy/paste
  • Switch themes back to my previous one

I’m comfortable with scripting this as a script or alias, but I can’t quite figure out how to start. My google-fu is weak when searching for things like “change powerline theme dynamically”, “change zsh prompt dynamically”, etc.

Things I’ve tried:

  • Manually setting the prompt: PS1="$ ". That sets the left side prompt just fine, but doesn’t clear the right side prompt (which usually has git information in my setup)
  • Manually applying a theme: source ~/.oh-my-zsh/themes/my-plain-ascii.zsh-theme. Still doesn’t clear the right side prompt

And I’m still unsure how to re-apply my powerline defaults after I’m finished, short of source ~/.zshrc, which works, but seems heavyweight.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.