diff --git a/README.md b/README.md index 42c68532..d6b40af0 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 @@ -107,7 +108,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [1]: http://www.zsh.org -[2]: http://i.imgur.com/AzjmpwM.png "sorin theme" +[2]: http://i.imgur.com/nrGV6pg.png "sorin theme" [3]: http://git-scm.com [4]: https://github.com [5]: http://gitimmersion.com diff --git a/modules/README.md b/modules/README.md index 4d247b24..2a49804c 100644 --- a/modules/README.md +++ b/modules/README.md @@ -26,6 +26,11 @@ Directory Sets directory options and defines directory aliases. +DNF +--- + +Defines dnf aliases. + Dpkg ---- @@ -92,7 +97,7 @@ Homebrew Defines Homebrew aliases. -Macports +MacPorts -------- Defines MacPorts aliases and adds MacPorts directories to path variables. diff --git a/modules/completion/external b/modules/completion/external index ed964013..68c94947 160000 --- a/modules/completion/external +++ b/modules/completion/external @@ -1 +1 @@ -Subproject commit ed964013e290677c866a055e1c1ece6f33f64151 +Subproject commit 68c949470eaa87c5d67080d32fb2b69c8b837eb4 diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index 9b5132c7..023a90e7 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -24,7 +24,7 @@ autoload -Uz compinit && compinit -i setopt COMPLETE_IN_WORD # Complete from both ends of a word. setopt ALWAYS_TO_END # Move cursor to the end of a completed word. setopt PATH_DIRS # Perform path search even on command names with slashes. -setopt AUTO_MENU # Show completion menu on a succesive tab press. +setopt AUTO_MENU # Show completion menu on a successive tab press. setopt AUTO_LIST # Automatically list choices on ambiguous completion. setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash. unsetopt MENU_COMPLETE # Do not autoselect the first completion entry. @@ -34,7 +34,7 @@ unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor. # Styles # -# Use caching to make completion for cammands such as dpkg and apt usable. +# Use caching to make completion for commands such as dpkg and apt usable. zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache" diff --git a/modules/dnf/README.md b/modules/dnf/README.md new file mode 100644 index 00000000..06439544 --- /dev/null +++ b/modules/dnf/README.md @@ -0,0 +1,29 @@ +DNF +=== + +Defines [dnf][1] aliases. + +Aliases +------- + + - `dnfc` removes package(s) and leaves. + - `dnfi` installs package(s). + - `dnfh` displays history. + - `dnfl` lists packages. + - `dnfL` lists installed packages. + - `dnfq` displays package information. + - `dnfr` removes package(s). + - `dnfs` searches for a package. + - `dnfu` updates packages. + - `dnfU` upgrates packages. + +Authors +------- + +*The authors of this module should be contacted via the [issue tracker][2].* + + - [Sorin Ionescu](https://github.com/sorin-ionescu) + +[1]: https://fedoraproject.org/wiki/Features/DNF +[2]: https://github.com/sorin-ionescu/prezto/issues + diff --git a/modules/dnf/init.zsh b/modules/dnf/init.zsh new file mode 100644 index 00000000..7a401423 --- /dev/null +++ b/modules/dnf/init.zsh @@ -0,0 +1,28 @@ +# +# Defines dnf aliases. +# +# Authors: +# FireWave +# Sorin Ionescu +# + +# Return if requirements are not found. +if (( ! $+commands[dnf] )); then + return 1 +fi + +# +# Aliases +# + +alias dnfc='sudo dnf clean all' # Cleans the cache. +alias dnfh='dnf history' # Displays history. +alias dnfi='sudo dnf install' # Installs package(s). +alias dnfl='dnf list' # Lists packages. +alias dnfL='dnf list installed' # Lists installed packages. +alias dnfq='dnf info' # Displays package information. +alias dnfr='sudo dnf remove' # Removes package(s). +alias dnfs='dnf search' # Searches for a package. +alias dnfu='sudo dnf update' # Updates packages. +alias dnfU='sudo dnf upgrade' # Upgrades packages. + diff --git a/modules/history-substring-search/external b/modules/history-substring-search/external index 9f9fc7d5..c4a83561 160000 --- a/modules/history-substring-search/external +++ b/modules/history-substring-search/external @@ -1 +1 @@ -Subproject commit 9f9fc7d550cc547737f4c686591cbbf07e7470b0 +Subproject commit c4a83561a12b898ff7145856d0e6ae50757e28ba diff --git a/modules/homebrew/README.md b/modules/homebrew/README.md index 69a4e87b..84b43865 100644 --- a/modules/homebrew/README.md +++ b/modules/homebrew/README.md @@ -13,8 +13,7 @@ Aliases - `brewi` installs a formula. - `brewl` lists installed formulae. - `brews` searches for a formula. - - `brewU` upgrades Homebrew and outdated brews. - - `brewu` upgrades Homebrew. + - `brewu` updates Homebrew and formulae. - `brewx` uninstalls a formula. ### Homebrew Cask diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index 101b6b97..1ebe793d 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -6,7 +6,7 @@ # # Return if requirements are not found. -if [[ "$OSTYPE" != darwin* ]]; then +if [[ "$OSTYPE" != (darwin|linux)* ]]; then return 1 fi @@ -20,8 +20,7 @@ alias brewC='brew cleanup --force' alias brewi='brew install' alias brewl='brew list' alias brews='brew search' -alias brewu='brew upgrade' -alias brewU='brew update && brew upgrade' +alias brewu='brew update && brew upgrade --all' alias brewx='brew remove' # Homebrew Cask diff --git a/modules/macports/README.md b/modules/macports/README.md index 97f67ea0..70e4b8b9 100644 --- a/modules/macports/README.md +++ b/modules/macports/README.md @@ -1,4 +1,4 @@ -Macports +MacPorts ======== Defines MacPorts aliases and adds MacPorts directories to path variables. diff --git a/modules/prompt/external/pure b/modules/prompt/external/pure index e5a55c54..04212522 160000 --- a/modules/prompt/external/pure +++ b/modules/prompt/external/pure @@ -1 +1 @@ -Subproject commit e5a55c5469b82da5bd9a9e42b144cef7cec8915b +Subproject commit 04212522f39f43998d001b4a94b05856f010a54b diff --git a/modules/prompt/functions/async b/modules/prompt/functions/async new file mode 120000 index 00000000..d4b591e1 --- /dev/null +++ b/modules/prompt/functions/async @@ -0,0 +1 @@ +../external/pure/async.zsh \ No newline at end of file diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index 508dc80d..7a0dab75 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -5,7 +5,28 @@ # Sorin Ionescu # # Screenshots: -# http://i.imgur.com/AzjmpwM.png +# http://i.imgur.com/nrGV6pg.png +# + +# +# 16 Terminal Colors +# -- --------------- +# 0 black +# 1 red +# 2 green +# 3 yellow +# 4 blue +# 5 magenta +# 6 cyan +# 7 white +# 8 bright black +# 9 bright red +# 10 bright green +# 11 bright yellow +# 12 bright blue +# 13 bright magenta +# 14 bright cyan +# 15 bright white # # Load dependencies. @@ -22,6 +43,33 @@ function prompt_sorin_pwd { fi } +function prompt_sorin_git_info { + # Append Git status. + if [[ -s "$_prompt_sorin_precmd_async_data" ]]; then + alias typeset='typeset -g' + source "$_prompt_sorin_precmd_async_data" + RPROMPT+='${git_info:+${(e)git_info[status]}}' + unalias typeset + fi + + # Reset PID. + _prompt_sorin_precmd_async_pid=0 + + # Redisplay prompt. + zle && zle reset-prompt +} + +function prompt_sorin_precmd_async { + # Get Git repository information. + if (( $+functions[git-info] )); then + git-info + typeset -p git_info >! "$_prompt_sorin_precmd_async_data" + fi + + # Signal completion to parent process. + kill -USR1 $$ +} + function prompt_sorin_precmd { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS @@ -29,16 +77,26 @@ function prompt_sorin_precmd { # Format PWD. prompt_sorin_pwd - # Get Git repository information. - if (( $+functions[git-info] )); then - git-info + # Define prompts. + RPROMPT='${editor_info[overwrite]}%(?:: %F{1}⏎%f)${VIM:+" %B%F{6}V%f%b"}' + + # Kill the old process of slow commands if it is still running. + if (( _prompt_sorin_precmd_async_pid > 0 )); then + kill -TERM "$_prompt_sorin_precmd_async_pid" &>/dev/null fi + + # Compute slow commands in the background. + trap prompt_sorin_git_info USR1 + prompt_sorin_precmd_async &! + _prompt_sorin_precmd_async_pid=$! } function prompt_sorin_setup { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) + _prompt_sorin_precmd_async_pid=0 + _prompt_sorin_precmd_async_data="${TMPPREFIX}-prompt_sorin_data" # Load required functions. autoload -Uz add-zsh-hook @@ -47,34 +105,33 @@ function prompt_sorin_setup { add-zsh-hook precmd prompt_sorin_precmd # Set editor-info parameters. - zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' - zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{red}❯%F{yellow}❯%F{green}❯%f%b' - zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f' - zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{green}❮%F{yellow}❮%F{red}❮%f%b' + zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b' + zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}❯%F{3}❯%F{2}❯%f%b' + zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{3}♺%f' + zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{2}❮%F{3}❮%F{1}❮%f%b' # Set git-info parameters. zstyle ':prezto:module:git:info' verbose 'yes' - zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b' - zstyle ':prezto:module:git:info:added' format ' %%B%F{green}✚%f%%b' - zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b' - zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b' - zstyle ':prezto:module:git:info:branch' format ':%F{green}%b%f' - 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{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' - zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b' + zstyle ':prezto:module:git:info:action' format '%F{7}:%f%%B%F{9}%s%f%%b' + zstyle ':prezto:module:git:info:added' format ' %%B%F{2}✚%f%%b' + zstyle ':prezto:module:git:info:ahead' format ' %%B%F{13}⬆%f%%b' + zstyle ':prezto:module:git:info:behind' format ' %%B%F{13}⬇%f%%b' + zstyle ':prezto:module:git:info:branch' format ' %%B%F{2}%b%f%%b' + zstyle ':prezto:module:git:info:commit' format ' %%B%F{3}%.7c%f%%b' + zstyle ':prezto:module:git:info:deleted' format ' %%B%F{1}✖%f%%b' + zstyle ':prezto:module:git:info:modified' format ' %%B%F{4}✱%f%%b' + zstyle ':prezto:module:git:info:position' format ' %%B%F{13}%p%f%%b' + zstyle ':prezto:module:git:info:renamed' format ' %%B%F{5}➜%f%%b' + zstyle ':prezto:module:git:info:stashed' format ' %%B%F{6}✭%f%%b' + zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{3}═%f%%b' + zstyle ':prezto:module:git:info:untracked' format ' %%B%F{7}◼%f%%b' zstyle ':prezto:module:git:info:keys' format \ - 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ - 'rprompt' '%A%B%S%a%d%m%r%U%u' + 'status' '$(coalesce "%b" "%p" "%c")%s%A%B%S%a%d%m%r%U%u' # Define prompts. - PROMPT='${SSH_TTY:+"%F{red}%n%f@%F{yellow}%m%f "}%F{cyan}${_prompt_sorin_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' - RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${INSIDE_EMACS:+" %B%F{green}E%f%b"}${git_info[rprompt]}' - SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' + PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} ' + RPROMPT='' + SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? ' } prompt_sorin_setup "$@" diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index 01140d8c..b0be5023 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -6,7 +6,7 @@ # # Return if requirements are not found. -if [[ "$TERM" == (dumb|linux|*bsd*) ]]; then +if [[ "$TERM" == (dumb|linux|*bsd*|eterm*) ]]; then return 1 fi diff --git a/modules/tmux/README.md b/modules/tmux/README.md index b2f6bc8d..11c8a08a 100644 --- a/modules/tmux/README.md +++ b/modules/tmux/README.md @@ -74,4 +74,4 @@ Authors [4]: https://github.com/mxcl/homebrew [5]: https://github.com/sorin-ionescu/prezto/issues [6]: http://iterm2.com -[7]: https://code.google.com/p/iterm2/wiki/TmuxIntegration +[7]: https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index 30fee32a..fd7aaf6e 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -71,9 +71,9 @@ if is-callable 'dircolors'; then eval "$(dircolors --sh)" fi - alias ls="$aliases[ls] --color=auto" + alias ls="${aliases[ls]:-ls} --color=auto" else - alias ls="$aliases[ls] -F" + alias ls="${aliases[ls]:-ls} -F" fi else # BSD Core Utilities @@ -84,9 +84,9 @@ else # Define colors for the completion system. export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:' - alias ls='ls -G' + alias ls="${aliases[ls]:-ls} -G" else - alias ls='ls -F' + alias ls="${aliases[ls]:-ls} -F" fi fi @@ -107,7 +107,7 @@ 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" + alias grep="${aliases[grep]:-grep} --color=auto" fi # Mac OS X Everywhere