Zsh: horizontal line – hr

add to your .zshrc

https://superuser.com/questions/845744/how-to-draw-a-line-between-commands-in-zsh-shell

 

 

Oh My Zsh

Thought I’d give this a go.

From https://ohmyz.sh/

  1. install zsh (on the Mac this is already installed)
  2. set iTerm2 (https://www.iterm2.com/downloads.html) to use this (chsh -s $(which zsh) and in iTerm2 > Preferences > Profiles > Default > General, set the Command to /bin/zsh instead of Login shell. Note – you can also do this via System Preferences: https://stackoverflow.com/a/44547726/343204
  3. Install Oh My Zsh. i.e. sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" –  https://ohmyz.sh/
  4.  If you’re using the agnoster theme, then be aware you’ll need to use Patched fonts (not a big thing but just make sure you install both ASCII and non-ASCII fonts)  – https://github.com/powerline/fonts. i.e. git clone https://github.com/powerline/fonts.git; cd fonts; ./install.sh and select them as the default fonts in iTerm2 > Preferences > Profiles > Text (change both Font and Non-ASCII Font to 12pt Meslo LG S Regular for Powerline)
  5. The most time-consuming stuff was customisation. Copy chosen theme to ~/.oh-my-zsh/custom/themes/agnoster.zsh-theme and customise. i.e. cp ~/.oh-my-zsh/themes/agnoster.zsh-theme ~/.oh-my-zsh/custom/themes/ and set as active in ~/.zshrc (i.e. ZSH_THEME=”agnoster”)
  6. Set aliases and autojump. E.g. I have:

# Aliases
alias c=”clear”
alias l=”ls”
alias sfs=”php bin/console server:run”
alias hr=”printf ‘%*s\n’ \”${COLUMNS:-$(tput cols)}\” ” | tr ‘ ‘ -”
alias h=”history”
alias tf=”terraform”

[[ -s $(brew –prefix)/etc/profile.d/autojump.sh ]] && . $(brew –prefix)/etc/profile.d/autojump.sh

 

Customisation Notes:

E.g. PROMPT:


# Dir: current working directory
prompt_dir() {
prompt_segment blue black &quot; <code>basename ${PWD/#$HOME/'~'}</code> &quot;
}

OR

prompt_segment blue black '%c'

https://github.com/robbyrussell/oh-my-zsh/issues/5479

E.g. no user@host in command prompt:

add


<code>DEFAULT_USER=$USER</code>

in your zshrc file.

https://github.com/robbyrussell/oh-my-zsh/issues/5512

 

See also

https://stackoverflow.com/questions/35281630/how-do-i-change-my-ps1-on-a-macbook-for-oh-my-zsh

https://github.com/robbyrussell/oh-my-zsh/wiki/Customization

And on the agnoster theme:

  1. red cross means last command had a non-zero exit code: https://github.com/agnoster/agnoster-zsh-theme/issues/54

And a Zsh Cheat Sheet:

https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet

E.g.

git shortcuts such as:

gst: git status

ga: git add

gcam: git commit -m

gp: git push

gpsup:git push –set-upstream origin $(current_branch)