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 bl="bundle list"
alias bp="bundle package" alias bp="bundle package"
alias bo="bundle open" alias bo="bundle open"
alias bout="bundle outdated"
alias bu="bundle update" alias bu="bundle update"
alias bi="bundle_install" alias bi="bundle_install"
alias bcn="bundle clean" alias bcn="bundle clean"

View file

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

View file

@ -1,4 +1,3 @@
#!zsh
############################################################################## ##############################################################################
# A descriptive listing of core Gradle commands # A descriptive listing of core Gradle commands
############################################################################ ############################################################################
@ -54,22 +53,11 @@ function _gradle_arguments() {
############################################################################## ##############################################################################
# Are we in a directory containing a build.gradle file? # Examine the build.gradle file to see if its timestamp has changed;
############################################################################ # and if so, regenerate the .gradle_tasks cache 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
############################################################################ ############################################################################
_gradle_does_task_list_need_generating () { _gradle_does_task_list_need_generating () {
[ ! -f .gradletasknamecache ] && return 0; [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]]
[ build.gradle -nt .gradletasknamecache ] && return 0;
return 1;
} }
@ -77,22 +65,22 @@ _gradle_does_task_list_need_generating () {
# Discover the gradle tasks by running "gradle tasks --all" # Discover the gradle tasks by running "gradle tasks --all"
############################################################################ ############################################################################
_gradle_tasks () { _gradle_tasks () {
if [ in_gradle ]; then if [[ -f build.gradle ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then 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 fi
compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache` compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
fi fi
} }
_gradlew_tasks () { _gradlew_tasks () {
if [ in_gradle ]; then if [[ -f build.gradle ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then 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 fi
compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache` compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
fi fi
} }
@ -102,13 +90,3 @@ _gradlew_tasks () {
############################################################################ ############################################################################
compdef _gradle_tasks gradle compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew 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,21 +2,18 @@
### Usage ### Usage
Update .zshrc: 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). (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 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.
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:
```diff 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:
- 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%}' ```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**: 3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
``` ```
@ -55,8 +52,7 @@ Update .zshrc:
#### Displays repo branch and directory status in prompt #### Displays repo branch and directory status in prompt
This is the same as git plugin does. This is the same as git plugin does.
**Note**: additional changes to **.zshrc** are required in order for this to **Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work.
work.
### Mantainers ### Mantainers
[ptrv](https://github.com/ptrv) - original creator [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' - wpps='search'
- wppst='status' - wppst='status'
- wppt='toggle' - wppt='toggle'
- wppu='uninstall' - wppun='uninstall'
- wppu='update' - wppu='update'
### Post ### Post
@ -55,7 +55,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You
- wppol='wp post list' - wppol='wp post list'
- wppom='wp post meta' - wppom='wp post meta'
- wppou='wp post update' - wppou='wp post update'
- wppou='wp post url' - wppourl='wp post url'
### Sidebar ### Sidebar
- wpsbl='wp sidebar list' - wpsbl='wp sidebar list'

View file

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

View file

@ -118,7 +118,7 @@ prompt_git() {
zstyle ':vcs_info:*' get-revision true zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚' zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:git:*' unstagedstr '●' zstyle ':vcs_info:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info vcs_info