This commit is contained in:
ZHJie 2015-11-23 21:31:02 +08:00
commit 67fc06fab3
7 changed files with 34 additions and 59 deletions

View file

@ -2,6 +2,7 @@ alias be="bundle exec"
alias bl="bundle list"
alias bp="bundle package"
alias bo="bundle open"
alias bout="bundle outdated"
alias bu="bundle update"
alias bi="bundle_install"
alias bcn="bundle clean"

View file

@ -27,11 +27,11 @@ insert-cycledright () {
zle -N insert-cycledright
# add key bindings for iTerm2
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
bindkey "^[[1;6D" insert-cycledleft
bindkey "^[[1;6C" insert-cycledright
else
bindkey "\e[1;6D" insert-cycledleft
bindkey "\e[1;6C" insert-cycledright
fi
# These sequences work for xterm, Apple Terminal.app, and probably others.
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
# from plain Shift-Arrow, at least by default.
# iTerm2 does not have these key combinations defined by default; you will need
# to add them under "Keys" in your profile if you want to use this. You can do
# this conveniently by loading the "xterm with Numeric Keypad" preset.
bindkey "\e[1;6D" insert-cycledleft
bindkey "\e[1;6C" insert-cycledright

View file

@ -1,4 +1,3 @@
#!zsh
##############################################################################
# A descriptive listing of core Gradle commands
############################################################################
@ -54,22 +53,11 @@ function _gradle_arguments() {
##############################################################################
# Are we in a directory containing a build.gradle file?
############################################################################
function in_gradle() {
if [[ -f build.gradle ]]; then
echo 1
fi
}
############################################################################## Examine the build.gradle file to see if its
# timestamp has changed, and if so, regen
# the .gradle_tasks cache file
# Examine the build.gradle file to see if its timestamp has changed;
# and if so, regenerate the .gradle_tasks cache file
############################################################################
_gradle_does_task_list_need_generating () {
[ ! -f .gradletasknamecache ] && return 0;
[ build.gradle -nt .gradletasknamecache ] && return 0;
return 1;
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]]
}
@ -77,22 +65,22 @@ _gradle_does_task_list_need_generating () {
# Discover the gradle tasks by running "gradle tasks --all"
############################################################################
_gradle_tasks () {
if [ in_gradle ]; then
if [[ -f build.gradle ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
gradle tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
fi
compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
fi
}
_gradlew_tasks () {
if [ in_gradle ]; then
if [[ -f build.gradle ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
fi
compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
fi
}
@ -102,13 +90,3 @@ _gradlew_tasks () {
############################################################################
compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew
##############################################################################
# Open questions for future improvements:
# 1) Should 'gradle tasks' use --all or just the regular set?
# 2) Should gradlew use the same approach as gradle?
# 3) Should only the " - " be replaced with a colon so it can work
# with the richer descriptive method of _arguments?
# gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/"
#############################################################################

View file

@ -2,23 +2,20 @@
### Usage
Update .zshrc:
1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)`
1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)`
(that is pretty obvious).
2. Change PROMPT variable of current theme to contain current folder mercurial repo info:
2. Switch to a theme which uses `hg_prompt_info`.
robbyrussel theme is used by default, so you need to modify PROMPT var
from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme)
by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it
looks next:
Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme.
```diff
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this:
```zsh
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
```
and put modified var at the end of **.zshrc**.
3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
```
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
@ -55,8 +52,7 @@ Update .zshrc:
#### Displays repo branch and directory status in prompt
This is the same as git plugin does.
**Note**: additional changes to **.zshrc** are required in order for this to
work.
**Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work.
### Mantainers
[ptrv](https://github.com/ptrv) - original creator

View file

@ -43,7 +43,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You
- wpps='search'
- wppst='status'
- wppt='toggle'
- wppu='uninstall'
- wppun='uninstall'
- wppu='update'
### Post
@ -55,7 +55,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You
- wppol='wp post list'
- wppom='wp post meta'
- wppou='wp post update'
- wppou='wp post url'
- wppourl='wp post url'
### Sidebar
- wpsbl='wp sidebar list'

View file

@ -63,7 +63,7 @@ alias wppp='wp plugin path'
alias wpps='wp plugin search'
alias wppst='wp plugin status'
alias wppt='wp plugin toggle'
alias wppu='wp plugin uninstall'
alias wppun='wp plugin uninstall'
alias wppu='wp plugin update'
# Post
@ -75,7 +75,7 @@ alias wppog='wp post get'
alias wppol='wp post list'
alias wppom='wp post meta'
alias wppou='wp post update'
alias wppou='wp post url'
alias wppourl='wp post url'
# Rewrite

View file

@ -36,7 +36,7 @@ CURRENT_BG='NONE'
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
# NOTE: This segment separator character is correct. In 2012, Powerline changed
# the code points they use for their special characters. This is the new code point.
# If this is not working for you, you probably have an old version of the
# If this is not working for you, you probably have an old version of the
# Powerline-patched fonts installed. Download and install the new version.
# Do not submit PRs to change this unless you have reviewed the Powerline code point
# history and have new information.
@ -118,7 +118,7 @@ prompt_git() {
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:git:*' unstagedstr '●'
zstyle ':vcs_info:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info