| @@ -5,23 +5,12 @@ | |||||
| #+BABEL: :cache yes | #+BABEL: :cache yes | ||||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | ||||
| ~/.zshrc and ~/.zprofile setup. Nothing too special. | |||||
| ~/.zshrc. Nothing too special. Only thing to note is the .profile sourcing, zsh does not explicitly ever source .profile by default. | |||||
| * ~/.zprofile | |||||
| Ref: | |||||
| https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html | |||||
| Make sure that zsh sources ~/.profile correctly on login. | |||||
| #+BEGIN_SRC sh :tangle tmp/.zprofile :results replace | |||||
| emulate sh | |||||
| source ~/.profile | |||||
| emulate zsh | |||||
| # zsh does this differently | |||||
| login_shell() | |||||
| { | |||||
| [[ -o login ]] | |||||
| } | |||||
| #+END_SRC | |||||
| I used to do this in ~/.zprofile but decided its easier to just stick it in zshrc. | |||||
| * ~/.zshrc | * ~/.zshrc | ||||
| @@ -30,6 +19,18 @@ Zsh configuration, its not too crazy... I think. Don't judge me. | |||||
| #+BEGIN_SRC sh :tangle tmp/.zshrc :results replace | #+BEGIN_SRC sh :tangle tmp/.zshrc :results replace | ||||
| #-*-mode: Shell-script; coding: utf-8;-*- | #-*-mode: Shell-script; coding: utf-8;-*- | ||||
| # zsh specific global aliases | # zsh specific global aliases | ||||
| # Need to source .profile as that is not one of the files sourced by zsh. | |||||
| # | |||||
| # Note: only source .profile when we're in an interactive shell | |||||
| # | |||||
| # TODO: should rethink what I put in .profile tbh | |||||
| if [[ -o interactive ]]; then | |||||
| emulate sh | |||||
| source ~/.profile | |||||
| emulate zsh | |||||
| fi | |||||
| alias -g silent="> /dev/null 2>&1" | alias -g silent="> /dev/null 2>&1" | ||||
| alias -g noerr="2> /dev/null" | alias -g noerr="2> /dev/null" | ||||
| alias -g stdboth="2>&1" | alias -g stdboth="2>&1" | ||||
| @@ -75,13 +76,13 @@ setopt print_exit_value # I love you zsh for this, print out non zero exits. | |||||
| other_term() | other_term() | ||||
| { | { | ||||
| case $TERM in | case $TERM in | ||||
| *xterm*|*rxvt*|dtterm|kterm|eterm) | |||||
| ,*xterm*|*rxvt*|dtterm|kterm|eterm) | |||||
| print -Pn "\e]2;%~\a" | print -Pn "\e]2;%~\a" | ||||
| ;; | ;; | ||||
| sun-cmd) | sun-cmd) | ||||
| print -Pn "\e]l%~\e\\" | print -Pn "\e]l%~\e\\" | ||||
| ;; | ;; | ||||
| *) | |||||
| ,*) | |||||
| ;; | ;; | ||||
| esac | esac | ||||
| } | } | ||||
| @@ -93,13 +94,13 @@ chpwd() | |||||
| eterm-color) # getting emacs terminal to not be annoying... sucks | eterm-color) # getting emacs terminal to not be annoying... sucks | ||||
| print -Pn "" | print -Pn "" | ||||
| ;; | ;; | ||||
| *) | |||||
| ,*) | |||||
| if [[ $SSH_TTY != '' ]]; then | if [[ $SSH_TTY != '' ]]; then | ||||
| case $ORIG_TERM in | case $ORIG_TERM in | ||||
| eterm-color) | eterm-color) | ||||
| print -Pn "" | print -Pn "" | ||||
| ;; | ;; | ||||
| *) | |||||
| ,*) | |||||
| other_term | other_term | ||||
| ;; | ;; | ||||
| esac | esac | ||||
| @@ -195,3 +196,5 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-st | |||||
| PROMPT="%(!.#.$) " # $ as a user # as root | PROMPT="%(!.#.$) " # $ as a user # as root | ||||
| RPROMPT='${vcs_info_msg_0_} ${PWD/#$HOME/~}' | RPROMPT='${vcs_info_msg_0_} ${PWD/#$HOME/~}' | ||||
| #+END_SRC | #+END_SRC | ||||
| #+RESULTS[303cce42e777b39fe85706ded77572354c405806]: | |||||