1
0
Fork 0

[#23] Rename plugins to modules

pull/86/head
Sorin Ionescu 13 years ago
parent f1bcae7fae
commit 4b7ba1995c

2
.gitignore vendored

@ -1,3 +1,3 @@
*.zwc
*.zwc.old
plugins/*/cache.zsh
modules/*/cache.zsh

4
.gitmodules vendored

@ -1,6 +1,6 @@
[submodule "completions"]
path = completions
url = https://github.com/zsh-users/zsh-completions.git
[submodule "plugins/history-substring-search/external"]
path = plugins/history-substring-search/external
[submodule "modules/history-substring-search/external"]
path = modules/history-substring-search/external
url = https://github.com/zsh-users/zsh-history-substring-search.git

@ -44,10 +44,10 @@ window or tab.
Oh My Zsh has many features disabled by default. Read the source code and
accompanying README files to learn of what is available.
### Plugins
### Modules
1. Browse `plugins/` to see what is available.
2. Load the plugins you need in `~/.zshrc` then open a new Zsh terminal window
1. Browse `modules/` to see what is available.
2. Load the modules you need in `~/.zshrc` then open a new Zsh terminal window
or tab.
### Themes

@ -19,13 +19,13 @@ if [[ "$TERM" == 'dumb' ]]; then
zstyle ':omz:prompt' theme 'off'
fi
# Get enabled plugins.
zstyle -a ':omz:load' plugin 'plugins'
# Get enabled modules.
zstyle -a ':omz:load' module 'omodules'
# Add functions to fpath.
fpath=(
${0:h}/themes/*(/FN)
${plugins:+${0:h}/plugins/${^plugins}/{functions,completions}(/FN)}
${omodules:+${0:h}/modules/${^omodules}/{functions,completions}(/FN)}
${0:h}/{functions,completions}(/FN)
$fpath
)
@ -51,21 +51,21 @@ autoload -Uz zargs
autoload -Uz zcalc
autoload -Uz zmv
# Source plugins defined in ~/.zshrc.
for plugin in "$plugins[@]"; do
if [[ ! -d "${0:h}/plugins/$plugin" ]]; then
print "omz: no such plugin: $plugin" >&2
# Source modules defined in ~/.zshrc.
for omodule in "$omodules[@]"; do
if [[ ! -d "${0:h}/modules/$omodule" ]]; then
print "omz: no such module: $omodule" >&2
fi
if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then
source "${0:h}/plugins/$plugin/init.zsh"
if [[ -f "${0:h}/modules/$omodule/init.zsh" ]]; then
source "${0:h}/modules/$omodule/init.zsh"
fi
if (( $? == 0 )); then
zstyle ":omz:plugin:$plugin" enable 'yes'
zstyle ":omz:module:$omodule" enable 'yes'
fi
done
unset plugin plugins
unset omodule omodules
# Autoload Oh My Zsh functions.
for fdir in "$fpath[@]"; do

@ -139,9 +139,9 @@ bindkey -M emacs "$keyinfo[Control]X$keyinfo[Control]]" vi-match-bracket
# Edit command in an external editor.
bindkey -M emacs "$keyinfo[Control]X$keyinfo[Control]E" edit-command-line
# Bind to the history substring search plugin if enabled;
# Bind to the history substring search module if enabled;
# otherwise, bind to built-in Zsh history search.
if (( $+plugins[(er)history-substring-search] )); then
if (( $+omodules[(er)history-substring-search] )); then
bindkey -M emacs "$keyinfo[Control]P" history-substring-search-up
bindkey -M emacs "$keyinfo[Control]N" history-substring-search-down
else
@ -181,9 +181,9 @@ bindkey -M viins "kj" vi-cmd-mode
bindkey -M vicmd "gg" beginning-of-history
bindkey -M vicmd "G" end-of-history
# Bind to the history substring search plugin if enabled;
# Bind to the history substring search module if enabled;
# otherwise, bind to built-in Zsh history search.
if (( $+plugins[(er)history-substring-search] )); then
if (( $+omodules[(er)history-substring-search] )); then
bindkey -M vicmd "k" history-substring-search-up
bindkey -M vicmd "j" history-substring-search-down
else
@ -214,7 +214,7 @@ for keymap in 'emacs' 'viins'; do
# Expand history on space.
bindkey -M "$keymap" ' ' magic-space
if (( $+plugins[(er)history-substring-search] )); then
if (( $+omodules[(er)history-substring-search] )); then
bindkey -M "$keymap" "$keyinfo[Up]" history-substring-search-up
bindkey -M "$keymap" "$keyinfo[Down]" history-substring-search-down
else

@ -203,9 +203,9 @@ function git-info {
# Ignore submodule status.
zstyle -b \
':omz:plugin:git:prompt:ignore' submodule 'ignore_submodule'
':omz:module:git:prompt:ignore' submodule 'ignore_submodule'
zstyle -s \
':omz:plugin:git:prompt:ignore:submodule' when 'ignore_submodule_when'
':omz:module:git:prompt:ignore:submodule' when 'ignore_submodule_when'
if is-true "$ignore_submodule"; then
status_cmd+=" --ignore-submodules=${ignore_submodule_when:-all}"
fi
@ -213,21 +213,21 @@ function git-info {
# Format commit.
commit="$(git rev-parse HEAD 2> /dev/null)"
if [[ -n "$commit" ]]; then
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format'
zstyle -s ':omz:module:git:prompt' commit 'commit_format'
zformat -f commit_formatted "$commit_format" "c:$commit"
fi
# Format stashed.
if [[ -f "$(_git-dir)/refs/stash" ]]; then
stashed="$(git stash list 2> /dev/null | wc -l)"
zstyle -s ':omz:plugin:git:prompt' stashed 'stashed_format'
zstyle -s ':omz:module:git:prompt' stashed 'stashed_format'
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
fi
# Format action.
action="$(_git-action)"
if [[ -n "$action" ]]; then
zstyle -s ':omz:plugin:git:prompt' action 'action_format'
zstyle -s ':omz:module:git:prompt' action 'action_format'
zformat -f action_formatted "$action_format" "s:$action"
fi
@ -248,13 +248,13 @@ function git-info {
# Format branch.
branch="${$(git symbolic-ref -q HEAD)##refs/heads/}"
if [[ -n "$branch" ]]; then
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format'
zstyle -s ':omz:module:git:prompt' branch 'branch_format'
zformat -f branch_formatted "$branch_format" "b:$branch"
# Format remote.
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
if [[ -n "$remote" ]]; then
zstyle -s ':omz:plugin:git:prompt' remote 'remote_format'
zstyle -s ':omz:module:git:prompt' remote 'remote_format'
zformat -f remote_formatted "$remote_format" "R:$remote"
# Get ahead and behind counts.
@ -263,14 +263,14 @@ function git-info {
# Format ahead.
ahead="$ahead_and_behind[(w)1]"
if (( $ahead > 0 )); then
zstyle -s ':omz:plugin:git:prompt' ahead 'ahead_format'
zstyle -s ':omz:module:git:prompt' ahead 'ahead_format'
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
fi
# Format behind.
behind="$ahead_and_behind[(w)2]"
if (( $behind > 0 )); then
zstyle -s ':omz:plugin:git:prompt' behind 'behind_format'
zstyle -s ':omz:module:git:prompt' behind 'behind_format'
zformat -f behind_formatted "$behind_format" "B:$behind"
fi
fi
@ -278,49 +278,49 @@ function git-info {
# Format added.
if (( $added > 0 )); then
zstyle -s ':omz:plugin:git:prompt' added 'added_format'
zstyle -s ':omz:module:git:prompt' added 'added_format'
zformat -f added_formatted "$added_format" "a:$added_format"
fi
# Format deleted.
if (( $deleted > 0 )); then
zstyle -s ':omz:plugin:git:prompt' deleted 'deleted_format'
zstyle -s ':omz:module:git:prompt' deleted 'deleted_format'
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
fi
# Format modified.
if (( $modified > 0 )); then
zstyle -s ':omz:plugin:git:prompt' modified 'modified_format'
zstyle -s ':omz:module:git:prompt' modified 'modified_format'
zformat -f modified_formatted "$modified_format" "m:$modified"
fi
# Format renamed.
if (( $renamed > 0 )); then
zstyle -s ':omz:plugin:git:prompt' renamed 'renamed_format'
zstyle -s ':omz:module:git:prompt' renamed 'renamed_format'
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
fi
# Format unmerged.
if (( $unmerged > 0 )); then
zstyle -s ':omz:plugin:git:prompt' unmerged 'unmerged_format'
zstyle -s ':omz:module:git:prompt' unmerged 'unmerged_format'
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
fi
# Format untracked.
if (( $untracked > 0 )); then
zstyle -s ':omz:plugin:git:prompt' untracked 'untracked_format'
zstyle -s ':omz:module:git:prompt' untracked 'untracked_format'
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
fi
# Format dirty.
if (( $dirty > 0 )); then
zstyle -s ':omz:plugin:git:prompt' dirty 'dirty_format'
zstyle -s ':omz:module:git:prompt' dirty 'dirty_format'
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
fi
# Format prompts.
zstyle -s ':omz:plugin:git:prompt' prompt 'prompt_format'
zstyle -s ':omz:plugin:git:prompt' rprompt 'rprompt_format'
zstyle -s ':omz:module:git:prompt' prompt 'prompt_format'
zstyle -s ':omz:module:git:prompt' rprompt 'rprompt_format'
git_info_vars=(
git_prompt_info "$prompt_format"

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Source plugin files.
# Source module files.
source "${0:h}/alias.zsh"
source "${0:h}/hub.zsh"
source "${0:h}/style.zsh"

@ -0,0 +1,61 @@
#
# Defines Git information display styles.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# %s - Special action name (am, merge, rebase).
zstyle ':omz:module:git:prompt' action 'action:%s'
# %a - Indicator to notify of added files.
zstyle ':omz:module:git:prompt' added 'added:%a'
# %A - Indicator to notify of ahead branch.
zstyle ':omz:module:git:prompt' ahead 'ahead:%A'
# %B - Indicator to notify of behind branch.
zstyle ':omz:module:git:prompt' behind 'behind:%B'
# %b - Branch name.
zstyle ':omz:module:git:prompt' branch '%b'
# %c - SHA-1 hash.
zstyle ':omz:module:git:prompt' commit 'commit:%c'
# %d - Indicator to notify of deleted files.
zstyle ':omz:module:git:prompt' deleted 'deleted:%d'
# %D - Indicator to notify of dirty files.
zstyle ':omz:module:git:prompt' dirty 'dirty:%D'
# %m - Indicator to notify of modified files.
zstyle ':omz:module:git:prompt' modified 'modified:%m'
# %R - Remote name.
zstyle ':omz:module:git:prompt' remote '%R'
# %r - Indicator to notify of renamed files.
zstyle ':omz:module:git:prompt' renamed 'renamed:%r'
# %S - Indicator to notify of stashed files.
zstyle ':omz:module:git:prompt' stashed 'stashed:%S'
# %U - Indicator to notify of unmerged files.
zstyle ':omz:module:git:prompt' unmerged 'unmerged:%U'
# %u - Indicator to notify of untracked files.
zstyle ':omz:module:git:prompt' untracked 'untracked:%u'
# Left prompt.
zstyle ':omz:module:git:prompt' prompt ' git:(%b %D)'
# Right prompt.
zstyle ':omz:module:git:prompt' rprompt ''
# Ignore submodule.
zstyle ':omz:module:git:prompt:ignore' submodule 'no'
# Ignore submodule when it is 'dirty', 'untracked', 'all', or 'none'.
zstyle ':omz:module:git:prompt:ignore:submodule' when 'all'

@ -8,11 +8,11 @@
source "${0:h}/external/zsh-history-substring-search.zsh"
if zstyle -t ':omz:plugin:history-substring-search' case-sensitive; then
if zstyle -t ':omz:module:history-substring-search' case-sensitive; then
unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
fi
if ! zstyle -t ':omz:plugin:history-substring-search' color; then
if ! zstyle -t ':omz:module:history-substring-search' color; then
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
fi

@ -8,7 +8,7 @@
# To auto start it, add the following to zshrc:
#
# # Auto launch GNU Screen at start-up.
# zstyle -t ':omz:plugin:screen:auto' start 'yes'
# zstyle -t ':omz:module:screen:auto' start 'yes'
#
# Aliases
@ -17,7 +17,7 @@ alias sn="screen -U -S"
alias sr="screen -a -A -U -D -R"
# Auto Start
if [[ -z "$STY" ]] && zstyle -t ':omz:plugin:screen:auto' start; then
if [[ -z "$STY" ]] && zstyle -t ':omz:module:screen:auto' start; then
session="$(
screen -list 2> /dev/null \
| sed '1d;$d' \

@ -13,11 +13,11 @@
# Usage:
# To enable agent forwarding, add the following to your .zshrc:
#
# zstyle ':omz:plugin:ssh-agent' forwarding 'yes'
# zstyle ':omz:module:ssh-agent' forwarding 'yes'
#
# To load multiple identities, add the following to your .zshrc:
#
# zstyle ':omz:plugin:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github'
# zstyle ':omz:module:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github'
#
if (( ! $+commands[ssh-agent] )); then
@ -37,7 +37,7 @@ function _ssh-agent-start {
source "${_ssh_agent_env}" > /dev/null
# Load identities.
zstyle -a ':omz:plugin:ssh-agent' identities 'identities'
zstyle -a ':omz:module:ssh-agent' identities 'identities'
if (( ${#identities} > 0 )); then
ssh-add "${HOME}/.ssh/${^identities[@]}"
@ -47,7 +47,7 @@ function _ssh-agent-start {
}
# Test if agent-forwarding is enabled.
zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding'
zstyle -b ':omz:module:ssh-agent' forwarding '_ssh_agent_forwarding'
if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then
# Add a nifty symlink for screen/tmux if agent forwarding.
[[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen

@ -9,7 +9,7 @@
# To auto start it, add the following to zshrc:
#
# # Auto launch tmux at start-up.
# zstyle -t ':omz:plugin:tmux:auto' start 'yes'
# zstyle -t ':omz:module:tmux:auto' start 'yes'
#
# Warning:
# Tmux is known to cause kernel panics on Mac OS X.
@ -21,7 +21,7 @@ alias ta="tmux attach-session"
alias tl="tmux list-sessions"
# Auto Start
if [[ -z "$TMUX" ]] && zstyle -t ':omz:plugin:tmux:auto' start; then
if [[ -z "$TMUX" ]] && zstyle -t ':omz:module:tmux:auto' start; then
tmux_session='#OMZ'
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then

@ -1,4 +1,4 @@
This plugin provides a wrapper around the "wakeonlan" tool available from most
This module provides a wrapper around the "wakeonlan" tool available from most
distributions' package repositories, or from the following website:
http://gsd.di.uminho.pt/jpo/software/wakeonlan/

@ -1,61 +0,0 @@
#
# Defines Git information display styles.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# %s - Special action name (am, merge, rebase).
zstyle ':omz:plugin:git:prompt' action 'action:%s'
# %a - Indicator to notify of added files.
zstyle ':omz:plugin:git:prompt' added 'added:%a'
# %A - Indicator to notify of ahead branch.
zstyle ':omz:plugin:git:prompt' ahead 'ahead:%A'
# %B - Indicator to notify of behind branch.
zstyle ':omz:plugin:git:prompt' behind 'behind:%B'
# %b - Branch name.
zstyle ':omz:plugin:git:prompt' branch '%b'
# %c - SHA-1 hash.
zstyle ':omz:plugin:git:prompt' commit 'commit:%c'
# %d - Indicator to notify of deleted files.
zstyle ':omz:plugin:git:prompt' deleted 'deleted:%d'
# %D - Indicator to notify of dirty files.
zstyle ':omz:plugin:git:prompt' dirty 'dirty:%D'
# %m - Indicator to notify of modified files.
zstyle ':omz:plugin:git:prompt' modified 'modified:%m'
# %R - Remote name.
zstyle ':omz:plugin:git:prompt' remote '%R'
# %r - Indicator to notify of renamed files.
zstyle ':omz:plugin:git:prompt' renamed 'renamed:%r'
# %S - Indicator to notify of stashed files.
zstyle ':omz:plugin:git:prompt' stashed 'stashed:%S'
# %U - Indicator to notify of unmerged files.
zstyle ':omz:plugin:git:prompt' unmerged 'unmerged:%U'
# %u - Indicator to notify of untracked files.
zstyle ':omz:plugin:git:prompt' untracked 'untracked:%u'
# Left prompt.
zstyle ':omz:plugin:git:prompt' prompt ' git:(%b %D)'
# Right prompt.
zstyle ':omz:plugin:git:prompt' rprompt ''
# Ignore submodule.
zstyle ':omz:plugin:git:prompt:ignore' submodule 'no'
# Ignore submodule when it is 'dirty', 'untracked', 'all', or 'none'.
zstyle ':omz:plugin:git:prompt:ignore:submodule' when 'all'

@ -20,8 +20,8 @@ zstyle ':omz:*:*' color 'yes'
# Auto set the tab and window titles.
zstyle ':omz:terminal:auto' title 'yes'
# Set the plugins to load (see $OMZ/plugins/).
zstyle ':omz:load' plugin 'archive' 'git'
# Set the modules to load (see $OMZ/modules/).
zstyle ':omz:load' module 'archive' 'git'
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.

@ -28,20 +28,20 @@ function prompt_sorin_setup {
zstyle ':omz:editor' completing '%B%F{red}...%f%b'
zstyle ':omz:prompt:vi' insert ''
zstyle ':omz:prompt:vi' command ' %F{yellow}%f%B%F{red}%f%b%F{red}%f'
zstyle ':omz:plugin:git:prompt' action ':%%B%F{yellow}%s%f%%b'
zstyle ':omz:plugin:git:prompt' added ' %%B%F{green}✚%f%%b'
zstyle ':omz:plugin:git:prompt' ahead ' %%B%F{yellow}⬆%f%%b'
zstyle ':omz:plugin:git:prompt' behind ' %%B%F{yellow}⬇%f%%b'
zstyle ':omz:plugin:git:prompt' branch ':%F{red}%b%f'
zstyle ':omz:plugin:git:prompt' deleted ' %%B%F{red}✖%f%%b'
zstyle ':omz:plugin:git:prompt' modified ' %%B%F{blue}✱%f%%b'
zstyle ':omz:plugin:git:prompt' renamed ' %%B%F{magenta}➜%f%%b'
zstyle ':omz:plugin:git:prompt' commit ':%F{green}%.7c%f'
zstyle ':omz:plugin:git:prompt' stashed ' %%B%F{cyan}✭%f%%b'
zstyle ':omz:plugin:git:prompt' unmerged ' %%B%F{yellow}═%f%%b'
zstyle ':omz:plugin:git:prompt' untracked ' %%B%F{white}◼%f%%b'
zstyle ':omz:plugin:git:prompt' prompt ' %F{blue}git%f$(coalesce "%b" "%c")%s'
zstyle ':omz:plugin:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u'
zstyle ':omz:module:git:prompt' action ':%%B%F{yellow}%s%f%%b'
zstyle ':omz:module:git:prompt' added ' %%B%F{green}✚%f%%b'
zstyle ':omz:module:git:prompt' ahead ' %%B%F{yellow}⬆%f%%b'
zstyle ':omz:module:git:prompt' behind ' %%B%F{yellow}⬇%f%%b'
zstyle ':omz:module:git:prompt' branch ':%F{red}%b%f'
zstyle ':omz:module:git:prompt' deleted ' %%B%F{red}✖%f%%b'
zstyle ':omz:module:git:prompt' modified ' %%B%F{blue}✱%f%%b'
zstyle ':omz:module:git:prompt' renamed ' %%B%F{magenta}➜%f%%b'
zstyle ':omz:module:git:prompt' commit ':%F{green}%.7c%f'
zstyle ':omz:module:git:prompt' stashed ' %%B%F{cyan}✭%f%%b'
zstyle ':omz:module:git:prompt' unmerged ' %%B%F{yellow}═%f%%b'
zstyle ':omz:module:git:prompt' untracked ' %%B%F{white}◼%f%%b'
zstyle ':omz:module:git:prompt' prompt ' %F{blue}git%f$(coalesce "%b" "%c")%s'
zstyle ':omz:module:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u'
PROMPT='%F{cyan}%1~%f${(e)git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}%f%b) '
RPROMPT='${vi_prompt_info}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_rprompt_info}'

Loading…
Cancel
Save