Procházet zdrojové kódy

Move .profile sourcing from .zprofile to .zshrc misc fixes

master
Mitchell Tishmack před 5 roky
rodič
revize
081cd0f517
1 změnil soubory, kde provedl 22 přidání a 19 odebrání
  1. +22
    -19
      zsh.org

+ 22
- 19
zsh.org Zobrazit soubor

@@ -5,23 +5,12 @@
#+BABEL: :cache yes
#+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

@@ -30,6 +19,18 @@ Zsh configuration, its not too crazy... I think. Don't judge me.
#+BEGIN_SRC sh :tangle tmp/.zshrc :results replace
#-*-mode: Shell-script; coding: utf-8;-*-
# 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 noerr="2> /dev/null"
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()
{
case $TERM in
*xterm*|*rxvt*|dtterm|kterm|eterm)
,*xterm*|*rxvt*|dtterm|kterm|eterm)
print -Pn "\e]2;%~\a"
;;
sun-cmd)
print -Pn "\e]l%~\e\\"
;;
*)
,*)
;;
esac
}
@@ -93,13 +94,13 @@ chpwd()
eterm-color) # getting emacs terminal to not be annoying... sucks
print -Pn ""
;;
*)
,*)
if [[ $SSH_TTY != '' ]]; then
case $ORIG_TERM in
eterm-color)
print -Pn ""
;;
*)
,*)
other_term
;;
esac
@@ -195,3 +196,5 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-st
PROMPT="%(!.#.$) " # $ as a user # as root
RPROMPT='${vcs_info_msg_0_} ${PWD/#$HOME/~}'
#+END_SRC

#+RESULTS[303cce42e777b39fe85706ded77572354c405806]:

Načítá se…
Zrušit
Uložit