diff --git a/.gitmodules b/.gitmodules index 518a2795..64941492 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "modules/autosuggestions/external"] + path = modules/autosuggestions/external + url = https://github.com/zsh-users/zsh-autosuggestions [submodule "modules/history-substring-search/external"] path = modules/history-substring-search/external url = https://github.com/zsh-users/zsh-history-substring-search.git @@ -16,6 +19,3 @@ [submodule "modules/prompt/functions/pure"] path = modules/prompt/external/pure url = https://github.com/sindresorhus/pure.git -[submodule "modules/autosuggestions/external"] - path = modules/autosuggestions/external - url = https://github.com/tarruda/zsh-autosuggestions diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d4171477 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2009-2011 Robby Russell and contributors +Copyright (c) 2011-2017 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 +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE diff --git a/README.md b/README.md index 9da5e967..9317bec1 100644 --- a/README.md +++ b/README.md @@ -13,23 +13,25 @@ version is 4.3.17. 1. Launch Zsh: - zsh + `zsh` 2. Clone the repository: - git clone --recursive https://github.com/zephyrus/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" + `git clone --recursive https://github.com/zephyrus/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"` 3. Create a new Zsh configuration by copying the Zsh configuration files provided: + ``` setopt EXTENDED_GLOB for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" done + ``` 4. Set Zsh as your default shell: - chsh -s /bin/zsh + `chsh -s /bin/zsh` 5. Open a new Zsh terminal window or tab. @@ -83,29 +85,7 @@ The [Zsh Reference Card][7] and the [zsh-lovers][8] man page are indispensable. License ------- -(The MIT License) - -Copyright (c) 2009-2011 Robby Russell 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 -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +This project is licensed under the MIT License. [1]: http://www.zsh.org [2]: http://i.imgur.com/nrGV6pg.png "sorin theme" diff --git a/init.zsh b/init.zsh index 6b5254fb..665e6c40 100644 --- a/init.zsh +++ b/init.zsh @@ -25,13 +25,13 @@ unset min_zsh_version function pmodload { local -a pmodules local pmodule - local pfunction_glob='^([_.]*|prompt_*_setup|README*)(-.N:t)' + local pfunction_glob='^([_.]*|prompt_*_setup|README*|*~)(-.N:t)' # $argv is overridden in the anonymous function. pmodules=("$argv[@]") # Add functions to $fpath. - fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath) + fpath=(${pmodules:+$ZPREZTODIR/modules/${^pmodules}/functions(/FN)} $fpath) function { local pfunction @@ -40,7 +40,7 @@ function pmodload { setopt LOCAL_OPTIONS EXTENDED_GLOB # Load Prezto functions. - for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do + for pfunction in $ZPREZTODIR/modules/${^pmodules}/functions/$~pfunction_glob; do autoload -Uz "$pfunction" done } @@ -49,19 +49,19 @@ function pmodload { for pmodule in "$pmodules[@]"; do if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then continue - elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then + elif [[ ! -d "$ZPREZTODIR/modules/$pmodule" ]]; then print "$0: no such module: $pmodule" >&2 continue else - if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" + if [[ -s "$ZPREZTODIR/modules/$pmodule/init.zsh" ]]; then + source "$ZPREZTODIR/modules/$pmodule/init.zsh" fi if (( $? == 0 )); then zstyle ":prezto:module:$pmodule" loaded 'yes' else # Remove the $fpath entry. - fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=() + fpath[(r)${ZPREZTODIR}/modules/${pmodule}/functions]=() function { local pfunction @@ -71,7 +71,7 @@ function pmodload { setopt LOCAL_OPTIONS EXTENDED_GLOB # Unload Prezto functions. - for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do + for pfunction in $ZPREZTODIR/modules/$pmodule/functions/$~pfunction_glob; do unfunction "$pfunction" done } @@ -86,6 +86,12 @@ function pmodload { # Prezto Initialization # +# This finds the directory prezto is installed to so plugin managers don't need +# to rely on dirty hacks to force prezto into a directory. Additionally, it +# needs to be done here because inside the pmodload function ${0:h} evaluates to +# the current directory of the shell rather than the prezto dir. +ZPREZTODIR=${0:h} + # Source the Prezto configuration file. if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then source "${ZDOTDIR:-$HOME}/.zpreztorc" diff --git a/modules/autosuggestions/external b/modules/autosuggestions/external index f0a74557..9cfaf5d3 160000 --- a/modules/autosuggestions/external +++ b/modules/autosuggestions/external @@ -1 +1 @@ -Subproject commit f0a745576ff69fa608421ee7214d4cd77b43e62f +Subproject commit 9cfaf5d3424ceb5fedd2c7e3253f823faae74383 diff --git a/modules/completion/external b/modules/completion/external index 3a2bb878..72af5d08 160000 --- a/modules/completion/external +++ b/modules/completion/external @@ -1 +1 @@ -Subproject commit 3a2bb8781d32d05d1bf05deeeb476beb651e8272 +Subproject commit 72af5d08f1c07507d74103af039e98a2791fccb5 diff --git a/modules/dpkg/init.zsh b/modules/dpkg/init.zsh index e1f479b0..69d524fc 100644 --- a/modules/dpkg/init.zsh +++ b/modules/dpkg/init.zsh @@ -54,4 +54,4 @@ fi alias deb-build='time dpkg-buildpackage -rfakeroot -us -uc' # Removes all kernel images and headers, except for the ones in use. -alias deb-kclean='sudo aptitude remove -P "?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))"' +alias deb-kclean='sudo aptitude remove -P "?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))"' diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 9aa64d64..c77e65c9 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -326,4 +326,4 @@ else print "prezto: editor: invalid key bindings: $key_bindings" >&2 fi -unset key{,map,bindings} +unset key{,map,_bindings} diff --git a/modules/git/README.md b/modules/git/README.md index c2d0449c..37194126 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -29,6 +29,10 @@ This setting affects all aliases and functions that call `git-status`. Aliases ------- +Aliases are enabled by default. You can disable them with: + + zstyle ':prezto:module:git:alias' skip 'yes' + ### Git - `g` is short for `git`. @@ -214,6 +218,7 @@ The following aliases may shadow system commands: - `gpt` shadows the [GUID partition table maintenance utility][4]. - `gs` shadows the [Ghostscript][5]. + - `gb` shadows the [GB][9]. If you frequently use the above commands, you may wish to remove said aliases from this module or to disable them at the bottom of the zshrc with `unalias`. @@ -332,3 +337,4 @@ Authors [6]: https://github.com/sorin-ionescu/prezto/issues [7]: https://github.com/sorin-ionescu/prezto/issues/219 [8]: http://www.kernel.org/pub/software/scm/git/docs/git-log.html +[9]: https://getgb.io/ diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index ffa854dd..48455147 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -26,156 +26,159 @@ zstyle -s ':prezto:module:git:status:ignore' submodules '_git_status_ignore_subm # Aliases # -# Git -alias g='git' - -# Branch (b) -alias gb='git branch' -alias gbc='git checkout -b' -alias gbl='git branch -v' -alias gbL='git branch -av' -alias gbx='git branch -d' -alias gbX='git branch -D' -alias gbm='git branch -m' -alias gbM='git branch -M' -alias gbs='git show-branch' -alias gbS='git show-branch -a' - -# Commit (c) -alias gc='git commit --verbose' -alias gca='git commit --verbose --all' -alias gcm='git commit --message' -alias gco='git checkout' -alias gcO='git checkout --patch' -alias gcf='git commit --amend --reuse-message HEAD' -alias gcF='git commit --verbose --amend' -alias gcp='git cherry-pick --ff' -alias gcP='git cherry-pick --no-commit' -alias gcr='git revert' -alias gcR='git reset "HEAD^"' -alias gcs='git show' -alias gcl='git-commit-lost' - -# Conflict (C) -alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' -alias gCa='git add $(gCl)' -alias gCe='git mergetool $(gCl)' -alias gCo='git checkout --ours --' -alias gCO='gCo $(gCl)' -alias gCt='git checkout --theirs --' -alias gCT='gCt $(gCl)' - -# Data (d) -alias gd='git ls-files' -alias gdc='git ls-files --cached' -alias gdx='git ls-files --deleted' -alias gdm='git ls-files --modified' -alias gdu='git ls-files --other --exclude-standard' -alias gdk='git ls-files --killed' -alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' - -# Fetch (f) -alias gf='git fetch' -alias gfc='git clone' -alias gfm='git pull' -alias gfr='git pull --rebase' - -# Grep (g) -alias gg='git grep' -alias ggi='git grep --ignore-case' -alias ggl='git grep --files-with-matches' -alias ggL='git grep --files-without-matches' -alias ggv='git grep --invert-match' -alias ggw='git grep --word-regexp' - -# Index (i) -alias gia='git add' -alias giA='git add --patch' -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 --patch' -alias gix='git rm -r --cached' -alias giX='git rm -rf --cached' - -# Log (l) -alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"' -alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"' -alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"' -alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"' -alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"' -alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"' -alias glc='git shortlog --summary --numbered' - -# Merge (m) -alias gm='git merge' -alias gmC='git merge --no-commit' -alias gmF='git merge --no-ff' -alias gma='git merge --abort' -alias gmt='git mergetool' - -# Push (p) -alias gp='git push' -alias gpf='git push --force' -alias gpa='git push --all' -alias gpA='git push --all && git push --tags' -alias gpt='git push --tags' -alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"' -alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"' - -# Rebase (r) -alias gr='git rebase' -alias gra='git rebase --abort' -alias grc='git rebase --continue' -alias gri='git rebase --interactive' -alias grs='git rebase --skip' - -# Remote (R) -alias gR='git remote' -alias gRl='git remote --verbose' -alias gRa='git remote add' -alias gRx='git remote rm' -alias gRm='git remote rename' -alias gRu='git remote update' -alias gRp='git remote prune' -alias gRs='git remote show' -alias gRb='git-hub-browse' - -# Stash (s) -alias gs='git stash' -alias gsa='git stash apply' -alias gsx='git stash drop' -alias gsX='git-stash-clear-interactive' -alias gsl='git stash list' -alias gsL='git-stash-dropped' -alias gsd='git stash show --patch --stat' -alias gsp='git stash pop' -alias gsr='git-stash-recover' -alias gss='git stash save --include-untracked' -alias gsS='git stash save --patch --no-keep-index' -alias gsw='git stash save --include-untracked --keep-index' - -# Submodule (S) -alias gS='git submodule' -alias gSa='git submodule add' -alias gSf='git submodule foreach' -alias gSi='git submodule init' -alias gSI='git submodule update --init --recursive' -alias gSl='git submodule status' -alias gSm='git-submodule-move' -alias gSs='git submodule sync' -alias gSu='git submodule foreach git pull origin master' -alias gSx='git-submodule-remove' - -# Working Copy (w) -alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short' -alias gwS='git status --ignore-submodules=${_git_status_ignore_submodules}' -alias gwd='git diff --no-ext-diff' -alias gwD='git diff --no-ext-diff --word-diff' -alias gwr='git reset --soft' -alias gwR='git reset --hard' -alias gwc='git clean -n' -alias gwC='git clean -f' -alias gwx='git rm -r' -alias gwX='git rm -rf' +if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then + # Git + alias g='git' + + # Branch (b) + alias gb='git branch' + alias gbc='git checkout -b' + alias gbl='git branch -v' + alias gbL='git branch -av' + alias gbx='git branch -d' + alias gbX='git branch -D' + alias gbm='git branch -m' + alias gbM='git branch -M' + alias gbs='git show-branch' + alias gbS='git show-branch -a' + + # Commit (c) + alias gc='git commit --verbose' + alias gca='git commit --verbose --all' + alias gcm='git commit --message' + alias gco='git checkout' + alias gcO='git checkout --patch' + alias gcf='git commit --amend --reuse-message HEAD' + alias gcF='git commit --verbose --amend' + alias gcp='git cherry-pick --ff' + alias gcP='git cherry-pick --no-commit' + alias gcr='git revert' + alias gcR='git reset "HEAD^"' + alias gcs='git show' + alias gcl='git-commit-lost' + + # Conflict (C) + alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' + alias gCa='git add $(gCl)' + alias gCe='git mergetool $(gCl)' + alias gCo='git checkout --ours --' + alias gCO='gCo $(gCl)' + alias gCt='git checkout --theirs --' + alias gCT='gCt $(gCl)' + + # Data (d) + alias gd='git ls-files' + alias gdc='git ls-files --cached' + alias gdx='git ls-files --deleted' + alias gdm='git ls-files --modified' + alias gdu='git ls-files --other --exclude-standard' + alias gdk='git ls-files --killed' + alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' + + # Fetch (f) + alias gf='git fetch' + alias gfc='git clone' + alias gfm='git pull' + alias gfr='git pull --rebase' + + # Grep (g) + alias gg='git grep' + alias ggi='git grep --ignore-case' + alias ggl='git grep --files-with-matches' + alias ggL='git grep --files-without-matches' + alias ggv='git grep --invert-match' + alias ggw='git grep --word-regexp' + + # Index (i) + alias gia='git add' + alias giA='git add --patch' + 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 --patch' + alias gix='git rm -r --cached' + alias giX='git rm -rf --cached' + + # Log (l) + alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"' + alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"' + alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"' + alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"' + alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"' + alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"' + alias glc='git shortlog --summary --numbered' + + # Merge (m) + alias gm='git merge' + alias gmC='git merge --no-commit' + alias gmF='git merge --no-ff' + alias gma='git merge --abort' + alias gmt='git mergetool' + + # Push (p) + alias gp='git push' + alias gpf='git push --force-with-lease' + alias gpF='git push --force' + alias gpa='git push --all' + alias gpA='git push --all && git push --tags' + alias gpt='git push --tags' + alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"' + alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"' + + # Rebase (r) + alias gr='git rebase' + alias gra='git rebase --abort' + alias grc='git rebase --continue' + alias gri='git rebase --interactive' + alias grs='git rebase --skip' + + # Remote (R) + alias gR='git remote' + alias gRl='git remote --verbose' + alias gRa='git remote add' + alias gRx='git remote rm' + alias gRm='git remote rename' + alias gRu='git remote update' + alias gRp='git remote prune' + alias gRs='git remote show' + alias gRb='git-hub-browse' + + # Stash (s) + alias gs='git stash' + alias gsa='git stash apply' + alias gsx='git stash drop' + alias gsX='git-stash-clear-interactive' + alias gsl='git stash list' + alias gsL='git-stash-dropped' + alias gsd='git stash show --patch --stat' + alias gsp='git stash pop' + alias gsr='git-stash-recover' + alias gss='git stash save --include-untracked' + alias gsS='git stash save --patch --no-keep-index' + alias gsw='git stash save --include-untracked --keep-index' + + # Submodule (S) + alias gS='git submodule' + alias gSa='git submodule add' + alias gSf='git submodule foreach' + alias gSi='git submodule init' + alias gSI='git submodule update --init --recursive' + alias gSl='git submodule status' + alias gSm='git-submodule-move' + alias gSs='git submodule sync' + alias gSu='git submodule foreach git pull origin master' + alias gSx='git-submodule-remove' + + # Working Copy (w) + alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short' + alias gwS='git status --ignore-submodules=${_git_status_ignore_submodules}' + alias gwd='git diff --no-ext-diff' + alias gwD='git diff --no-ext-diff --word-diff' + alias gwr='git reset --soft' + alias gwR='git reset --hard' + alias gwc='git clean -n' + alias gwC='git clean -f' + alias gwx='git rm -r' + alias gwX='git rm -rf' +fi diff --git a/modules/git/functions/git-hub-shorten-url b/modules/git/functions/git-hub-shorten-url index 77e4b0ba..d37b04eb 100644 --- a/modules/git/functions/git-hub-shorten-url +++ b/modules/git/functions/git-hub-shorten-url @@ -16,7 +16,7 @@ if [[ -z "$url" ]]; then fi if (( $+commands[curl] )); then - curl -s -i 'http://git.io' -F "url=$url" | grep 'Location:' | sed 's/Location: //' + curl -s -i 'http://git.io' -F "url=$url" | sed -n 's/^Location: //p' else print "$0: command not found: curl" >&2 fi diff --git a/modules/history-substring-search/external b/modules/history-substring-search/external index 7a4b54b7..aae33884 160000 --- a/modules/history-substring-search/external +++ b/modules/history-substring-search/external @@ -1 +1 @@ -Subproject commit 7a4b54b708ab88e0421097614f1acaa7a973c795 +Subproject commit aae3388491c2312c4efb2e86bcb999927bb2900e diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh index 67990a38..d3ee3a11 100644 --- a/modules/history-substring-search/init.zsh +++ b/modules/history-substring-search/init.zsh @@ -54,4 +54,6 @@ if [[ -n "$key_info" ]]; then bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down done + + unset keymap fi diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index 1ebe793d..1196fa57 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -20,7 +20,7 @@ alias brewC='brew cleanup --force' alias brewi='brew install' alias brewl='brew list' alias brews='brew search' -alias brewu='brew update && brew upgrade --all' +alias brewu='brew update && brew upgrade' alias brewx='brew remove' # Homebrew Cask diff --git a/modules/node/README.md b/modules/node/README.md index 5f0c3caf..66e9784d 100644 --- a/modules/node/README.md +++ b/modules/node/README.md @@ -10,6 +10,13 @@ nvm [nvm][5] allows for managing multiple, isolated Node.js installations in the home directory. +nodenv +------ + +[nodenv][6] does one thing well. nodenv is concerned solely with switching +Node versions. It's simple and predictable, Just Works, and is rock solid in +production. nodenv is forked from the popular [rbenv][7]. + Functions --------- @@ -43,3 +50,5 @@ Authors [3]: http://nodejs.org/api [4]: https://github.com/sorin-ionescu/prezto/issues [5]: https://github.com/creationix/nvm +[6]: https://github.com/nodenv/nodenv +[7]: https://github.com/sstephenson/rbenv diff --git a/modules/node/functions/node-info b/modules/node/functions/node-info index 7742f904..e4cd52d0 100644 --- a/modules/node/functions/node-info +++ b/modules/node/functions/node-info @@ -15,6 +15,8 @@ typeset -gA node_info if (( $+functions[nvm_version] )); then version="${$(nvm_version)#v}" +elif (( $+commands[nodenv] )); then + version="${${$(nodenv version)#v}[(w)0]}" fi if [[ "$version" != (none|) ]]; then diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 6d600789..2eb297c1 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -14,6 +14,14 @@ if [[ -s "$HOME/.nvm/nvm.sh" ]]; then elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nvm 2>/dev/null)" ]]; then source $(brew --prefix nvm)/nvm.sh +# Load manually installed nodenv into the shell session. +elif [[ -s "$HOME/.nodenv/bin/nodenv" ]]; then + eval "$($HOME/.nodenv/bin/nodenv init -)" + +# Load package manager installed nodenv into the shell session. +elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nodenv 2>/dev/null)" ]]; then + eval "$($(brew --prefix nodenv)/bin/nodenv init -)" + # Return if requirements are not found. elif (( ! $+commands[node] )); then return 1 diff --git a/modules/prompt/external/agnoster b/modules/prompt/external/agnoster index 43cb371f..f8ffdbfb 160000 --- a/modules/prompt/external/agnoster +++ b/modules/prompt/external/agnoster @@ -1 +1 @@ -Subproject commit 43cb371f361eecf62e9dac7afc73a1c16edf89c7 +Subproject commit f8ffdbfbe2c2d8cd1350eae1b68367802fe6df26 diff --git a/modules/prompt/external/powerline b/modules/prompt/external/powerline index 8e811523..c48e4c69 160000 --- a/modules/prompt/external/powerline +++ b/modules/prompt/external/powerline @@ -1 +1 @@ -Subproject commit 8e81152340c4beb2d941340d1feb2dc29bbcc309 +Subproject commit c48e4c69ef5c368ea7cda961ed9d0e298a5ae1fc diff --git a/modules/prompt/external/pure b/modules/prompt/external/pure index fb4c37da..04fa7495 160000 --- a/modules/prompt/external/pure +++ b/modules/prompt/external/pure @@ -1 +1 @@ -Subproject commit fb4c37dad3c5cbdebca61a8ff5545397c11d450f +Subproject commit 04fa7495cf8fe3aff8ce286d4517df15066b820a diff --git a/modules/prompt/functions/prompt_paradox_setup b/modules/prompt/functions/prompt_paradox_setup index 36ae40ec..7e9b9493 100644 --- a/modules/prompt/functions/prompt_paradox_setup +++ b/modules/prompt/functions/prompt_paradox_setup @@ -52,6 +52,10 @@ function prompt_paradox_build_prompt { prompt_paradox_start_segment green black '${(e)git_info[ref]}${(e)git_info[status]}' fi + if [[ -n "$python_info" ]]; then + prompt_paradox_start_segment white black '${(e)python_info[virtualenv]}' + fi + prompt_paradox_end_segment } @@ -103,6 +107,7 @@ function prompt_paradox_precmd { function prompt_paradox_preexec { _prompt_paradox_start_time="$SECONDS" + python-info } function prompt_paradox_setup { @@ -143,6 +148,9 @@ function prompt_paradox_setup { 'ref' '$(coalesce "%b" "%p" "%c")' \ 'status' '%s%D%A%B%S%a%d%m%r%U%u' + # %v - virtualenv name. + zstyle ':prezto:module:python:info:virtualenv' format 'virtualenv:%v' + # Define prompts. PROMPT=' ${(e)$(prompt_paradox_build_prompt)} diff --git a/modules/python/init.zsh b/modules/python/init.zsh index da78ea79..458253b2 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -34,10 +34,11 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then return 1 fi -# Load virtualenvwrapper into the shell session. -if (( $+commands[virtualenvwrapper.sh] )); then +# Load virtualenvwrapper into the shell session, unless requested not to +zstyle -t ':prezto:module:python' skip-virtualenvwrapper-init +if (( $? && $+commands[virtualenvwrapper.sh] )); then # Set the directory where virtual environments are stored. - export WORKON_HOME="$HOME/.virtualenvs" + export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}" # Disable the virtualenv prompt. VIRTUAL_ENV_DISABLE_PROMPT=1 diff --git a/modules/syntax-highlighting/external b/modules/syntax-highlighting/external index 7044c198..15d45875 160000 --- a/modules/syntax-highlighting/external +++ b/modules/syntax-highlighting/external @@ -1 +1 @@ -Subproject commit 7044c1986e2f6b15eec27a03651207fccb0a2fbe +Subproject commit 15d4587514a3beaa13972093e335bf685b6726a9 diff --git a/modules/terminal/README.md b/modules/terminal/README.md index 58f81be1..5a607880 100644 --- a/modules/terminal/README.md +++ b/modules/terminal/README.md @@ -13,14 +13,19 @@ directory, add the following to *zpreztorc*: zstyle ':prezto:module:terminal' auto-title 'yes' -Auto titling is disabled inside terminal multiplexers, except inside dvtm, since -it interferes with window names defined in configuration files and profile -managers. +Auto titling is disabled inside terminal multiplexers (except inside dvtm) +since it interferes with window names defined in configuration files and +profile managers. This can be overridden by setting it to `always`. + + zstyle ':prezto:module:terminal' auto-title 'always' + +### Title formats To format terminal window and tab titles, add the following to *zpreztorc*: zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' zstyle ':prezto:module:terminal:tab-title' format '%m: %s' + zstyle ':prezto:module:terminal:multiplexer-title' format '%s' `%s` will be replaced with the current working directory path or the currently executing program name. @@ -31,7 +36,8 @@ Functions --------- - `set-tab-title` sets the terminal tab title. -- `set-window-title` sets the terminal or terminal multiplexer window title. +- `set-window-title` sets the terminal window title. +- `set-multiplexer-title` sets the terminal multiplexer title. Authors ------- @@ -39,6 +45,7 @@ Authors *The authors of this module should be contacted via the [issue tracker][2].* - [Sorin Ionescu](https://github.com/sorin-ionescu) + - [Olaf Conradi](https://github.com/oohlaf) [1]: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Expansion-of-Prompt-Sequences [2]: https://github.com/sorin-ionescu/prezto/issues diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index b0be5023..c7b22b7a 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -3,6 +3,7 @@ # # Authors: # Sorin Ionescu +# Olaf Conradi # # Return if requirements are not found. @@ -10,19 +11,12 @@ if [[ "$TERM" == (dumb|linux|*bsd*|eterm*) ]]; then return 1 fi -# Sets the terminal or terminal multiplexer window title. +# Sets the terminal window title. function set-window-title { local title_format{,ted} zstyle -s ':prezto:module:terminal:window-title' format 'title_format' || title_format="%s" zformat -f title_formatted "$title_format" "s:$argv" - - if [[ "$TERM" == screen* ]]; then - title_format="\ek%s\e\\" - else - title_format="\e]2;%s\a" - fi - - printf "$title_format" "${(V%)title_formatted}" + printf '\e]2;%s\a' "${(V%)title_formatted}" } # Sets the terminal tab title. @@ -30,8 +24,15 @@ function set-tab-title { local title_format{,ted} zstyle -s ':prezto:module:terminal:tab-title' format 'title_format' || title_format="%s" zformat -f title_formatted "$title_format" "s:$argv" + printf '\e]1;%s\a' "${(V%)title_formatted}" +} - printf "\e]1;%s\a" ${(V%)title_formatted} +# Sets the terminal multiplexer tab title. +function set-multiplexer-title { + local title_format{,ted} + zstyle -s ':prezto:module:terminal:multiplexer-title' format 'title_format' || title_format="%s" + zformat -f title_formatted "$title_format" "s:$argv" + printf '\ek%s\e\\' "${(V%)title_formatted}" } # Sets the tab and window titles with a given command. @@ -59,8 +60,11 @@ function _terminal-set-titles-with-command { local truncated_cmd="${cmd/(#m)?(#c15,)/${MATCH[1,12]}...}" unset MATCH - set-window-title "$cmd" + if [[ "$TERM" == screen* ]]; then + set-multiplexer-title "$truncated_cmd" + fi set-tab-title "$truncated_cmd" + set-window-title "$cmd" fi } @@ -74,8 +78,11 @@ function _terminal-set-titles-with-path { local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" unset MATCH - set-window-title "$abbreviated_path" + if [[ "$TERM" == screen* ]]; then + set-multiplexer-title "$truncated_path" + fi set-tab-title "$truncated_path" + set-window-title "$abbreviated_path" } # Do not override precmd/preexec; append to the hook array. @@ -110,12 +117,13 @@ then fi # Set up non-Apple terminals. -if zstyle -t ':prezto:module:terminal' auto-title \ - && ( ! [[ -n "$STY" || -n "$TMUX" ]] ) +if zstyle -t ':prezto:module:terminal' auto-title 'always' \ + || (zstyle -t ':prezto:module:terminal' auto-title \ + && ( ! [[ -n "$STY" || -n "$TMUX" ]] )) then - # Sets the tab and window titles before the prompt is displayed. + # Sets titles before the prompt is displayed. add-zsh-hook precmd _terminal-set-titles-with-path - # Sets the tab and window titles before command execution. + # Sets titles before command execution. add-zsh-hook preexec _terminal-set-titles-with-command fi diff --git a/modules/utility/README.md b/modules/utility/README.md index 5e7919ea..16b4317c 100644 --- a/modules/utility/README.md +++ b/modules/utility/README.md @@ -75,6 +75,7 @@ Aliases - `pu` changes the directory and pushes the old directory onto the stack (`pushd`). - `rm` removes files and directories interactively. + - `sa` search aliases for a word. - `type` displays all the attribute values of a shell parameter. ### Files and Directories diff --git a/modules/utility/functions/diff b/modules/utility/functions/diff index 8347899e..d5dd360b 100644 --- a/modules/utility/functions/diff +++ b/modules/utility/functions/diff @@ -8,7 +8,7 @@ function diff { if zstyle -t ':prezto:module:utility:diff' color; then if (( $+commands[colordiff] )); then - command diff --unified "$@" | colordiff --difftype diffu + command colordiff --unified "$@" elif (( $+commands[git] )); then git --no-pager diff --color=auto --no-ext-diff --no-index "$@" else diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index c401af84..cd373939 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -57,6 +57,7 @@ alias p='${(z)PAGER}' alias po='popd' alias pu='pushd' # alias rm="${aliases[rm]:-rm} -i" +alias sa='alias | grep -i' alias type='type -a' # ls @@ -158,7 +159,11 @@ fi # Miscellaneous # Serves a directory via HTTP. -alias http-serve='python -m SimpleHTTPServer' +if (( $+commands[python3] )); then + alias http-serve='python3 -m http.server' +else + alias http-serve='python -m SimpleHTTPServer' +fi # # Functions diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index a82df475..109f2294 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -153,6 +153,9 @@ zstyle ':prezto:module:prompt' theme 'sorin' # Set the tab title format. # zstyle ':prezto:module:terminal:tab-title' format '%m: %s' +# Set the terminal multiplexer title format. +# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' + # # Tmux # diff --git a/runcoms/zprofile b/runcoms/zprofile index 9341d647..66e955ae 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -67,8 +67,7 @@ fi # if [[ ! -d "$TMPDIR" ]]; then - export TMPDIR="/tmp/$LOGNAME" - mkdir -p -m 700 "$TMPDIR" + export TMPDIR="$(mktemp -d)" fi TMPPREFIX="${TMPDIR%/}/zsh"