mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
commit
33a2cecaf5
17 changed files with 111 additions and 35 deletions
21
MIT-LICENSE.txt
Normal file
21
MIT-LICENSE.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/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.
|
||||
21
lib/git.zsh
21
lib/git.zsh
|
|
@ -9,13 +9,15 @@ function git_prompt_info() {
|
|||
# Checks if working tree is dirty
|
||||
parse_git_dirty() {
|
||||
local SUBMODULE_SYNTAX=''
|
||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
||||
fi
|
||||
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
|
||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
||||
fi
|
||||
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +87,9 @@ git_prompt_status() {
|
|||
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
fi
|
||||
if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
|
|
@ -102,7 +107,7 @@ git_prompt_status() {
|
|||
|
||||
#compare the provided version of git to the version installed and on path
|
||||
#prints 1 if input version <= installed version
|
||||
#prints -1 otherwise
|
||||
#prints -1 otherwise
|
||||
function git_compare_version() {
|
||||
local INPUT_GIT_VERSION=$1;
|
||||
local INSTALLED_GIT_VERSION
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ function title {
|
|||
fi
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||
elif [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
|
||||
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$2:q\a" #set window name
|
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ done
|
|||
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
||||
source $config_file
|
||||
done
|
||||
unset config_file
|
||||
|
||||
# Load the theme
|
||||
if [ "$ZSH_THEME" = "random" ]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ alias bu="bundle update"
|
|||
|
||||
# The following is based on https://github.com/gma/bundler-exec
|
||||
|
||||
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
|
||||
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus)
|
||||
|
||||
## Functions
|
||||
|
||||
|
|
@ -33,6 +33,7 @@ _run-with-bundler() {
|
|||
|
||||
## Main program
|
||||
for cmd in $bundled_commands; do
|
||||
eval "function unbundled_$cmd () { $cmd \$@ }"
|
||||
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
|
||||
alias $cmd=bundled_$cmd
|
||||
|
||||
|
|
|
|||
13
plugins/bwana/bwana.plugin.zsh
Normal file
13
plugins/bwana/bwana.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# Requires http://www.bruji.com/bwana/
|
||||
#
|
||||
if [[ -e /Applications/Bwana.app ]] ||
|
||||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
|
||||
then
|
||||
function man() {
|
||||
open "man:$1"
|
||||
}
|
||||
else
|
||||
echo "Bwana lets you read man files in Safari through a man: URI scheme"
|
||||
echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
|
||||
fi
|
||||
|
|
@ -1,2 +1,4 @@
|
|||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 -D }
|
||||
decode64(){ echo -n $1 | base64 -D }
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
|
|
|||
|
|
@ -237,13 +237,13 @@ __git-flow-feature ()
|
|||
|
||||
(diff)
|
||||
_arguments \
|
||||
':branch:__git_branch_names'\
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(rebase)
|
||||
_arguments \
|
||||
-i'[Do an interactive rebase]' \
|
||||
':branch:__git_branch_names'
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(checkout)
|
||||
|
|
@ -254,7 +254,7 @@ __git-flow-feature ()
|
|||
(pull)
|
||||
_arguments \
|
||||
':remote:__git_remotes'\
|
||||
':branch:__git_branch_names'
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
@ -334,4 +334,4 @@ __git_command_successful () {
|
|||
return 0
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
|
|
|
|||
|
|
@ -19,6 +19,18 @@ compdef _git gca=git-commit
|
|||
alias gco='git checkout'
|
||||
compdef _git gco=git-checkout
|
||||
alias gcm='git checkout master'
|
||||
alias gr='git remote'
|
||||
compdef _git gr=git-remote
|
||||
alias grv='git remote -v'
|
||||
compdef _git grv=git-remote
|
||||
alias grmv='git remote rename'
|
||||
compdef _git grmv=git-remote
|
||||
alias grrm='git remote remove'
|
||||
compdef _git grrm=git-remote
|
||||
alias grset='git remote set-url'
|
||||
compdef _git grset=git-remote
|
||||
alias grup='git remote update'
|
||||
compdef _git grset=git-remote
|
||||
alias gb='git branch'
|
||||
compdef _git gb=git-branch
|
||||
alias gba='git branch -a'
|
||||
|
|
|
|||
|
|
@ -170,7 +170,11 @@ _chef_environments_remote() {
|
|||
|
||||
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
||||
_chef_cookbooks_local() {
|
||||
(for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
|
||||
local knife_rb="$HOME/.chef/knife.rb"
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
fi
|
||||
(for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
|
||||
}
|
||||
|
||||
# This function extracts the available cookbook versions on the chef server
|
||||
|
|
|
|||
|
|
@ -5,15 +5,29 @@ function _lein_commands() {
|
|||
case $state in
|
||||
subcommand)
|
||||
subcommands=(
|
||||
"classpath:print the classpath of the current project"
|
||||
"clean:remove compiled files and dependencies from project"
|
||||
"compile:ahead-of-time compile the project"
|
||||
"deploy:build jar and deploy to remote repository"
|
||||
"deps:download and install all dependencies"
|
||||
"help:display a list of tasks or help for a given task"
|
||||
"install:install the project and its dependencies in your local repository"
|
||||
"int:enter an interactive task shell"
|
||||
"interactive:enter an interactive task shell"
|
||||
"jack-in:jack in to a clojure slime session from emacs."
|
||||
"jar:create a jar file containing the compiled .class files"
|
||||
"javac:compile java source files"
|
||||
"new:create a new project skeleton"
|
||||
"plugin:manage user-level plugins"
|
||||
"pom:write a pom.xml file to disk for maven interop"
|
||||
"repl:start a repl session either with the current project or standalone"
|
||||
"retest:run only the test namespaces which failed last time around"
|
||||
"run:run the project's -main function"
|
||||
"search:search remote maven repositories for matching jars"
|
||||
"swank:launch swank server for Emacs to connect"
|
||||
"test:run the project's tests"
|
||||
"test!:run a project's tests after cleaning and fetching dependencies"
|
||||
"trampoline:run a task without nesting the project's JVM inside Leiningen's."
|
||||
"uberjar:Create a jar including the contents of each of deps"
|
||||
"upgrade:upgrade leiningen to the latest stable release"
|
||||
"version:print leiningen's version"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ alias wtf='dmesg'
|
|||
alias onoz='cat /var/log/errors.log'
|
||||
alias rtfm='man'
|
||||
|
||||
alias :3='echo'
|
||||
alias visible='echo'
|
||||
alias invisible='cat'
|
||||
alias moar='more'
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ alias sr='ruby script/runner'
|
|||
alias ssp='ruby script/spec'
|
||||
alias rdbm='rake db:migrate'
|
||||
alias rdbtp='rake db:test:prepare'
|
||||
alias migrate='rake db:migrate && rake db:test:prepare'
|
||||
alias sc='ruby script/console'
|
||||
alias sd='ruby script/server --debugger'
|
||||
alias devlog='tail -f log/development.log'
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ sprunge() {
|
|||
fi
|
||||
else
|
||||
echo Using input from a pipe or STDIN redirection... >&2
|
||||
while read -r line ; do
|
||||
echo $line
|
||||
done | curl -F 'sprunge=<-' http://sprunge.us
|
||||
curl -F 'sprunge=<-' http://sprunge.us
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,13 @@
|
|||
function zle-keymap-select zle-line-init zle-line-finish {
|
||||
# The terminal must be in application mode when ZLE is active for $terminfo
|
||||
# values to be valid.
|
||||
if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then
|
||||
case "$0" in
|
||||
(zle-line-init)
|
||||
# Enable terminal application mode.
|
||||
echoti smkx
|
||||
;;
|
||||
(zle-line-finish)
|
||||
# Disable terminal application mode.
|
||||
echoti rmkx
|
||||
;;
|
||||
esac
|
||||
if (( ${+terminfo[smkx]} )); then
|
||||
printf '%s' ${terminfo[smkx]}
|
||||
fi
|
||||
if (( ${+terminfo[rmkx]} )); then
|
||||
printf '%s' ${terminfo[rmkx]}
|
||||
fi
|
||||
|
||||
zle reset-prompt
|
||||
zle -R
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ prompt_dir() {
|
|||
prompt_status() {
|
||||
local symbols
|
||||
symbols=()
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$RETVAL"
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,23 @@ function _prompt_char() {
|
|||
fi
|
||||
}
|
||||
|
||||
# This theme works with both the "dark" and "light" variants of the
|
||||
# Solarized color schema. Set the SOLARIZED_THEME variable to one of
|
||||
# these two values to choose. If you don't specify, we'll assume you're
|
||||
# using the "dark" variant.
|
||||
|
||||
case ${SOLARIZED_THEME:-dark} in
|
||||
light) bkg=white;;
|
||||
*) bkg=black;;
|
||||
esac
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{black}%B%F{green}%}]"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{${bkg}}%B%F{green}%}]"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
PROMPT='%{%f%k%b%}
|
||||
%{%K{black}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{black}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%}
|
||||
%{%K{black}%}$(_prompt_char)%{%K{black}%} %#%{%f%k%b%} '
|
||||
%{%K{${bkg}}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{${bkg}}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%}
|
||||
%{%K{${bkg}}%}$(_prompt_char)%{%K{${bkg}}%} %#%{%f%k%b%} '
|
||||
|
||||
RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue