From 3e5e108eaa99348d65119399ffac7854f97b0856 Mon Sep 17 00:00:00 2001 From: huyz Date: Tue, 11 Dec 2012 21:49:01 -0800 Subject: [PATCH] Improve less options Remove silly message on logout display non-success exit value for every command Add first version of modules and load them up Add more paths Allow the sharing of prezto files by differentiating ZDOTDIR and where temp cache files will go: _ZDOTDIR/HOME remove Vim swap files Allow for both a shared and personal overriding .zpreztorc In shared system, put .zcompdump in user's home Fix path of .zcompdump Fixed names of prompt Support callbacks to override user & host value & style Fix transpose* bindings for vi and ^Y for emacs Fixed ordering of paths --- .gitignore | 2 + init.zsh | 4 + modules/completion/init.zsh | 8 +- modules/fasd/init.zsh | 4 +- modules/history/init.zsh | 4 +- modules/huy-editor/init.zsh | 112 +++++++++ modules/huy-reset/init.zsh | 10 + modules/huy-utility/init.zsh | 66 +++++ modules/node/init.zsh | 4 +- modules/perl/init.zsh | 4 +- .../prompt/functions/prompt_progressive_setup | 229 ++++++++++++++++++ runcoms/zlogin | 4 +- runcoms/zlogout | 10 +- runcoms/zpreztorc | 18 +- runcoms/zshenv | 32 ++- runcoms/zshrc | 3 + 16 files changed, 500 insertions(+), 14 deletions(-) create mode 100644 modules/huy-editor/init.zsh create mode 100644 modules/huy-reset/init.zsh create mode 100644 modules/huy-utility/init.zsh create mode 100644 modules/prompt/functions/prompt_progressive_setup diff --git a/.gitignore b/.gitignore index e05465fe..7bc8a740 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +*.swp +*.swo *.zwc *.zwc.old modules/*/cache.zsh diff --git a/init.zsh b/init.zsh index fc12297c..58871fd2 100644 --- a/init.zsh +++ b/init.zsh @@ -90,6 +90,10 @@ function pmodload { if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then source "${ZDOTDIR:-$HOME}/.zpreztorc" fi +# huy: Let a shared zpreztorc file count first (where ZDOTDIR is the location of the shared files) +if [[ "${_ZDOTDIR:-$HOME}" != "${ZDOTDIR:-$HOME}" && -s "${_ZDOTDIR:-$HOME}/.zpreztorc" ]]; then + source "${_ZDOTDIR:-$HOME}/.zpreztorc" +fi # Disable color and theme in dumb terminals. if [[ "$TERM" == 'dumb' ]]; then diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index de59a5d2..d991107e 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -15,7 +15,9 @@ fi fpath=("${0:h}/external/src" $fpath) # Load and initialize the completion system ignoring insecure directories. -autoload -Uz compinit && compinit -i +# huy: allow the sharing of prezto files +#autoload -Uz compinit && compinit -i +autoload -Uz compinit && compinit -i -d "${_ZDOTDIR:-$HOME}/.zcompdump" # # Options @@ -39,7 +41,9 @@ WORDCHARS='*?_-.[]~&;!#$%^(){}<>' # Use caching to make completion for cammands such as dpkg and apt usable. zstyle ':completion::complete:*' use-cache on -zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache" +# huy: use the user's home directory +#zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache" +zstyle ':completion::complete:*' cache-path "${_ZDOTDIR:-$HOME}/.zcompcache" # Case-insensitive (all), partial-word, and then substring completion. if zstyle -t ':prezto:module:completion:*' case-sensitive; then diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index 7088e9c6..de8f0d4f 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -18,7 +18,9 @@ fi # Initialization # -cache_file="${0:h}/cache.zsh" +# huy: use the user's home directory +#cache_file="${0:h}/cache.zsh" +cache_file="${_ZDOTDIR:-$HOME}/.zprezto.fasd.cache.zsh" if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then # Set the base init arguments. init_args=(zsh-hook) diff --git a/modules/history/init.zsh b/modules/history/init.zsh index 31db4c5b..337fcf20 100644 --- a/modules/history/init.zsh +++ b/modules/history/init.zsh @@ -10,7 +10,9 @@ # Variables # -HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file. +# huy: use the user's home directory +#HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file. +HISTFILE="${_ZDOTDIR:-$HOME}/.zhistory" # The path to the history file. HISTSIZE=10000 # The maximum number of events to save in the internal history. SAVEHIST=10000 # The maximum number of events to save in the history file. diff --git a/modules/huy-editor/init.zsh b/modules/huy-editor/init.zsh new file mode 100644 index 00000000..ad2fa372 --- /dev/null +++ b/modules/huy-editor/init.zsh @@ -0,0 +1,112 @@ +# Huy's enhancement of Prezto's bindings +# +# In VI insert mode, these control-keys are still available. +# (Plus all the escape command such as \eM) +# ^Y +# ^N (not a useful binding right now) + +# These bindings depend on and work in conjunction with prezto's 'editor' module. +pmodload 'editor' + +# +# ZLE Widgets +# + +#zle -N insert-nth-last-word +function insert-next-to-last-word() { zle insert-last-word -- -1 -2 } +zle -N insert-next-to-last-word +function insert-more-recent-last-word() { zle insert-last-word -- 1 -1 } +zle -N insert-more-recent-last-word +function insert-more-recent-next-to-last-word() { zle insert-last-word -- 1 -2 } +zle -N insert-more-recent-next-to-last-word +zle -C hist-complete complete-word _generic +zstyle ':completion:hist-complete:*' completer _history + +# +# Reset prezto's annoying bindings +# + +# Undo terrible bindings in 'completion' module +# https://github.com/sorin-ionescu/prezto/issues/338 +bindkey -M viins -r "jk" +bindkey -M viins -r "kj" + +# Undo prezto's zsh-history-substring-search bindings +bindkey -M vicmd 'k' up-line-or-history +bindkey -M vicmd 'j' down-line-or-history + +# +# Some Emacs Key Bindings +# Copied from 'editor' module. +# NOTE: we can't take the ones that are ambiguous: ESC k could mean +# "go to cmd mode and go up" and this ambiguity slows down vi mode. +# + +# Edit command in an external editor. +bindkey -M viins "$key_info[Control]X$key_info[Control]E" edit-command-line + +if (( $+widgets[history-incremental-pattern-search-backward] )); then + bindkey -M viins "$key_info[Control]R" \ + history-incremental-pattern-search-backward + bindkey -M viins "$key_info[Control]S" \ + history-incremental-pattern-search-forward +fi + +# +# Some Emacs and Vi Key Bindings (but for Vi command mode) +# Copied from 'editor' module. +# + +for keymap in 'vicmd'; do + # Complete in the middle of word. + bindkey -M "$keymap" "$key_info[Control]I" expand-or-complete + + # Use a more flexible push-line. + for key in "$key_info[Control]Q" + bindkey -M "$keymap" "$key" push-line-or-edit +done + +# +# Custom bindings +# + +# Just as with emacs +bindkey -M viins "$key_info[Control]T" transpose-chars +bindkey -M viins "$key_info[Escape]t" transpose-words + +# Cancel the current completion (undo the completion) +bindkey -M viins "$key_info[Control]Y" undo + +# To be more like vim +bindkey -M vicmd 'J' vi-join +bindkey -M vicmd ':' execute-named-cmd +bindkey -M vicmd '_' execute-last-named-cmd + +# Expand things +bindkey -M viins "$key_info[Control]P" hist-complete + +# Pick out arguments from previous lines (in both directions) +bindkey -M viins "$key_info[Control]O" insert-last-word +bindkey -M viins "$key_info[Control]K" insert-more-recent-last-word +bindkey -M viins "$key_info[Control]E" insert-next-to-last-word +bindkey -M viins "$key_info[Control]A" insert-more-recent-next-to-last-word + +# Complete on line-wise prefixes +bindkey -M viins "$key_info[Control]B" history-beginning-search-backward +bindkey -M vicmd "$key_info[Control]B" history-beginning-search-backward +bindkey -M viins "$key_info[Control]F" history-beginning-search-forward +bindkey -M vicmd "$key_info[Control]F" history-beginning-search-forward + +# This allows you to edit your $PWD with the zle +for keymap in viins emacs + bindkey -M "$keymap" -s '^Z' $'cd $PWD\t' + +# +# Marginally-useful bindigns +# + +# Search in the history list for a line matching the current one and fetch +# the event following +bindkey '^N' infer-next-history # not very useful + +unset key{map,} diff --git a/modules/huy-reset/init.zsh b/modules/huy-reset/init.zsh new file mode 100644 index 00000000..69730976 --- /dev/null +++ b/modules/huy-reset/init.zsh @@ -0,0 +1,10 @@ +# This file is to undo or reset some of the bad defaults in Prezto + +# Undo terrible bindings in 'completion' module +# https://github.com/sorin-ionescu/prezto/issues/338 +bindkey -M viins -r "jk" +bindkey -M viins -r "kj" + +# People will do -h if they want to +alias df='df -k' +alias du='du -k' diff --git a/modules/huy-utility/init.zsh b/modules/huy-utility/init.zsh new file mode 100644 index 00000000..cab1c61e --- /dev/null +++ b/modules/huy-utility/init.zsh @@ -0,0 +1,66 @@ +# General utilities that should be useful for all of us + +# Useful +setopt interactivecomments +setopt numericglobsort +setopt cshnullglob +# Report CPU usage stats if user+system > 5 seconds +REPORTTIME=5 + +# Minor +setopt histnostore +setopt kshoptionprint + +############################################################################## +### Global alias + +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' + +# Use at the end of the line to quickly redirect +alias -g 1NUL=">/dev/null" +alias -g 2NUL="2>/dev/null" +alias -g NUL=">/dev/null 2>&1" + +############################################################################## +### Common commands + +# Command line +function h { + history -d "${argv[1]:--$[ ${LINES:-24} - 3 ]}" "${(@)argv[2,-1]}" | $PAGER +} + +### ls (which works on Linux, OS X, and OS X with GNU coreutils installed by Homebrew) + +zstyle -s ':prezto:module:gnu-utility' prefix '_gnu_utility_p' || _gnu_utility_p='g' + +if is-callable 'dircolors'; then + # GNU Core Utilities + _ls_color_flag=--color=always +else + # BSD Core Utilities + _ls_color_flag=-G +fi + +# NOTE: The $_ls_color_flag goes after "$@" because prezto defines an alias which has +# --color=auto that we want to override +_gnu_utility_pcmd="${_gnu_utility_p}ls" +if (( ${+commands[${_gnu_utility_pcmd}]} )); then + _gnu_utility_ls="'${commands[${_gnu_utility_pcmd}]}'" +else + _gnu_utility_ls="command ls" +fi +eval " + function ls { + $_gnu_utility_ls -ACF \"\$@\" $_ls_color_flag | \$PAGER -e + } +" +alias ll="$aliases[ll] -a" + +unset _gnu_utility_{p,cmds,cmd,pcmd,ls} _ls_color_flag + +### Network commands + +# Occasional commands +alias mtr='mtr --curses' diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 16847abc..74e6d2f6 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -12,7 +12,9 @@ fi # Load NPM completion. if (( $+commands[npm] )); then - cache_file="${0:h}/cache.zsh" + # huy: use the user's home directory + #cache_file="${0:h}/cache.zsh" + cache_file="${_ZDOTDIR:-$HOME}/.zprezto.node.cache.zsh" if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then # npm is slow; cache its output. diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 62701283..a93e9a84 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -16,7 +16,9 @@ fi if [[ "$OSTYPE" == darwin* ]]; then # Perl is slow; cache its output. - cache_file="${0:h}/cache.zsh" + # huy: use the user's home directory + #cache_file="${0:h}/cache.zsh" + cache_file="${_ZDOTDIR:-$HOME}/.zprezto.perl.cache.zsh" perl_path="$HOME/Library/Perl/5.12" if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then diff --git a/modules/prompt/functions/prompt_progressive_setup b/modules/prompt/functions/prompt_progressive_setup new file mode 100644 index 00000000..9a6c81db --- /dev/null +++ b/modules/prompt/functions/prompt_progressive_setup @@ -0,0 +1,229 @@ +# Progressive theme that displays only relevant information as needed. +# Builds on both sorin and nicoulaj theme. +# +# Features: +# - Multiple verbosity styles: +# - One or multiple lines +# - In minimal style, shows user@hostname if connected through SSH. +# - toggle with aliases "P 0" ... "P 5" +# - VCS information in the right prompt. +# - Supports prezto's git-info if 'git' module is loaded, or zsh's default vcs_info otherwise +# - If using the default vcs_info module: +# - Only shows the path on the left prompt by default. +# - Crops the path to a defined length and only shows the path relative to +# the current VCS repository root. +# - Shows if logged in as root or not. +# - Shows number of jobs +# - Shows shell level if greater than 1 +# - Colors work with Solarized 8-bit ANSI colors +# - Supports callbacks for customizing style and value of user and hostname + +# Load dependencies. +pmodload 'helper' + +function prompt_progressive_precmd { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + + # Get Git repository information. + if (( $+functions[git-info] )); then + if git-info; then + # Some functionality not provided by git-info + #git_info[remote]="$(git remote -v | fgrep fetch | sed 's/.*[\/:]\([^:\/][^:\/]*\)\.git.*/\1/')" + git_info[repo]=$(basename $(git rev-parse --show-toplevel)) + fi + else + vcs_info + fi +} + +function prompt_progressive_load() { + uptime | sed 's/.*: *//;s/,//g' +} + +# @param verbosity From 0 to 5 with 2 as default +function prompt_progressive_setup { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) + + # Load required functions. + autoload -Uz add-zsh-hook + # If git module is loaded, use that, otherwise get standard zsh vcs_info + if (( $+functions[git-info] )); then + # Set git-info parameters (from sorin prompt) + zstyle ':prezto:module:editor:info:completing' format '%F{magenta}...%f' + zstyle ':prezto:module:editor:info:keymap:primary' format '%#' + zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{yellow}⎋%f' + zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '%F{red}➨%f' + zstyle ':prezto:module:git:info:action' format '%F{yellow}%s%f%%b' + zstyle ':prezto:module:git:info:added' format ' %F{green}✚%f%%b' + zstyle ':prezto:module:git:info:ahead' format ' %F{yellow}⬆%f%%b' + zstyle ':prezto:module:git:info:behind' format ' %F{yellow}⬇%f%%b' + zstyle ':prezto:module:git:info:branch' format '%F{blue}%b%f' + zstyle ':prezto:module:git:info:commit' format '%F{blue}%.7c%f' + zstyle ':prezto:module:git:info:deleted' format ' %F{red}✖%f%%b' + zstyle ':prezto:module:git:info:modified' format ' %%B%F{magenta}✱%f%%b' + zstyle ':prezto:module:git:info:position' format '%F{blue}%p%f' + zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b' + zstyle ':prezto:module:git:info:stashed' format ' %F{cyan}✭%f%%b' + zstyle ':prezto:module:git:info:unmerged' format ' %F{yellow}═%f%%b' + zstyle ':prezto:module:git:info:untracked' format ' %F{magenta}?%f%%b' + zstyle ':prezto:module:git:info:keys' format \ + 'prompt' '%F{green}${git_info[repo]:+$git_info[repo]:}%f$(coalesce "%b" "%p" "%c")%s' \ + 'rprompt' '%A%B%a%d%m%r%U%u%S' + + # Our extensions + zstyle ':prezto:module:git:info:repo' format ':%%B%F{yellow}%R%f%%b' + else + autoload -Uz vcs_info + + local vcs_info_color='%F{242}' + + # Set vcs_info parameters. + zstyle ':vcs_info:*' enable git hg svn + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' stagedstr '%F{green}✚%{%}' + zstyle ':vcs_info:*' unstagedstr '%F{red}?%{%}' + + # On OS X, see /usr/share/zsh/4.3.11/functions/VCS_INFO_formats for docs: + # %r: repo + # %s: VCS, e.g. 'git' + # %b: branch + # %u: unstaged + # %c: staged + #zstyle ':vcs_info:*' actionformats "%S" "%r/%s/%b %u%c (%a)" + #zstyle ':vcs_info:*' formats "%S" "%r/%s/%b %u%c" + zstyle ':vcs_info:*' actionformats "√%%S" "[%r:%B%F{magenta}%b%f %u%c (%a)" + zstyle ':vcs_info:*' formats "√%S" "[%r:%B%F{magenta}%b%{%} %u%c]" + zstyle ':vcs_info:*' nvcsformats "%~" "" + fi + + # Add hook for calling vcs_info before each command. + add-zsh-hook precmd prompt_progressive_precmd + + # Customizable parameters. + local max_path_chars=50 + + # Style + if [[ "$1" == --init ]]; then + local init=1 + shift + fi + local style='' + case "$1" in + 0) style=bare ;; + 1) style=minimal ;; + 3) style=unabbreviated ;; + 4) style=multiline ;; + 5) style=verbose ;; + 2|) style=concise ;; + *) style="$1" ;; + esac + [[ -z "$init" ]] && print -P "Switching to '%F{blue}$style%f' style of '%F{green}progressive%f' prompt." + + + ### Process username and hostname + + local user host + + user="%F{green}%n%f" + user_unformatted="%n" + if (( $+functions[prompt_map_user] )); then + prompt_map_user $USERNAME + user="$prompt_info_user" + user_unformatted="$prompt_info_user_unformatted" + fi + + host="%m" + host_unformatted="%m" + if (( $+functions[prompt_map_host] )); then + prompt_map_host $HOST + host="$prompt_info_host" + host_unformatted="$prompt_info_host_unformatted" + fi + + ### Define prompt + + if [[ $style == bare ]]; then + PS1='%# ' + RPS1='' + return + fi + + local P + + if [[ $style == 'verbose' ]]; then + # Insert the time + P+='%F{blue}%*%f ' + fi + + if [[ $style != 'minimal' || -n "$SSH_TTY" ]]; then + # Username and host + P+="${user}@${host} " + fi + + # Start coloring path + P+="%F{cyan}" + + if [[ $style != (unabbreviated|multiline|verbose) ]]; then + # Limit the amount of space taken by the rest of the line + P+="%${max_path_chars}<…<" + fi + + # Print up to 5 elements of the current directory + #P+="%5~%f" + if (( $+functions[git-info] )); then + P+='%~' + else + # Print current directory or, if inside repo, path relative to that + P+='${vcs_info_msg_0_}' + fi + # Stop coloring path + P+="%f" + # Number of background jobs + P+="%1(j. %jJ.)" + # Shell level if greater than 1 + P+="%(2L/ L1/)" + + if [[ $style == (multiline|verbose) ]]; then + P+=" +" + else + # Separator + ##P+=" " + fi + + # Add names and titles to window and tab titles + # (not needed because that's handled by 'terminal' module) + #P+="%{]2;${user_unformatted}@${host_unformatted}: %~]1;%1~%}" + # Terminate the line with character that depends on mode + if (( $+functions[git-info] )); then + P+='${editor_info[overwrite]:-${editor_info[keymap]}} ' + else + P+='%# ' + fi + + PS1="$P" + + # Right prompt contains VCS info and maybe load + local R + if (( $+functions[git-info] )); then + R+='${git_info:+[${(e)git_info[prompt]}${git_info[rprompt]}]}' + else + R+="${vcs_info_color}"'${vcs_info_msg_1_}'"%f" + fi + if [[ $style == 'verbose' ]]; then + R+=" ($(prompt_progressive_load))" + fi + RPROMPT="$R" +} + +# Allows quick switching of prompts at command line; e.g. +# P 0 +# P 5 +# P verbose +alias P='prompt_progressive_setup' + +prompt_progressive_setup --init "$@" + diff --git a/runcoms/zlogin b/runcoms/zlogin index e27e2332..d67142ce 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -8,7 +8,9 @@ # Execute code that does not affect the current session in the background. { # Compile the completion dump to increase startup speed. - zcompdump="${ZDOTDIR:-$HOME}/.zcompdump" + # huy: use the user's home directory + #zcompdump="${ZDOTDIR:-$HOME}/.zcompdump" + zcompdump="${_ZDOTDIR:-$HOME}/.zcompdump" if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then zcompile "$zcompdump" fi diff --git a/runcoms/zlogout b/runcoms/zlogout index d898fec1..f291f18a 100644 --- a/runcoms/zlogout +++ b/runcoms/zlogout @@ -6,9 +6,9 @@ # # Print the message. -cat <<-EOF - -Thank you. Come again! - -- Dr. Apu Nahasapeemapetilon -EOF +#cat <<-EOF +# +#Thank you. Come again! +# -- Dr. Apu Nahasapeemapetilon +#EOF diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 27aad49b..3ae67fe1 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -24,6 +24,8 @@ zstyle ':prezto:*:*' color 'yes' # Set the Prezto modules to load (browse modules). # The order matters. zstyle ':prezto:load' pmodule \ + 'gnu-utility' \ + \ 'environment' \ 'terminal' \ 'editor' \ @@ -32,7 +34,21 @@ zstyle ':prezto:load' pmodule \ 'spectrum' \ 'utility' \ 'completion' \ - 'prompt' + 'prompt' \ + \ + 'command-not-found' \ + 'syntax-highlighting' \ + 'history-substring-search' \ + 'archive' \ + 'git' \ + 'screen' \ + 'python' \ + 'node' \ + 'dpkg' \ + 'fasd' \ + 'huy-reset' \ + 'huy-editor' \ + 'huy-utility' \ # # Editor diff --git a/runcoms/zshenv b/runcoms/zshenv index 5e6c58b4..50ada902 100644 --- a/runcoms/zshenv +++ b/runcoms/zshenv @@ -36,7 +36,9 @@ fi # 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' +export LESS='-F -i -M -R -w -X -z-4' +# huy: improve less options +export LESS="${${LESS/-g /}/-S /} -j4" # Set the Less input preprocessor. if (( $+commands[lesspipe.sh] )); then @@ -98,3 +100,31 @@ if [[ -d "$TMPDIR" ]]; then fi fi +# +# huy: more paths +# + +typeset -T NODE_PATH node_path +typeset -U path manpath fpath classpath pythonpath perl5lib node_path + +# Add some other paths +for path_dir in \ + /opt/local/bin \ + /opt/local/sbin \ + /brew/bin \ + /brew/sbin \ + /brew/share/npm/bin \ + ~/bin \ +; do + [[ -d $path_dir ]] && path=($path_dir $path) +done + +# Add some other paths +for path_dir in \ + /opt/local/man \ + /brew/share/man \ + ~/man \ +; do + [[ -d $path_dir ]] && manpath=($path_dir $manpath) +done +unset path_dir diff --git a/runcoms/zshrc b/runcoms/zshrc index e87283fc..4337a64e 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -12,3 +12,6 @@ fi # Customize to your needs... +# huy: display non-success exit value for every command +# This cannot be put in a module as it's always scoped to the enclosing function +setopt printexitvalue