From bdaba6a714ec666dce4425fced7cb1e27e50175a Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 22 May 2012 12:49:45 -0400 Subject: [PATCH] [#171] Add templates and README for all rc files --- templates/README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++ templates/zlogin | 13 ++++++++ templates/zlogout | 14 +++++++++ templates/zprofile | 7 +++++ templates/zshenv | 7 +++++ 5 files changed, 116 insertions(+) create mode 100644 templates/README.md create mode 100644 templates/zlogin create mode 100644 templates/zlogout create mode 100644 templates/zprofile create mode 100644 templates/zshenv diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000..88f1643 --- /dev/null +++ b/templates/README.md @@ -0,0 +1,75 @@ +Zsh Configuration Files +======================= + +Zsh has several system-wide and user-local configuration files. + +System-wide configuration files are installation-dependent but are installed +in */etc* by default. + +User-local configuration files have the same name as their global counterparts +but are prefixed with a dot (hidden). Zsh looks for these files in the path +stored in the `$ZDOTDIR` environmental variable. However, if said variable is +not defined, Zsh will use the user's home directory. + +File Descriptions +----------------- + +The configuration files are read in the following order: + + 01. /etc/zshenv + 02. ~/.zshenv + 03. /etc/zprofile + 04. ~/.zprofile + 05. /etc/zshrc + 06. ~/.zshrc + 07. /etc/zlogin + 08. ~/.zlogin + 09. ~/.zlogout + 10. /etc/zlogout + +### zshenv + +This file is sourced by all instances of Zsh, and thus, it should be kept as +small as possible. It should only define environment variables. + +### zprofile + +This file is similar to zlogin, but it is sourced before zshrc. It was added +for [KornShell][1] fans. See the description of zlogin bellow for what it may +contain. + +zprofile and zlogin are not meant to be used concurrently but can be done so. + +### zshrc + +This file is sourced by interactive shells. It should define aliases, +functions, shell options, and key bindings. + +This is the main Oh My Zsh configuration file. + +### zlogin + +This file is sourced by login shells after zshrc, and thus, it should contain +commands that need to execute at login. It is usually used for messages such as +[fortune][2], [msgs][3], or for the creation of files. + +This is not the file to define aliases, functions, shell options, and key +bindings. It should not change the shell environment. + +### zlogout + +This file is sourced by login shells during logout. It should be used for +displaying messages and the deletion of files. + +Authors +------- + +*The authors of these files should be contacted via the [issue tracker][4].* + + - [Sorin Ionescu](https://github.com/sorin-ionescu) + +[1]: http://www.kornshell.com +[2]: http://en.wikipedia.org/wiki/Fortune_(Unix) +[3]: http://www.manpagez.com/man/1/msgs +[4]: https://github.com/sorin-ionescu/oh-my-zsh/issues + diff --git a/templates/zlogin b/templates/zlogin new file mode 100644 index 0000000..b13b611 --- /dev/null +++ b/templates/zlogin @@ -0,0 +1,13 @@ +# +# Executes commands at login post-zshrc. +# +# Authors: +# Sorin Ionescu +# + +# Print a random, hopefully interesting, adage. +if (( $+commands[fortune] )); then + fortune -a + print +fi + diff --git a/templates/zlogout b/templates/zlogout new file mode 100644 index 0000000..d898fec --- /dev/null +++ b/templates/zlogout @@ -0,0 +1,14 @@ +# +# Executes commands at logout. +# +# Authors: +# Sorin Ionescu +# + +# Print the message. +cat <<-EOF + +Thank you. Come again! + -- Dr. Apu Nahasapeemapetilon +EOF + diff --git a/templates/zprofile b/templates/zprofile new file mode 100644 index 0000000..2a3d07e --- /dev/null +++ b/templates/zprofile @@ -0,0 +1,7 @@ +# +# Executes commands at login pre-zshrc. +# +# Authors: +# Sorin Ionescu +# + diff --git a/templates/zshenv b/templates/zshenv new file mode 100644 index 0000000..89f9275 --- /dev/null +++ b/templates/zshenv @@ -0,0 +1,7 @@ +# +# Defines environment variables. +# +# Authors: +# Sorin Ionescu +# +