From cc7e43b2422d044c98da2b5c5a1ebf6e8b2ac40d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 3 Sep 2012 16:38:18 -0400 Subject: [PATCH] [Fix #253] Move Prezto settings into their own file --- README.md | 13 +++--- init.zsh | 7 +++- modules/editor/init.zsh | 7 ++-- modules/gnu-utility/README.md | 2 +- modules/history-substring-search/README.md | 5 ++- modules/pacman/README.md | 6 +-- modules/prompt/README.md | 2 +- modules/screen/README.md | 2 +- modules/ssh-agent/README.md | 4 +- modules/syntax-highlighting/README.md | 5 ++- modules/terminal/README.md | 2 +- modules/tmux/README.md | 2 +- modules/utility/README.md | 10 ++--- runcoms/README.md | 19 +++++---- runcoms/zpreztorc | 46 ++++++++++++++++++++++ runcoms/zshrc | 41 +------------------ 16 files changed, 97 insertions(+), 76 deletions(-) create mode 100644 runcoms/zpreztorc diff --git a/README.md b/README.md index 762043fe..b12992ed 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,9 @@ version is 4.3.10. 3. Create a new Zsh configuration by copying the Zsh configuration files provided: - for rcfile in "${ZDOTDIR:-$HOME}/.zprezto/runcoms/z"{shenv,shrc,login,logout}; do - ln -s "$rcfile" "$ZDOTDIR/.$rcfile:t" + setopt EXTENDED_GLOB + for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do + ln -s "$rcfile" "$ZDOTDIR/.${rcfile:t}" done 4. Set Zsh as your default shell: @@ -66,15 +67,15 @@ accompanying README files to learn of what is available. ### Modules 1. Browse */modules* to see what is available. - 2. Load the modules you need in *~/.zshrc* then open a new Zsh terminal window - or tab. + 2. Load the modules you need in *~/.zpreztorc* then open a new Zsh terminal + window or tab. ### Themes 1. For a list of themes, type `prompt -l`. 2. To preview a theme, type `prompt -p name`. - 3. Load the theme you like in *~/.zshrc* then open a new Zsh terminal window - or tab. + 3. Load the theme you like in *~/.zpreztorc* then open a new Zsh terminal + window or tab. ![sorin theme][2] diff --git a/init.zsh b/init.zsh index 87609d00..3d4f6f88 100644 --- a/init.zsh +++ b/init.zsh @@ -18,6 +18,11 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then source "${ZDOTDIR:-$HOME}/.zpreztorc" fi +# Source the Prezto configuration file. +if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then + source "${ZDOTDIR:-$HOME}/.zpreztorc" +fi + # Disable color and theme in dumb terminals. if [[ "$TERM" == 'dumb' ]]; then zstyle ':prezto:*:*' color 'no' @@ -37,7 +42,7 @@ unset zfunction{s,} # Source files (the order matters). source "${0:h}/helper.zsh" -# Source Prezto modules defined in ~/.zshrc. +# Load Prezto modules. zstyle -a ':prezto:load' pmodule 'pmodules' pmodload "$pmodules[@]" unset pmodules diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 24323cca..ed17ffb4 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -5,12 +5,13 @@ # Sorin Ionescu # # Usage: -# To enable key bindings, add the following to zshrc, and replace 'map' with -# 'emacs' or 'vi. +# To enable key bindings, add the following to zpreztorc, and replace 'map' +# with 'emacs' or 'vi. # # zstyle ':prezto:module:editor' keymap 'map' # -# To enable the auto conversion of .... to ../.., add the following to zshrc. +# To enable the auto conversion of .... to ../.., add the following to +# zpreztorc. # # zstyle ':prezto:module:editor' dot-expansion 'yes' # diff --git a/modules/gnu-utility/README.md b/modules/gnu-utility/README.md index eac6d37d..b0dc1eed 100644 --- a/modules/gnu-utility/README.md +++ b/modules/gnu-utility/README.md @@ -17,7 +17,7 @@ Settings ### Prefix -To use a different prefix, add the following to *zshrc*, and replace 'g' with +To use a different prefix, add the following to *zpreztorc*, and replace 'g' with the desired prefix: zstyle ':prezto:module:gnu-utility' prefix 'g' diff --git a/modules/history-substring-search/README.md b/modules/history-substring-search/README.md index 280cbda2..6bfe4e6a 100644 --- a/modules/history-substring-search/README.md +++ b/modules/history-substring-search/README.md @@ -22,7 +22,7 @@ Settings ### Case Sensitivity To enable case-sensitivity for this module only, add the following line to -*zshrc*: +*zpreztorc*: zstyle ':prezto:module:history-substring-search' case-sensitive 'yes' @@ -31,7 +31,8 @@ To enable case-sensitivity for this module only, add the following line to If colors are enabled, *history-substring-search* will automatically highlight positive results. -To enable highlighting for this module only, add the following line to *zshrc*: +To enable highlighting for this module only, add the following line to +*zpreztorc*: zstyle ':prezto:module:history-substring-search' color 'yes' diff --git a/modules/pacman/README.md b/modules/pacman/README.md index 981a3b90..10b47b05 100644 --- a/modules/pacman/README.md +++ b/modules/pacman/README.md @@ -8,14 +8,14 @@ Settings -------- To enable a Pacman frontend, for example, [Yaourt][2], add the following line to -*zshrc*: +*zpreztorc*: zstyle ':prezto:module:pacman' frontend 'yaourt' -If you have enabled color globally in *zshrc*, you may disable it for certain +If you have enabled color globally in *zpreztorc*, you may disable it for certain commands. -To disable `yaourt` highlighting, add the following line to *zshrc*: +To disable `yaourt` highlighting, add the following line to *zpreztorc*: zstyle ':prezto:module:pacman:yaourt' color 'no' diff --git a/modules/prompt/README.md b/modules/prompt/README.md index db2d26cb..80ea030c 100644 --- a/modules/prompt/README.md +++ b/modules/prompt/README.md @@ -6,7 +6,7 @@ Loads prompt [themes][1]. Settings -------- -To select a prompt theme, add the following to *zshrc*, and replace **name** +To select a prompt theme, add the following to *zpreztorc*, and replace **name** with the name of the theme you wish to load. Setting it to **random** will load a random theme. diff --git a/modules/screen/README.md b/modules/screen/README.md index 871e1cf2..976b483a 100644 --- a/modules/screen/README.md +++ b/modules/screen/README.md @@ -10,7 +10,7 @@ Settings Starts a GNU Screen session automatically when Zsh is launched. -To enable this feature, add the following line to *zshrc*: +To enable this feature, add the following line to *zpreztorc*: zstyle ':prezto:module:screen' auto-start 'yes' diff --git a/modules/ssh-agent/README.md b/modules/ssh-agent/README.md index 2f4a0a90..17c5b734 100644 --- a/modules/ssh-agent/README.md +++ b/modules/ssh-agent/README.md @@ -8,13 +8,13 @@ Settings ### Agent Forwarding -To enable ssh-agent forwarding, add the following line to *zshrc*: +To enable ssh-agent forwarding, add the following line to *zpreztorc*: zstyle ':prezto:module:ssh-agent' forwarding 'yes' ### Identities -To load multiple identities, add the following line to *zshrc*: +To load multiple identities, add the following line to *zpreztorc*: zstyle ':prezto:module:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github' diff --git a/modules/syntax-highlighting/README.md b/modules/syntax-highlighting/README.md index 12caf8f7..7fb84e2b 100644 --- a/modules/syntax-highlighting/README.md +++ b/modules/syntax-highlighting/README.md @@ -19,7 +19,8 @@ Settings ### Highlighting -To enable highlighting for this module only, add the following line to *zshrc*: +To enable highlighting for this module only, add the following line to +*zpreztorc*: zstyle ':prezto:module:syntax-highlighting' color 'yes' @@ -28,7 +29,7 @@ To enable highlighting for this module only, add the following line to *zshrc*: Syntax highlighting is accomplished by pluggable [highlighters][2]. This module enables the *main*, *brackets*, and *cursor* highlighters by default. -To enable all highlighters, add the following to *zshrc*: +To enable all highlighters, add the following to *zpreztorc*: zstyle ':prezto:module:syntax-highlighting' highlighters \ 'main' \ diff --git a/modules/terminal/README.md b/modules/terminal/README.md index 751da030..d42645ba 100644 --- a/modules/terminal/README.md +++ b/modules/terminal/README.md @@ -9,7 +9,7 @@ Settings ### Auto-Title To auto set the terminal window and tab titles with the current command or -directory, add the following to *zshrc*: +directory, add the following to *zpreztorc*: zstyle ':prezto:module:terminal' auto-title 'yes' diff --git a/modules/tmux/README.md b/modules/tmux/README.md index f88103b1..dda6dd87 100644 --- a/modules/tmux/README.md +++ b/modules/tmux/README.md @@ -10,7 +10,7 @@ Settings Starts a tmux session automatically when Zsh is launched. -To enable this feature, add the following line to *zshrc*: +To enable this feature, add the following line to *zpreztorc*: zstyle ':prezto:module:tmux' auto-start 'yes' diff --git a/modules/utility/README.md b/modules/utility/README.md index d1503503..ebcc43c5 100644 --- a/modules/utility/README.md +++ b/modules/utility/README.md @@ -8,23 +8,23 @@ Settings ### Highlighting -If you have enabled color globally in *zshrc*, you may disable it for certain +If you have enabled color globally in *zpreztorc*, you may disable it for certain commands. -To disable `ls` color, add the following line to *zshrc*; when coloring is +To disable `ls` color, add the following line to *zpreztorc*; when coloring is disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries. zstyle ':prezto:module:utility:ls' color 'no' -To disable `diff` highlighting, add the following line to *zshrc*: +To disable `diff` highlighting, add the following line to *zpreztorc*: zstyle ':prezto:module:utility:diff' color 'no' -To disable `wdiff` highlighting, add the following line to *zshrc*: +To disable `wdiff` highlighting, add the following line to *zpreztorc*: zstyle ':prezto:module:utility:wdiff' color 'no' -To disable `make` highlighting, add the following line to *zshrc*: +To disable `make` highlighting, add the following line to *zpreztorc*: zstyle ':prezto:module:utility:make' color 'no' diff --git a/runcoms/README.md b/runcoms/README.md index 9b27ca79..28064ddc 100644 --- a/runcoms/README.md +++ b/runcoms/README.md @@ -1,8 +1,10 @@ -Zsh Configuration Files -======================= +Configuration Files +=================== Zsh has several system-wide and user-local configuration files. +Prezto has one user-local configuration file. + System-wide configuration files are installation-dependent but are installed in */etc* by default. @@ -22,10 +24,11 @@ The configuration files are read in the following order: 04. ~/.zprofile 05. /etc/zshrc 06. ~/.zshrc - 07. /etc/zlogin - 08. ~/.zlogin - 09. ~/.zlogout - 10. /etc/zlogout + 07. ~/.zpreztorc + 08. /etc/zlogin + 09. ~/.zlogin + 10. ~/.zlogout + 11. /etc/zlogout ### zshenv @@ -45,7 +48,9 @@ zprofile and zlogin are not meant to be used concurrently but can be done so. This file is sourced by interactive shells. It should define aliases, functions, shell options, and key bindings. -This is the main Prezto configuration file. +## zpreztorc + +This file configures Prezto. ### zlogin diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc new file mode 100644 index 00000000..86ce88e2 --- /dev/null +++ b/runcoms/zpreztorc @@ -0,0 +1,46 @@ +# +# Sets Prezto options. +# +# Authors: +# Sorin Ionescu +# + +# Set the key mapping style to 'emacs' or 'vi'. +zstyle ':prezto:module:editor' keymap 'emacs' + +# Auto convert .... to ../.. +zstyle ':prezto:module:editor' dot-expansion 'no' + +# Set case-sensitivity for completion, history lookup, etc. +zstyle ':prezto:*:*' case-sensitive 'no' + +# Color output (auto set to 'no' on dumb terminals). +zstyle ':prezto:*:*' color 'yes' + +# Auto set the tab and window titles. +zstyle ':prezto:module:terminal' auto-title 'yes' + +# Set the Zsh modules to load (man zshmodules). +# zstyle ':prezto:load' zmodule 'attr' 'stat' + +# Set the Zsh functions to load (man zshcontrib). +# zstyle ':prezto:load' zfunction 'zargs' 'zmv' + +# Set the Prezto modules to load (browse modules). +# The order matters. +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'completion' \ + 'prompt' + +# Set the prompt theme to load. +# Setting it to 'random' loads a random theme. +# Auto set to 'off' on dumb terminals. +zstyle ':prezto:module:prompt' theme 'sorin' + diff --git a/runcoms/zshrc b/runcoms/zshrc index f646f6c4..e87283fc 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -1,49 +1,10 @@ # -# Sets Prezto options. +# Executes commands at the start of an interactive session. # # Authors: # Sorin Ionescu # -# Set the key mapping style to 'emacs' or 'vi'. -zstyle ':prezto:module:editor' keymap 'emacs' - -# Auto convert .... to ../.. -zstyle ':prezto:module:editor' dot-expansion 'no' - -# Set case-sensitivity for completion, history lookup, etc. -zstyle ':prezto:*:*' case-sensitive 'no' - -# Color output (auto set to 'no' on dumb terminals). -zstyle ':prezto:*:*' color 'yes' - -# Auto set the tab and window titles. -zstyle ':prezto:module:terminal' auto-title 'yes' - -# Set the Zsh modules to load (man zshmodules). -# zstyle ':prezto:load' zmodule 'attr' 'stat' - -# Set the Zsh functions to load (man zshcontrib). -# zstyle ':prezto:load' zfunction 'zargs' 'zmv' - -# Set the Prezto modules to load (browse modules). -# The order matters. -zstyle ':prezto:load' pmodule \ - 'environment' \ - 'terminal' \ - 'editor' \ - 'history' \ - 'directory' \ - 'spectrum' \ - 'utility' \ - 'completion' \ - 'prompt' - -# Set the prompt theme to load. -# Setting it to 'random' loads a random theme. -# Auto set to 'off' on dumb terminals. -zstyle ':prezto:module:prompt' theme 'sorin' - # Source Prezto. if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"