Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/robbyrussell/oh-my-zsh:
  Use `grep -q` for silent behavior
  Fix logic of bureau_git_status function
  Add git user profile functions for prompt display
  localization support for clock in candy theme
  Add 'asdf' plugin
  Update 'tm' function to take multiple files on the command-line
  Add missing alias to README of bundler plugin
  Closes ohmyzsh#4727
  Avoid using "PREFIX" that cause nvm to complain about.
  Changed env based sf2 shortcuts to sfdev & sfprod
  Added environment based shortcuts in symfony2 plugin
  Fix checkmark for clean repo in bureau theme
  Added a short description of the plugin
  Update seach parameter
  Proper handling of tags
  Geeknote autocomplete and alias
  • Loading branch information
freecastle committed Apr 12, 2016
2 parents 70bd45d + d310fac commit 7be5d42
Show file tree
Hide file tree
Showing 13 changed files with 246 additions and 36 deletions.
12 changes: 12 additions & 0 deletions lib/git.zsh
Expand Up @@ -188,6 +188,18 @@ function git_compare_version() {
echo 0
}

# Outputs the name of the current user
# Usage example: $(git_current_user_name)
function git_current_user_name() {
command git config user.name 2>/dev/null
}

# Outputs the email of the current user
# Usage example: $(git_current_user_email)
function git_current_user_email() {
command git config user.email 2>/dev/null
}

# This is unlikely to change so make it all statically assigned
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
# Clean up the namespace slightly by removing the checker function
Expand Down
27 changes: 27 additions & 0 deletions plugins/asdf/README.md
@@ -0,0 +1,27 @@
## asdf

**Maintainer:** [@RobLoach](https://github.com/RobLoach)

Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.

### Installation

1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`.

```
plugins=(asdf)
```

2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
```
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
```

### Usage

See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf:

```
asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git
asdf install nodejs 5.9.1
```
7 changes: 7 additions & 0 deletions plugins/asdf/asdf.plugin.zsh
@@ -0,0 +1,7 @@
# Find where asdf should be installed.
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"

# Load asdf, if found.
if [ -f $ASDF_DIR/asdf.sh ]; then
. $ASDF_DIR/asdf.sh
fi
1 change: 1 addition & 0 deletions plugins/bundler/README.md
Expand Up @@ -6,6 +6,7 @@
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package`
- `bo` aliased to `bundle open`
- `bout` aliased to `bundle outdated`
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
Expand Down
12 changes: 12 additions & 0 deletions plugins/geeknote/README.md
@@ -0,0 +1,12 @@
## ZSH-Geeknote

[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh).

Plugins provides:

- auto completion of commands and their options
- alias `gn`

You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).

Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
136 changes: 136 additions & 0 deletions plugins/geeknote/_geeknote
@@ -0,0 +1,136 @@
#compdef geeknote
# --------------- ------------------------------------------------------------
# Name : _geeknote
# Synopsis : zsh completion for geeknote
# Author : Ján Koščo <3k.stanley@gmail.com>
# HomePage : http://www.geeknote.me
# Version : 0.1
# Tag : [ shell, zsh, completion, evernote ]
# Copyright : © 2014 by Ján Koščo,
# Released under current GPL license.
# --------------- ------------------------------------------------------------

local -a _1st_arguments
_1st_arguments=(
'login'
'logout'
'settings'
'create'
'edit'
'find'
'show'
'remove'
'notebook-list'
'notebook-create'
'notebook-edit'
'tag-list'
'tag-create'
'tag-edit'
'tag-remove'
'gnsync'
'user'
)

_arguments '*:: :->command'

if (( CURRENT == 1 )); then
_describe -t commands "geeknote command" _1st_arguments
return
fi

local -a _command_args
case "$words[1]" in
user)
_command_args=(
'(--full)--full' \
)
;;
logout)
_command_args=(
'(--force)--force' \
)
;;
settings)
_command_args=(
'(--editor)--editor' \
)
;;
create)
_command_args=(
'(-t|--title)'{-t,--title}'[note title]' \
'(-c|--content)'{-c,--content}'[note content]' \
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
)
;;
edit)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
'(-t|--title)'{-t,--title}'[note title]' \
'(-c|--content)'{-c,--content}'[note content]' \
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
)
;;
remove)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
'(--force)--force' \
)
;;
show)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
)
;;
find)
_command_args=(
'(-s|--search)'{-s,--search}'[text to search]' \
'(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
'(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
'(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
'(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
'(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
'(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
'(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
)
;;
notebook-create)
_command_args=(
'(-t|--title)'{-t,--title}'[notebook title]' \
)
;;
notebook-edit)
_command_args=(
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
'(-t|--title)'{-t,--title}'[new notebook title]' \
)
;;
notebook-remove)
_command_args=(
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
'(--force)--force' \
)
;;
tag-create)
_command_args=(
'(-t|--title)'{-t,--title}'[title of tag]' \
)
;;
tag-edit)
_command_args=(
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
'(-t|--title)'{-t,--title}'[new tag name]' \
)
;;
tag-remove)
_command_args=(
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
'(--force)--force' \
)
;;
esac

