How do I reset and put the zshrc file back to default?

zsh itself does not have a default user configuration. So the default ~/.zshrc is actually no ~/.zshrc. But as you tagged the question with oh-my-zsh I would assume that you want to restore the default oh-my-zsh configuration. For this it should be sufficient to copy templates/zshrc.zsh-template from your oh-my-zsh installation path, usually ~/.oh-my-zsh: cp ~/.oh-my-zsh/templates/zshrc.zsh-template … Read more

ZSH for loop array variable issue

It’s actually much simpler than that: lw=(‘plugin1’ ‘plugin2’ ‘plugin3’) for i in $lw; do . ~/Library/Rogall/plugins/$i/lw.prg end done In summary: Assign to foo, not $foo (the shell would try to expand $foo and assign to whatever it expands to; typically not useful) Use the loop variable directly; it contains the array value rather than the … Read more

Change tmux default to zsh

From man tmux: default-shell path Specify the default shell. This is used as the login shell for new windows when the default-command option is set to empty, and must be the full path of the executable. When started tmux tries to set a default value from the first suitable of the SHELL environment variable, the … Read more

Add newline to Oh My ZSH Theme

I was actually searching for the same answer. But my needs was a little more specific since I only wanted to add a newline in the agnoster theme, the one I’m using now. In my research, I find a lot of forked themes that already do it, but I thought that this was an overkill … Read more

How do you determine which theme you are on when ZSH_THEME=”random”

According to oh-my-zsh.sh L81-87: if [ “$ZSH_THEME” = “random” ]; then themes=($ZSH/themes/*zsh-theme) N=${#themes[@]} ((N=(RANDOM%N)+1)) RANDOM_THEME=${themes[$N]} source “$RANDOM_THEME” echo “[oh-my-zsh] Random theme ‘$RANDOM_THEME’ loaded…” Therefore you should be able to print the path to the random theme with print $RANDOM_THEME

ZSH: automatically run ls after every cd

EDIT: After looking at documentation (zshbuiltins, description of cd builtin or hook functions) I found a better way: it is using either chpwd function: function chpwd() { emulate -L zsh ls -a } or using chpwd_functions array: function list_all() { emulate -L zsh ls -a } chpwd_functions=(${chpwd_functions[@]} “list_all”) Put the following into .zshrc: function cd() … Read more

zsh: update prompt with current time when a command is started

This is in fact possible without resorting to strange hacks. I’ve got this in my .zshrc RPROMPT='[%D{%L:%M:%S %p}]’ TMOUT=1 TRAPALRM() { zle reset-prompt } The TRAPALRM function gets called every TMOUT seconds (in this case 1), and here it performs a prompt refresh, and does so until a command starts execution (and it doesn’t interfere … Read more