diff --git a/README.md b/README.md index 42c68532..e54a6319 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ License (The MIT License) Copyright (c) 2009-2011 Robby Russell and contributors. -Copyright (c) 2011-2014 Sorin Ionescu and contributors. + +Copyright (c) 2011-2015 Sorin Ionescu and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/modules/completion/external b/modules/completion/external index 08afea0e..ed964013 160000 --- a/modules/completion/external +++ b/modules/completion/external @@ -1 +1 @@ -Subproject commit 08afea0e230b5a321d584119f55b675990327ef9 +Subproject commit ed964013e290677c866a055e1c1ece6f33f64151 diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index 28c20905..9b5132c7 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -116,7 +116,7 @@ zstyle ':completion:*:(rm|kill|diff):*' ignore-line other zstyle ':completion:*:rm:*' file-patterns '*:all-files' # Kill -zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,command -w' +zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:*:kill:*' force-list always diff --git a/modules/environment/init.zsh b/modules/environment/init.zsh index 51d26162..76655a6c 100644 --- a/modules/environment/init.zsh +++ b/modules/environment/init.zsh @@ -33,15 +33,6 @@ unsetopt BG_NICE # Don't run all background jobs at a lower priority. unsetopt HUP # Don't kill jobs on shell exit. unsetopt CHECK_JOBS # Don't report on jobs when shell exit. -# -# Grep -# - -if zstyle -t ':prezto:environment:grep' color; then - export GREP_COLOR='37;45' - export GREP_OPTIONS='--color=auto' -fi - # # Termcap # diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 200b2d25..8aaa4c32 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -198,7 +198,7 @@ function git-info { # Format stashed. zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' - if [[ -n "$stashed_format" && -f "${git_dir}/refs/stash" ]]; then + if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" if [[ -n "$stashed" ]]; then zformat -f stashed_formatted "$stashed_format" "S:$stashed" diff --git a/modules/gpg/init.zsh b/modules/gpg/init.zsh index 0bb7476c..a7c6cf76 100644 --- a/modules/gpg/init.zsh +++ b/modules/gpg/init.zsh @@ -11,16 +11,16 @@ if (( ! $+commands[gpg-agent] )); then fi # Set the default paths to gpg-agent files. -_gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf" +_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf" _gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env" # Start gpg-agent if not started. -if [[ -z "$GPG_AGENT_INFO" ]]; then +if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then # Export environment variables. source "$_gpg_agent_env" 2> /dev/null # Start gpg-agent if not started. - if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then + if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")" fi fi @@ -35,6 +35,12 @@ if grep 'enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then # Load the SSH module for additional processing. pmodload 'ssh' + + # Updates the GPG-Agent TTY before every command since SSH does not set it. + function _gpg-agent-update-tty { + gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null + } + add-zsh-hook preexec _gpg-agent-update-tty fi # Clean up. diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 6fedb3c8..6d600789 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -13,10 +13,9 @@ if [[ -s "$HOME/.nvm/nvm.sh" ]]; then # Load package manager installed NVM into the shell session. elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nvm 2>/dev/null)" ]]; then source $(brew --prefix nvm)/nvm.sh -fi # Return if requirements are not found. -if (( ! $+commands[node] )); then +elif (( ! $+commands[node] )); then return 1 fi diff --git a/modules/prompt/README.md b/modules/prompt/README.md index d72c6cf6..dc024977 100644 --- a/modules/prompt/README.md +++ b/modules/prompt/README.md @@ -46,7 +46,7 @@ The most basic example of this function can be seen below. If the `prompt_name_setup` function is customizable via parameters, a help function **should** be defined. The user will access it via `prompt -h name`. -The most basic example of this function can be seen bellow. +The most basic example of this function can be seen below. function prompt_name_help { cat < 0 )); then @@ -91,7 +91,7 @@ a function before you calling it. **Do not register hook functions. They will be registered by the `prompt` function.** -The most basic example of this function can be seen bellow. +The most basic example of this function can be seen below. function prompt_name_precmd { if (( $+functions[git-info] )); then diff --git a/modules/prompt/external/pure b/modules/prompt/external/pure index 2577a4cc..e5a55c54 160000 --- a/modules/prompt/external/pure +++ b/modules/prompt/external/pure @@ -1 +1 @@ -Subproject commit 2577a4cc078d05c51d9d8e4278b8d16ab348a1b9 +Subproject commit e5a55c5469b82da5bd9a9e42b144cef7cec8915b diff --git a/modules/prompt/functions/prompt_cloud_setup b/modules/prompt/functions/prompt_cloud_setup index 0267c1e5..3b048df1 100644 --- a/modules/prompt/functions/prompt_cloud_setup +++ b/modules/prompt/functions/prompt_cloud_setup @@ -114,7 +114,7 @@ function prompt_cloud_setup { 'rprompt' '' # Define prompts. - PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b $git_info[prompt] ' + PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b ${git_info:+${(e)git_info[prompt]}} ' RPROMPT='' } diff --git a/modules/prompt/functions/prompt_kylewest_setup b/modules/prompt/functions/prompt_kylewest_setup index 0c229a57..e4ee0c0e 100644 --- a/modules/prompt/functions/prompt_kylewest_setup +++ b/modules/prompt/functions/prompt_kylewest_setup @@ -58,7 +58,7 @@ function prompt_kylewest_setup { zstyle ':prezto:module:ruby:info:version' format '%F{blue}[%v]%f' # Define prompts. - PROMPT='%F{cyan}%c%f ${git_info[prompt]}${editor_info[keymap]} ' + PROMPT='%F{cyan}%c%f ${git_info:+${(e)git_info[prompt]}}${editor_info[keymap]} ' RPROMPT='${ruby_info[version]}' } diff --git a/modules/prompt/functions/prompt_paradox_setup b/modules/prompt/functions/prompt_paradox_setup index f98377de..36ae40ec 100644 --- a/modules/prompt/functions/prompt_paradox_setup +++ b/modules/prompt/functions/prompt_paradox_setup @@ -18,7 +18,7 @@ pmodload 'helper' # Define variables. _prompt_paradox_current_bg='NONE' -_prompt_paradox_segment_separator='⮀' +_prompt_paradox_segment_separator='' _prompt_paradox_start_time=$SECONDS function prompt_paradox_start_segment { @@ -129,7 +129,7 @@ function prompt_paradox_setup { zstyle ':prezto:module:git:info:added' format ' ✚' zstyle ':prezto:module:git:info:ahead' format ' ⬆' zstyle ':prezto:module:git:info:behind' format ' ⬇' - zstyle ':prezto:module:git:info:branch' format '⭠ %b' + zstyle ':prezto:module:git:info:branch' format ' %b' zstyle ':prezto:module:git:info:commit' format '➦ %.7c' zstyle ':prezto:module:git:info:deleted' format ' ✖' zstyle ':prezto:module:git:info:dirty' format ' ⁝' diff --git a/modules/prompt/functions/prompt_skwp_setup b/modules/prompt/functions/prompt_skwp_setup index abe9e265..1c8f0a90 100644 --- a/modules/prompt/functions/prompt_skwp_setup +++ b/modules/prompt/functions/prompt_skwp_setup @@ -68,7 +68,7 @@ function prompt_skwp_setup { zstyle ':prezto:module:ruby:info:version' format '[%v]' # Define prompts. - PROMPT="${_prompt_skwp_colors[3]}%n%f@${_prompt_skwp_colors[2]}%m%f ${_prompt_skwp_colors[5]}%~%f "'$git_info[prompt]'"$ " + PROMPT="${_prompt_skwp_colors[3]}%n%f@${_prompt_skwp_colors[2]}%m%f ${_prompt_skwp_colors[5]}%~%f "'${git_info:+${(e)git_info[prompt]}}'"$ " RPROMPT='%F{blue}${ruby_info[version]}' } diff --git a/modules/prompt/functions/prompt_smiley_setup b/modules/prompt/functions/prompt_smiley_setup index 7679abe1..3066a2dc 100644 --- a/modules/prompt/functions/prompt_smiley_setup +++ b/modules/prompt/functions/prompt_smiley_setup @@ -57,7 +57,7 @@ function prompt_smiley_setup { zstyle ':prezto:module:git:info:keys' format 'prompt' '(%b%D)' # Define prompts. - PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info[prompt]} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) ' + PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info:+${(e)git_info[prompt]}} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) ' RPROMPT='${editor_info[overwrite]}${VIM:+" %B%F{green}V%f%b"}' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' } diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh index d8b59377..f632328d 100644 --- a/modules/ssh/init.zsh +++ b/modules/ssh/init.zsh @@ -25,7 +25,7 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then source "$_ssh_agent_env" 2> /dev/null # Start ssh-agent if not started. - if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then + if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")" fi fi diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index ac944f60..070abcaf 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -38,12 +38,12 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \ fi # Attach to the 'prezto' session or to the last session used. - exec tmux "$_tmux_iterm_integration" attach-session + exec tmux $_tmux_iterm_integration attach-session fi # # Aliases # -alias tmuxa="tmux $_tmux_iterm_integration attach-session" +alias tmuxa="tmux $_tmux_iterm_integration new-session -A" alias tmuxl='tmux list-sessions' diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index 102ae5a1..30fee32a 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -102,6 +102,14 @@ alias lc='lt -c' # Lists sorted by date, most recent last, shows change alias lu='lt -u' # Lists sorted by date, most recent last, shows access time. alias sl='ls' # I often screw this up. +# Grep +if zstyle -t ':prezto:module:utility:grep' color; then + export GREP_COLOR='37;45' # BSD. + export GREP_COLORS="mt=$GREP_COLOR" # GNU. + + alias grep="$aliases[grep] --color=auto" +fi + # Mac OS X Everywhere if [[ "$OSTYPE" == darwin* ]]; then alias o='open' @@ -138,8 +146,13 @@ alias du='du -kh' if (( $+commands[htop] )); then alias top=htop else - alias topc='top -o cpu' - alias topm='top -o vsize' + if [[ "$OSTYPE" == (darwin*|*bsd*) ]]; then + alias topc='top -o cpu' + alias topm='top -o vsize' + else + alias topc='top -o %CPU' + alias topm='top -o %MEM' + fi fi # Miscellaneous @@ -183,5 +196,5 @@ function find-exec { # Displays user owned processes status. function psu { - ps -U "${1:-$USER}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}" + ps -U "${1:-$LOGNAME}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}" } diff --git a/runcoms/zprofile b/runcoms/zprofile index 08d39be1..d87cb3b0 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -67,11 +67,8 @@ fi # if [[ ! -d "$TMPDIR" ]]; then - export TMPDIR="/tmp/$USER" + export TMPDIR="/tmp/$LOGNAME" mkdir -p -m 700 "$TMPDIR" fi TMPPREFIX="${TMPDIR%/}/zsh" -if [[ ! -d "$TMPPREFIX" ]]; then - mkdir -p "$TMPPREFIX" -fi