diff --git a/README.md b/README.md index 2955fe57dd..32b3498e63 100644 --- a/README.md +++ b/README.md @@ -33,25 +33,6 @@ version is 4.3.10. 5. Open a new Zsh terminal window or tab. -### Mac OS X - -If you have administrator privileges, you must fix an Apple-introduced problem -in Mac OS X 10.5 Leopard by executing the following command, or BASH and Zsh -will have the wrong `PATH` when executed non-interactively. - - sudo chmod ugo-x /usr/libexec/path_helper - -`path_helper` is intended to make it easier for installers to add new paths to -the environment without having to edit shell configuration files by adding -a file with a path to the */etc/paths.d* directory. - -Unfortunately, `path_helper` always reads paths from */etc/paths* set by Apple -then paths from */etc/paths.d* set by third party installers, and lastly paths -from the `PATH` environment variable set by the parent process, which -ultimately is set by the user with `export PATH=...` Thus, it reorders path -priorities, and user */bin* directories meant to override system */bin* -directories end up at the tail of the array. - ### Troubleshooting If you are not able to find certain commands after switching to *Prezto*, diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index ae253f25c1..d76c605719 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -90,12 +90,11 @@ key_info=( 'BackTab' "$terminfo[kcbt]" ) -# Do not bind any keys if there are empty values in $key_info. +# Set empty $key_info values to an invalid UTF-8 sequence to induce silent +# bindkey failure. for key in "${(k)key_info[@]}"; do if [[ -z "$key_info[$key]" ]]; then - print "prezto: one or more keys are non-bindable" >&2 - unset key{,_info} - return 1 + key_info["$key"]='�' fi done diff --git a/modules/emacs/README.md b/modules/emacs/README.md new file mode 100644 index 0000000000..fa9a514b39 --- /dev/null +++ b/modules/emacs/README.md @@ -0,0 +1,33 @@ +Emacs +===== + +Enables Emacs dependency management. + +Dependency management +--------------------- + +[Carton][1] installs and manages Emacs packages for Emacs package development +and Emacs configuration. + +This module prepends the Carton directory to the path variable to enable the +execution of `carton`. + +Aliases +------- + +### Carton + + - `cai` installs dependencies. + - `cau` updates dependencies. + - `caI` initializes the current directory for dependency management. + - `cae` executes a command which correct dependencies. + +Authors +------- + +*The authors of this module should be contacted via the [issue tracker][2].* + + - [Sebastian Wiesner](https://github.com/lunaryorn) + +[1]: https://github.com/rejeep/carton +[2]: https://github.com/sorin-ionescu/prezto/issues diff --git a/modules/emacs/init.zsh b/modules/emacs/init.zsh new file mode 100644 index 0000000000..c24625d1f8 --- /dev/null +++ b/modules/emacs/init.zsh @@ -0,0 +1,15 @@ +# +# Configures Emacs dependency management. +# +# Authors: Sebastian Wiesner +# + +# Enable Carton +if [[ -d "$HOME/.carton" ]]; then + path=($HOME/.carton/bin $path) + + alias cai='carton install' + alias cau='carton update' + alias caI='carton init' + alias cae='carton exec' +fi diff --git a/modules/git/README.md b/modules/git/README.md index 6eeb3216be..717f42bb14 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -53,7 +53,7 @@ Aliases - `gca` stages all modified and deleted files. - `gcm` records changes to the repository with the given message. - `gco` checks out a branch or paths to work tree. - - `gcO` checks out paths to work tree using the *HEAD* commit. + - `gcO` checks out hunks from the index or the tree interactively. - `gcf` amends the tip of the current branch using the same log message as *HEAD*. - `gcF` amends the tip of the current branch. @@ -98,8 +98,8 @@ Aliases - `giu` adds file contents to the index (updates only known files). - `gid` displays changes between the index and a named commit (diff). - `giD` displays changes between the index and a named commit (word diff). - - `gir` resets current HEAD to the specified state. - - `giR` resets current index to the specified state. + - `gir` resets the current HEAD to the specified state. + - `giR` resets the current index interactively. - `gix` removes files/directories from the index (recursively). - `giX` removes files/directories from the index (recursively and forced). diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 9af1c8a755..4cb10dc2ce 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -42,13 +42,13 @@ alias gbs='git show-branch' alias gbS='git show-branch -a' # Commit (c) -alias gc='git commit' -alias gca='git commit --all' +alias gc='git commit --verbose' +alias gca='git commit --verbose --all' alias gcm='git commit --message' alias gco='git checkout' -alias gcO='git checkout HEAD --' +alias gcO='git checkout --patch' alias gcf='git commit --amend --reuse-message HEAD' -alias gcF='git commit --amend' +alias gcF='git commit --verbose --amend' alias gcp='git cherry-pick --ff' alias gcP='git cherry-pick --no-commit' alias gcr='git revert' @@ -86,7 +86,7 @@ alias giu='git add --update' alias gid='git diff --no-ext-diff --cached' alias giD='git diff --no-ext-diff --cached --word-diff' alias gir='git reset' -alias giR='git reset --keep' +alias giR='git reset --patch' alias gix='git rm -r --cached' alias giX='git rm -rf --cached' diff --git a/modules/gpg-agent/init.zsh b/modules/gpg-agent/init.zsh index 6d010d2813..82bd9a2ec4 100644 --- a/modules/gpg-agent/init.zsh +++ b/modules/gpg-agent/init.zsh @@ -4,6 +4,7 @@ # Authors: # Florian Walch # Sorin Ionescu +# neersighted # # Return if requirements are not found. @@ -11,7 +12,8 @@ if (( ! $+commands[gpg-agent] )); then return 1 fi -_gpg_env="$HOME/.gnupg/gpg-agent.env" +# Make sure to use the $GNUPGHOME first. +_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.env" function _gpg-agent-start { local ssh_support @@ -20,7 +22,8 @@ function _gpg-agent-start { || ssh_support='' gpg-agent \ - --daemon ${ssh_support:+'--enable-ssh-support'} + --daemon \ + ${ssh_support:+'--enable-ssh-support'} \ --write-env-file "${_gpg_env}" > /dev/null chmod 600 "${_gpg_env}" @@ -41,4 +44,3 @@ export GPG_AGENT_INFO export SSH_AUTH_SOCK export SSH_AGENT_PID export GPG_TTY="$(tty)" - diff --git a/modules/haskell/init.zsh b/modules/haskell/init.zsh index 8690ce1872..c1c78ca2a0 100644 --- a/modules/haskell/init.zsh +++ b/modules/haskell/init.zsh @@ -10,11 +10,9 @@ if (( ! $+commands[ghc] )); then return 1 fi -# Prepend Cabal per user directories to PATH/MANPATH. +# Prepend Cabal per user directories to PATH. if [[ "$OSTYPE" == darwin* && -d $HOME/Library/Haskell ]]; then path=($HOME/Library/Haskell/bin(/N) $path) - manpath=($HOME/Library/Haskell/man(/N) $manpath) else path=($HOME/.cabal/bin(/N) $path) - manpath=($HOME/.cabal/man(/N) $manpath) fi diff --git a/modules/macports/init.zsh b/modules/macports/init.zsh index 4554ca1fb5..5698114855 100644 --- a/modules/macports/init.zsh +++ b/modules/macports/init.zsh @@ -15,18 +15,6 @@ fi # Paths # -# Set the list of directories that info searches for manuals. -infopath=( - /opt/local/share/info - $infopath -) - -# Set the list of directories that man searches for manuals. -manpath=( - /opt/local/share/man - $manpath -) - # Set the list of directories that Zsh searches for programs. path=( /opt/local/{bin,sbin} diff --git a/modules/node/README.md b/modules/node/README.md index 58f2b082ec..c0174ebbea 100644 --- a/modules/node/README.md +++ b/modules/node/README.md @@ -1,13 +1,34 @@ Node.js ======= -Provides utility functions for [Node.js][1] and loads [npm][2] completion. +Provides utility functions for [Node.js][1], loads the Node Version Manager, and +enables [npm][2] completion. + +nvm +--- + +[nvm][5] allows for managing multiple, isolated Node.js installations in the +home directory. Functions --------- - `node-doc` opens the Node.js online [API documentation][3] in the default browser. + - `node-info` exposes information about the Node.js environment via the + `$node_info` associative array. + +Theming +------- + +To display the version number of the current Node.js version, define the +following style inside the `prompt_name_setup` function. + + # %v - Node.js version. + zstyle ':prezto:module:node:info:version' format 'version:%v' + +Then add `$node_info[version]` to either `$PROMPT` or `$RPROMPT` and call +`node-info` in `prompt_name_preexec` hook function. Authors ------- @@ -15,9 +36,11 @@ Authors *The authors of this module should be contacted via the [issue tracker][4].* - [Sorin Ionescu](https://github.com/sorin-ionescu) + - [Zeh Rizzatti](https://github.com/zehrizzatti) [1]: http://nodejs.org [2]: http://npmjs.org [3]: http://nodejs.org/api [4]: https://github.com/sorin-ionescu/prezto/issues +[5]: https://github.com/creationix/nvm diff --git a/modules/node/functions/node-info b/modules/node/functions/node-info new file mode 100644 index 0000000000..2af5042eb0 --- /dev/null +++ b/modules/node/functions/node-info @@ -0,0 +1,25 @@ +# +# Exposes information about the Node.js environment via the $node_info +# associative array. +# +# Authors: +# Zeh Rizzatti +# + +local version +local version_format +local version_formatted + +unset node_info +typeset -gA node_info + +if (( $+functions[nvm_version] )); then + version="${$(nvm_version)#v}" +fi + +if [[ -n "$version" ]]; then + zstyle -s ':prezto:module:node:info:version' format 'version_format' + zformat -f version_formatted "$version_format" "v:$version" + node_info[version]="$version_formatted" +fi + diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 16847abccb..904d24d931 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -1,10 +1,16 @@ # -# Completes npm. +# Loads the Node Version Manager and enables npm completion. # # Authors: # Sorin Ionescu +# Zeh Rizzatti # +# Load NVM into the shell session. +if [[ -s "$HOME/.nvm/nvm.sh" ]]; then + source "$HOME/.nvm/nvm.sh" +fi + # Return if requirements are not found. if (( ! $+commands[node] )); then return 1 diff --git a/modules/osx/README.md b/modules/osx/README.md index bb74ef5518..498ed2e506 100644 --- a/modules/osx/README.md +++ b/modules/osx/README.md @@ -20,7 +20,6 @@ Functions - `pfd` prints the current _Finder_ directory. - `pfs` prints the current _Finder_ selection. - `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]). - - `trash` moves files and folders to _Trash_. Authors ------- diff --git a/modules/osx/functions/trash b/modules/osx/functions/trash deleted file mode 100644 index d392437311..0000000000 --- a/modules/osx/functions/trash +++ /dev/null @@ -1,27 +0,0 @@ -# -# Moves directories and files to Trash. -# -# Authors: -# Sorin Ionescu -# - -print -N "${@:a}" | xargs -0 osascript -e ' - on run theFilePaths - tell application "Finder" - set thePOSIXFiles to {} - repeat with aFilePath in theFilePaths - set aPOSIXFile to aFilePath as POSIX file - if exists aPOSIXFile - set end of thePOSIXFiles to aPOSIXFile - end if - end repeat - move every item of thePOSIXFiles to trash - end tell - end run -' &>/dev/null - -if (( $? != 0)); then - print "$0: failed to move one or more items" >&2 - return 1 -fi - diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 62701283ac..0997a4b2bf 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -20,8 +20,6 @@ if [[ "$OSTYPE" == darwin* ]]; then perl_path="$HOME/Library/Perl/5.12" if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then - manpath=("$perl_path/man" $manpath) - if [[ ! -s "$cache_file" ]]; then perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file" fi @@ -31,12 +29,6 @@ if [[ "$OSTYPE" == darwin* ]]; then unset perl_path unset cache_file - - # Set environment variables for launchd processes. - for env_var in PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT PERL5LIB; do - launchctl setenv "$env_var" "${(P)env_var}" &! - done - unset env_var fi # diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index 3c2c55f5b3..796da78f38 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -58,7 +58,7 @@ function prompt_sorin_setup { zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f' zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}✖%f%%b' zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b' - zstyle ':prezto:module:git:info:position' format ':%F{green}%p%f' + zstyle ':prezto:module:git:info:position' format ':%F{red}%p%f' zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b' zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b' zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b' diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 11875612b7..a72f01f9ca 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -17,14 +17,12 @@ if (( ! $+commands[python] && ! $+commands[pythonz] )); then fi # Prepend PEP 370 per user site packages directory, which defaults to -# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH/MANPATH. +# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. if [[ "$OSTYPE" == darwin* ]]; then path=($HOME/Library/Python/*/bin(N) $path) - manpath=($HOME/Library/Python/*/{,share/}man(N) $manpath) else # This is subject to change. path=($HOME/.local/bin $path) - manpath=($HOME/.local/{,share/}man(N) $manpath) fi # Load virtualenvwrapper into the shell session. diff --git a/runcoms/zlogin b/runcoms/zlogin index a639d52d94..2b4b3623f3 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -12,13 +12,6 @@ if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then zcompile "$zcompdump" fi - - # Set environment variables for launchd processes. - if [[ "$OSTYPE" == darwin* ]]; then - for env_var in PATH MANPATH; do - launchctl setenv "$env_var" "${(P)env_var}" - done - fi } &! # Print a random, hopefully interesting, adage. diff --git a/runcoms/zshenv b/runcoms/zshenv index 5e6c58b43d..0f8738bffa 100644 --- a/runcoms/zshenv +++ b/runcoms/zshenv @@ -26,66 +26,39 @@ export PAGER='less' # if [[ -z "$LANG" ]]; then - eval "$(locale)" -fi - -# -# Less -# - -# Set the default Less options. -# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). -# Remove -X and -F (exit if the content fits on one screen) to enable it. -export LESS='-F -g -i -M -R -S -w -X -z-4' - -# Set the Less input preprocessor. -if (( $+commands[lesspipe.sh] )); then - export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' + export LANG='en_US.UTF-8' fi # # Paths # -typeset -gU cdpath fpath mailpath manpath path -typeset -gUT INFOPATH infopath +typeset -gU cdpath fpath mailpath path # Set the the list of directories that cd searches. # cdpath=( # $cdpath # ) -# Set the list of directories that info searches for manuals. -infopath=( - /usr/local/share/info - /usr/share/info - $infopath -) - -# Set the list of directories that man searches for manuals. -manpath=( - /usr/local/share/man - /usr/share/man - $manpath -) - -for path_file in /etc/manpaths.d/*(.N); do - manpath+=($(<$path_file)) -done -unset path_file - # Set the list of directories that Zsh searches for programs. path=( /usr/local/{bin,sbin} - /usr/{bin,sbin} - /{bin,sbin} $path ) -for path_file in /etc/paths.d/*(.N); do - path+=($(<$path_file)) -done -unset path_file +# +# Less +# + +# Set the default Less options. +# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). +# Remove -X and -F (exit if the content fits on one screen) to enable it. +export LESS='-F -g -i -M -R -S -w -X -z-4' + +# Set the Less input preprocessor. +if (( $+commands[lesspipe.sh] )); then + export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' +fi # # Temporary Files