This commit is contained in:
Adam Goldsmith 2015-06-11 09:53:26 -04:00
commit 702f659373
13 changed files with 161 additions and 43 deletions

View File

@ -108,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

View File

@ -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.

View File

@ -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"

29
modules/dnf/README.md Normal file
View File

@ -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

28
modules/dnf/init.zsh Normal file
View File

@ -0,0 +1,28 @@
#
# Defines dnf aliases.
#
# Authors:
# FireWave <firewave@free.fr>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# 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.

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
Macports
MacPorts
========
Defines MacPorts aliases and adds MacPorts directories to path variables.

@ -1 +1 @@
Subproject commit 5ade8aeb8a7d45a59841278a9a86090dd880be63
Subproject commit 04212522f39f43998d001b4a94b05856f010a54b

View File

@ -0,0 +1 @@
../external/pure/async.zsh

View File

@ -5,7 +5,28 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# 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 "$@"

View File

@ -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

View File

@ -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