_arguments \
$_command_args \
&& return 0
2 changes: 2 additions & 0 deletions plugins/geeknote/geeknote.plugin.zsh
@@ -0,0 +1,2 @@
#Alias
alias gn='geeknote'
10 changes: 5 additions & 5 deletions plugins/git/git.plugin.zsh
Expand Up @@ -146,15 +146,15 @@ alias gke='\gitk --all $(git log -g --pretty=format:%h)'
compdef _git gke='gitk'

alias gl='git pull'
alias glg='git log --stat --color'
alias glgp='git log --stat --color -p'
alias glgg='git log --graph --color'
alias glg='git log --stat'
alias glgp='git log --stat -p'
alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate --color'
alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
alias glog='git log --oneline --decorate --color --graph'
alias glog='git log --oneline --decorate --graph'
alias glp="_git_log_prettily"
compdef _git glp=git-log

Expand Down
2 changes: 2 additions & 0 deletions plugins/symfony2/symfony2.plugin.zsh
Expand Up @@ -25,3 +25,5 @@ alias sfcw='sf cache:warmup'
alias sfroute='sf router:debug'
alias sfcontainer='sf container:debug'
alias sfgb='sf generate:bundle'
alias sfdev='sf --env=dev'
alias sfprod='sf --env=prod'
11 changes: 6 additions & 5 deletions plugins/textmate/textmate.plugin.zsh
@@ -1,13 +1,14 @@
# If the tm command is called without an argument, open TextMate in the current directory
# If tm is passed a directory, cd to it and open it in TextMate
# If tm is passed a file, open it in TextMate
# If tm is passed anything else (i.e., a list of files and/or options), pass them all along
# This allows easy opening of multiple files.
function tm() {
if [[ -z $1 ]]; then
mate .
else
elif [[ -d $1 ]]; then
mate $1
if [[ -d $1 ]]; then
cd $1
fi
cd $1
else
mate "$@"
fi
}
54 changes: 32 additions & 22 deletions themes/bureau.zsh-theme
Expand Up @@ -22,34 +22,44 @@ bureau_git_branch () {
echo "${ref#refs/heads/}"
}

bureau_git_status () {
_INDEX=$(command git status --porcelain -b 2> /dev/null)
bureau_git_status() {
_STATUS=""
if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
fi
if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"

# check status of files
_INDEX=$(command git status --porcelain 2> /dev/null)
if [[ -n "$_INDEX" ]]; then
if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
fi
if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
if $(echo "$_INDEX" | command grep -q '^UU '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
else
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then

# check status of local repository
_INDEX=$(command git status --porcelain -b 2> /dev/null)
if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then
if $(echo "$_INDEX" | command grep -q '^## .*behind'); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then
if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
fi

if $(command git rev-parse --verify refs/stash &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
fi

echo $_STATUS
}

Expand Down Expand Up @@ -84,10 +94,10 @@ _LIBERTY="$_LIBERTY%{$reset_color%}"
get_space () {
local STR=$1$2
local zero='%([BSUbfksu]|([FB]|){*})'
local LENGTH=${#${(S%%)STR//$~zero/}}
local LENGTH=${#${(S%%)STR//$~zero/}}
local SPACES=""
(( LENGTH = ${COLUMNS} - $LENGTH - 1))

for i in {0..$LENGTH}
do
SPACES="$SPACES "
Expand All @@ -101,7 +111,7 @@ _1RIGHT="[%*] "

bureau_precmd () {
_1SPACES=`get_space $_1LEFT $_1RIGHT`
print
print
print -rP "$_1LEFT$_1SPACES$_1RIGHT"
}

Expand Down
2 changes: 1 addition & 1 deletion themes/candy.zsh-theme
@@ -1,4 +1,4 @@
PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
Expand Down
6 changes: 3 additions & 3 deletions themes/sunrise.zsh-theme
Expand Up @@ -10,9 +10,9 @@ B=$fg_no_bold[blue]
RESET=$reset_color

if [ "$USER" = "root" ]; then
PROMPTCOLOR="%{$R%}" PREFIX="-!-";
PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
else
PROMPTCOLOR="" PREFIX="---";
PROMPTCOLOR="" PROMPTPREFIX="---";
fi

local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
Expand Down Expand Up @@ -66,7 +66,7 @@ function custom_git_prompt() {
}

# %B sets bold text
PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
PROMPT='%B$PROMPTPREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
RPS1="${return_code}"

ZSH_THEME_GIT_PROMPT_PREFIX="%{$Y%}‹"
Expand Down

0 comments on commit 7be5d42

Please sign in to comment.