mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
Merge branch 'master' into enhancement-add-angular-cli-plugin
This commit is contained in:
commit
180b00622b
28 changed files with 2614 additions and 752 deletions
|
|
@ -211,3 +211,9 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-
|
|||
## License
|
||||
|
||||
Oh My Zsh is released under the [MIT license](LICENSE.txt).
|
||||
|
||||
## About Planet Argon
|
||||
|
||||

|
||||
|
||||
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github).
|
||||
|
|
|
|||
21
lib/git.zsh
21
lib/git.zsh
|
|
@ -76,16 +76,21 @@ function git_current_branch() {
|
|||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if $(command git rev-parse --git-dir > /dev/null 2>&1); then
|
||||
local COMMITS="$(git rev-list --count @{upstream}..HEAD)"
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD)"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the number of commits behind remote
|
||||
function git_commits_behind() {
|
||||
if $(command git rev-parse --git-dir > /dev/null 2>&1); then
|
||||
echo $(git rev-list --count HEAD..@{upstream})
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count HEAD..@{upstream})"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -160,13 +165,13 @@ function git_prompt_status() {
|
|||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ else
|
|||
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
alias yasu='yaourt --Syua --no-confirm'
|
||||
alias yasu='yaourt -Syua --noconfirm'
|
||||
alias yain='yaourt -S'
|
||||
alias yains='yaourt -U'
|
||||
alias yare='yaourt -R'
|
||||
|
|
|
|||
|
|
@ -67,12 +67,12 @@ if [[ "$OSTYPE" = darwin* ]] ; then
|
|||
elif [[ $(uname) == "Linux" ]] ; then
|
||||
|
||||
function battery_is_charging() {
|
||||
! [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpi] )) ; then
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -85,14 +85,14 @@ elif [[ $(uname) == "Linux" ]] ; then
|
|||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi | cut -f3 -d ',')
|
||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi 2>/dev/null | cut -f3 -d ',')
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
b=$(battery_pct_remaining)
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [ $b -gt 50 ] ; then
|
||||
color='green'
|
||||
elif [ $b -gt 20 ] ; then
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
# Autocompletion for homebrew-cask.
|
||||
#
|
||||
# This script intercepts calls to the brew plugin and adds autocompletion
|
||||
# for the cask subcommand.
|
||||
#
|
||||
# Author: https://github.com/pstadler
|
||||
|
||||
compdef _brew-cask brew
|
||||
|
||||
_brew-cask()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
':subcmd:->subcmd' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__call_original_brew
|
||||
cask_commands=(
|
||||
'cask:manage casks'
|
||||
)
|
||||
_describe -t commands 'brew cask command' cask_commands ;;
|
||||
|
||||
(subcmd)
|
||||
case "$line[1]" in
|
||||
cask)
|
||||
if (( CURRENT == 3 )); then
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"alfred:used to modify Alfred's scope to include the Caskroom"
|
||||
'audit:verifies installability of casks'
|
||||
'checklinks:checks for bad cask links'
|
||||
'cleanup:cleans up cached downloads'
|
||||
'create:creates a cask of the given name and opens it in an editor'
|
||||
'doctor:checks for configuration issues'
|
||||
'edit:edits the cask of the given name'
|
||||
'fetch:downloads Cask resources to local cache'
|
||||
'home:opens the homepage of the cask of the given name'
|
||||
'info:displays information about the cask of the given name'
|
||||
'install:installs the cask of the given name'
|
||||
'list:with no args, lists installed casks; given installed casks, lists installed files'
|
||||
'search:searches all known casks'
|
||||
'uninstall:uninstalls the cask of the given name'
|
||||
"update:a synonym for 'brew update'"
|
||||
)
|
||||
_describe -t commands "brew cask subcommand" subcommands
|
||||
fi ;;
|
||||
|
||||
*)
|
||||
__call_original_brew ;;
|
||||
esac ;;
|
||||
|
||||
(options)
|
||||
local -a casks installed_casks
|
||||
local expl
|
||||
case "$line[2]" in
|
||||
list|uninstall)
|
||||
__brew_installed_casks
|
||||
_wanted installed_casks expl 'installed casks' compadd -a installed_casks ;;
|
||||
audit|edit|home|info|install)
|
||||
__brew_all_casks
|
||||
_wanted casks expl 'all casks' compadd -a casks ;;
|
||||
esac ;;
|
||||
esac
|
||||
}
|
||||
|
||||
__brew_all_casks() {
|
||||
casks=(`brew cask search`)
|
||||
}
|
||||
|
||||
__brew_installed_casks() {
|
||||
installed_casks=(`brew cask list`)
|
||||
}
|
||||
|
||||
__call_original_brew()
|
||||
{
|
||||
local ret=1
|
||||
_call_function ret _brew
|
||||
compdef _brew-cask brew
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
#compdef brew
|
||||
#autoload
|
||||
|
||||
# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh
|
||||
|
||||
# Brew ZSH completion function
|
||||
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
|
||||
# and rename it _brew
|
||||
#
|
||||
# altered from _fink
|
||||
|
||||
_brew_all_formulae() {
|
||||
formulae=(`brew search`)
|
||||
}
|
||||
|
||||
_brew_installed_formulae() {
|
||||
installed_formulae=(`brew list`)
|
||||
}
|
||||
|
||||
_brew_installed_taps() {
|
||||
installed_taps=(`brew tap`)
|
||||
}
|
||||
|
||||
_brew_official_taps() {
|
||||
official_taps=(`brew tap --list-official`)
|
||||
}
|
||||
|
||||
_brew_pinned_taps() {
|
||||
pinned_taps=(`brew tap --list-pinned`)
|
||||
}
|
||||
|
||||
_brew_outdated_formulae() {
|
||||
outdated_formulae=(`brew outdated`)
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'audit:check formulae for Homebrew coding style'
|
||||
'cat:display formula file for a formula'
|
||||
'cleanup:uninstall unused and old versions of packages'
|
||||
'commands:show a list of commands'
|
||||
'config:show homebrew and system configuration'
|
||||
'create:create a new formula'
|
||||
'deps:list dependencies and dependants of a formula'
|
||||
'desc:display a description of a formula'
|
||||
'doctor:audits your installation for common issues'
|
||||
'edit:edit a formula'
|
||||
'fetch:download formula resources to the cache'
|
||||
'gist-logs:generate a gist of the full build logs'
|
||||
'home:visit the homepage of a formula or the brew project'
|
||||
'info:information about a formula'
|
||||
'install:install a formula'
|
||||
'reinstall:install a formula anew; re-using its current options'
|
||||
'leaves:show installed formulae that are not dependencies of another installed formula'
|
||||
'link:link a formula'
|
||||
'linkapps:symlink .app bundles provided by formulae into /Applications'
|
||||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
'missing:check all installed formuale for missing dependencies.'
|
||||
'migrate:migrate renamed formula to new name'
|
||||
'outdated:list formulae for which a newer version is available'
|
||||
'pin:pin specified formulae'
|
||||
'postinstall:perform post_install for a given formula'
|
||||
'prune:remove dead links'
|
||||
'remove:remove a formula'
|
||||
'search:search for a formula (/regex/ or string)'
|
||||
'switch:switch between different versions of a formula'
|
||||
'tap:tap a new formula repository from GitHub, or list existing taps'
|
||||
'tap-info:information about a tap'
|
||||
'tap-pin:pin a tap'
|
||||
'tap-unpin:unpin a tap'
|
||||
'test-bot:test a formula and build a bottle'
|
||||
'uninstall:uninstall a formula'
|
||||
'unlink:unlink a formula'
|
||||
'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications'
|
||||
'unpin:unpin specified formulae'
|
||||
'untap:remove a tapped repository'
|
||||
'update:fetch latest version of Homebrew and all formulae'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
'uses:show formulae which depend on a formula'
|
||||
`brew commands --quiet --include-aliases`
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a formulae installed_formulae installed_taps official_taps outdated_formulae
|
||||
|
||||
_arguments \
|
||||
'(-v)-v[verbose]' \
|
||||
'(--cellar)--cellar[brew cellar]' \
|
||||
'(--env)--env[brew environment]' \
|
||||
'(--repository)--repository[brew repository]' \
|
||||
'(--version)--version[version information]' \
|
||||
'(--prefix)--prefix[where brew lives on this system]' \
|
||||
'(--cache)--cache[brew cache]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "brew subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
linkapps|unlinkapps)
|
||||
_arguments \
|
||||
'(--local)--local[operate on ~/Applications instead of /Applications]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
|
||||
'(--pinned)--pinned[list all versions of pinned formulae]' \
|
||||
'(--versions)--versions[list all installed versions of a formula]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
remove|rm|uninstall|unlink|cleanup|link|ln|pin|unpin)
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
|
||||
search|-S)
|
||||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
untap|tap-info|tap-pin)
|
||||
_brew_installed_taps
|
||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||
tap)
|
||||
_brew_official_taps
|
||||
_wanted official_taps expl 'official taps' compadd -a official_taps ;;
|
||||
tap-unpin)
|
||||
_brew_pinned_taps
|
||||
_wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;;
|
||||
upgrade)
|
||||
_brew_outdated_formulae
|
||||
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
|
||||
esac
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
## Coffeescript Plugin
|
||||
|
||||
This plugin provides aliases for quickly compiling and previewing your
|
||||
cofeescript code.
|
||||
coffeescript code.
|
||||
|
||||
When writing Coffeescript it's very common to want to preview the output of a
|
||||
certain snippet of code, either because you want to test the output or because
|
||||
|
|
|
|||
13
plugins/docker-compose/docker-compose.plugin.zsh
Normal file
13
plugins/docker-compose/docker-compose.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Authors:
|
||||
# https://github.com/tristola
|
||||
#
|
||||
# Docker-compose related zsh aliases
|
||||
|
||||
# Aliases ###################################################################
|
||||
|
||||
alias dcup='docker-compose up'
|
||||
alias dcb='docker-compose build'
|
||||
alias dcrm='docker-compose rm'
|
||||
alias dcps='docker-compose ps'
|
||||
alias dcstop='docker-compose stop'
|
||||
alias dcrestart='docker-compose restart'
|
||||
|
|
@ -1,19 +1,5 @@
|
|||
## Docker autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all docker commands.
|
||||
- Will also show containerIDs and Image names where applicable
|
||||
|
||||
####Shows help for all commands
|
||||

|
||||
|
||||
|
||||
####Shows your downloaded images where applicable
|
||||

|
||||
|
||||
|
||||
####Shows your running containers where applicable
|
||||

|
||||
|
||||
|
||||
|
||||
Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan))
|
||||
A copy of the completion script from the
|
||||
[docker](https://github.com/docker/docker/tree/master/contrib/completion/zsh)
|
||||
git repo.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
17
plugins/firewalld/firewalld.plugin.zsh
Normal file
17
plugins/firewalld/firewalld.plugin.zsh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
alias fw="sudo firewall-cmd"
|
||||
alias fwp="sudo firewall-cmd --permanent"
|
||||
alias fwr="sudo firewall-cmd --reload"
|
||||
alias fwrp="sudo firewall-cmd --runtime-to-permanent"
|
||||
|
||||
function fwl () {
|
||||
# converts output to zsh array ()
|
||||
# @f flag split on new line
|
||||
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}")
|
||||
|
||||
for i in $zones; do
|
||||
sudo firewall-cmd --zone $i --list-all
|
||||
done
|
||||
|
||||
echo 'Direct Rules:'
|
||||
sudo firewall-cmd --direct --get-all-rules
|
||||
}
|
||||
22
plugins/firewalld/readme.md
Normal file
22
plugins/firewalld/readme.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# FirewallD Plugin
|
||||
|
||||
This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
|
||||
|
||||
```zsh
|
||||
plugins=(... firewalld)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| :---- | :----------------------------------------- | :--------------------------- |
|
||||
| fw | `sudo firewall-cmd` | Shorthand |
|
||||
| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
|
||||
| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
|
||||
| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| :------- | :--------------------------------------------------------- |
|
||||
| fwl | Lists configuration from all active zones and direct rules |
|
||||
|
|
@ -46,6 +46,7 @@ alias gapa='git add --patch'
|
|||
|
||||
alias gb='git branch'
|
||||
alias gba='git branch -a'
|
||||
alias gbd='git branch -d'
|
||||
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
|
||||
alias gbl='git blame -b -w'
|
||||
alias gbnm='git branch --no-merged'
|
||||
|
|
@ -161,7 +162,7 @@ compdef git-svn-dcommit-push=git
|
|||
|
||||
alias gk='\gitk --all --branches'
|
||||
compdef _git gk='gitk'
|
||||
alias gke='\gitk --all $(git log -g --pretty=format:%h)'
|
||||
alias gke='\gitk --all $(git log -g --pretty=%h)'
|
||||
compdef _git gke='gitk'
|
||||
|
||||
alias gl='git pull'
|
||||
|
|
@ -171,8 +172,8 @@ 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'
|
||||
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 glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
alias glp="_git_log_prettily"
|
||||
|
|
|
|||
1
plugins/gradle/_gradle
Symbolic link
1
plugins/gradle/_gradle
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
gradle.plugin.zsh
|
||||
1
plugins/gradle/_gradlew
Symbolic link
1
plugins/gradle/_gradlew
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
gradle.plugin.zsh
|
||||
|
|
@ -60,6 +60,35 @@ _gradle_does_task_list_need_generating () {
|
|||
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]]
|
||||
}
|
||||
|
||||
##############
|
||||
# Parse the tasks from `gradle(w) tasks --all` into .gradletasknamecache
|
||||
# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
|
||||
# are considered to be tasks. If and when gradle adds support for listing tasks
|
||||
# for programmatic parsing, this method can be deprecated.
|
||||
##############
|
||||
_gradle_parse_tasks () {
|
||||
lines_might_be_tasks=false
|
||||
task_name_buffer=""
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^-+$ ]]; then
|
||||
lines_might_be_tasks=true
|
||||
# Empty buffer, because it contains items that are not tasks
|
||||
task_name_buffer=""
|
||||
elif [[ $line =~ ^\s*$ ]]; then
|
||||
if [[ "$lines_might_be_tasks" = true ]]; then
|
||||
# If a newline is found, send the buffer to .gradletasknamecache
|
||||
while read -r task; do
|
||||
echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
|
||||
done <<< "$task_name_buffer"
|
||||
# Empty buffer, because we are done with the tasks
|
||||
task_name_buffer=""
|
||||
fi
|
||||
lines_might_be_tasks=false
|
||||
elif [[ "$lines_might_be_tasks" = true ]]; then
|
||||
task_name_buffer="${task_name_buffer}\n${line}"
|
||||
fi
|
||||
done <<< "$1"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Discover the gradle tasks by running "gradle tasks --all"
|
||||
|
|
@ -68,7 +97,7 @@ _gradle_tasks () {
|
|||
if [[ -f build.gradle ]]; then
|
||||
_gradle_arguments
|
||||
if _gradle_does_task_list_need_generating; then
|
||||
gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
|
||||
_gradle_parse_tasks "$(gradle tasks --all)" > .gradletasknamecache
|
||||
fi
|
||||
compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
|
||||
fi
|
||||
|
|
@ -78,7 +107,7 @@ _gradlew_tasks () {
|
|||
if [[ -f build.gradle ]]; then
|
||||
_gradle_arguments
|
||||
if _gradle_does_task_list_need_generating; then
|
||||
./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
|
||||
_gradle_parse_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
|
||||
fi
|
||||
compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ function _lein_commands() {
|
|||
"version:print leiningen's version"
|
||||
)
|
||||
_describe -t subcommands 'leiningen subcommands' subcommands && ret=0
|
||||
;;
|
||||
*) _files
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ function listMavenCompletions {
|
|||
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
|
||||
|
||||
# options
|
||||
-Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true
|
||||
-Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true
|
||||
|
||||
# arguments
|
||||
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
|
||||
|
|
@ -181,6 +181,7 @@ function listMavenCompletions {
|
|||
archetype:generate generate-sources
|
||||
cobertura:cobertura
|
||||
-Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
|
||||
-Dit.test= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@
|
|||
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
|
||||
|
||||
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
|
||||
npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
|
||||
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
|
||||
[[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
|
||||
fi
|
||||
|
||||
source $__NPM_COMPLETION_FILE
|
||||
[[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
|
||||
|
||||
unset __NPM_COMPLETION_FILE
|
||||
}
|
||||
|
||||
# Install dependencies globally
|
||||
|
|
@ -29,6 +32,12 @@ alias npmE='PATH="$(npm bin)":"$PATH"'
|
|||
# Check which npm modules are outdated
|
||||
alias npmO="npm outdated"
|
||||
|
||||
# Check package versions
|
||||
alias npmV="npm -v"
|
||||
|
||||
# List packages
|
||||
alias npmL="npm list"
|
||||
|
||||
# Run npm start
|
||||
alias npmst="npm start"
|
||||
|
||||
|
|
|
|||
|
|
@ -30,3 +30,4 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
|||
| `showfiles` | Show hidden files |
|
||||
| `hidefiles` | Hide the hidden files |
|
||||
| `itunes` | Control iTunes. User `itunes -h` for usage details |
|
||||
| `spotify` | Control Spotify and search by artist, album, track and etc.|
|
||||
|
|
|
|||
|
|
@ -261,6 +261,270 @@ EOF
|
|||
osascript -e "tell application \"iTunes\" to $opt"
|
||||
}
|
||||
|
||||
# Spotify control function
|
||||
function spotify() {
|
||||
|
||||
showHelp () {
|
||||
echo "Usage:";
|
||||
echo;
|
||||
echo " $(basename "$0") <command>";
|
||||
echo;
|
||||
echo "Commands:";
|
||||
echo;
|
||||
echo " play # Resumes playback where Spotify last left off.";
|
||||
echo " play [song name] # Finds a song by name and plays it.";
|
||||
echo " play album [album name] # Finds an album by name and plays it.";
|
||||
echo " play artist [artist name] # Finds an artist by name and plays it.";
|
||||
echo " play list [playlist name] # Finds a playlist by name and plays it.";
|
||||
echo " pause # Pauses Spotify playback.";
|
||||
echo " next # Skips to the next song in a playlist.";
|
||||
echo " prev # Returns to the previous song in a playlist.";
|
||||
echo " pos [time] # Jumps to a time (in secs) in the current song.";
|
||||
echo " quit # Stops playback and quits Spotify.";
|
||||
echo;
|
||||
echo " vol up # Increases the volume by 10%.";
|
||||
echo " vol down # Decreases the volume by 10%.";
|
||||
echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
|
||||
echo " vol show # Shows the current Spotify volume.";
|
||||
echo;
|
||||
echo " status # Shows the current player status.";
|
||||
echo " share # Copies the current song URL to the clipboard."
|
||||
echo " info # Shows Full Information about song that is playing.";
|
||||
echo;
|
||||
echo " toggle shuffle # Toggles shuffle playback mode.";
|
||||
echo " toggle repeat # Toggles repeat playback mode.";
|
||||
}
|
||||
|
||||
cecho(){
|
||||
bold=$(tput bold);
|
||||
green=$(tput setaf 2);
|
||||
reset=$(tput sgr0);
|
||||
echo "$bold$green$1$reset";
|
||||
}
|
||||
|
||||
showStatus () {
|
||||
state=$(osascript -e 'tell application "Spotify" to player state as string');
|
||||
cecho "Spotify is currently $state.";
|
||||
if [ "$state" = "playing" ]; then
|
||||
artist=$(osascript -e 'tell application "Spotify" to artist of current track as string');
|
||||
album=$(osascript -e 'tell application "Spotify" to album of current track as string');
|
||||
track=$(osascript -e 'tell application "Spotify" to name of current track as string');
|
||||
duration=$(osascript -e 'tell application "Spotify" to duration of current track as string');
|
||||
duration=$(echo "scale=2; $duration / 60 / 1000" | bc);
|
||||
position=$(osascript -e 'tell application "Spotify" to player position as string' | tr ',' '.');
|
||||
position=$(echo "scale=2; $position / 60" | bc | awk '{printf "%0.2f", $0}');
|
||||
|
||||
printf "$reset""Artist: %s\nAlbum: %s\nTrack: %s \nPosition: %s / %s" "$artist" "$album" "$track" "$position" "$duration";
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
showHelp;
|
||||
else
|
||||
if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then
|
||||
osascript -e 'tell application "Spotify" to activate'
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
arg=$1;
|
||||
|
||||
case $arg in
|
||||
"play" )
|
||||
if [ $# != 1 ]; then
|
||||
# There are additional arguments, so find out how many
|
||||
array=( $@ );
|
||||
len=${#array[@]};
|
||||
SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search"
|
||||
SPOTIFY_PLAY_URI="";
|
||||
|
||||
searchAndPlay() {
|
||||
type="$1"
|
||||
Q="$2"
|
||||
|
||||
cecho "Searching ${type}s for: $Q";
|
||||
|
||||
SPOTIFY_PLAY_URI=$( \
|
||||
curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=$type&limit=1&offset=0" -H "Accept: application/json" \
|
||||
| grep -E -o "spotify:$type:[a-zA-Z0-9]+" -m 1
|
||||
)
|
||||
}
|
||||
|
||||
case $2 in
|
||||
"list" )
|
||||
_args=${array[*]:2:$len};
|
||||
Q=$_args;
|
||||
|
||||
cecho "Searching playlists for: $Q";
|
||||
|
||||
results=$( \
|
||||
curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" \
|
||||
| grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \
|
||||
)
|
||||
|
||||
count=$( \
|
||||
echo "$results" | grep -c "spotify:user" \
|
||||
)
|
||||
|
||||
if [ "$count" -gt 0 ]; then
|
||||
random=$(( RANDOM % count));
|
||||
|
||||
SPOTIFY_PLAY_URI=$( \
|
||||
echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \
|
||||
)
|
||||
fi;;
|
||||
|
||||
"album" | "artist" | "track" )
|
||||
_args=${array[*]:2:$len};
|
||||
searchAndPlay "$2" "$_args";;
|
||||
|
||||
* )
|
||||
_args=${array[*]:1:$len};
|
||||
searchAndPlay track "$_args";;
|
||||
esac
|
||||
|
||||
if [ "$SPOTIFY_PLAY_URI" != "" ]; then
|
||||
cecho "Playing ($Q Search) -> Spotify URL: $SPOTIFY_PLAY_URI";
|
||||
|
||||
osascript -e "tell application \"Spotify\" to play track \"$SPOTIFY_PLAY_URI\"";
|
||||
|
||||
else
|
||||
cecho "No results when searching for $Q";
|
||||
fi
|
||||
else
|
||||
# play is the only param
|
||||
cecho "Playing Spotify.";
|
||||
osascript -e 'tell application "Spotify" to play';
|
||||
fi
|
||||
break ;;
|
||||
|
||||
"pause" )
|
||||
state=$(osascript -e 'tell application "Spotify" to player state as string');
|
||||
if [ "$state" = "playing" ]; then
|
||||
cecho "Pausing Spotify.";
|
||||
else
|
||||
cecho "Playing Spotify.";
|
||||
fi
|
||||
|
||||
osascript -e 'tell application "Spotify" to playpause';
|
||||
break ;;
|
||||
|
||||
"quit" )
|
||||
cecho "Quitting Spotify.";
|
||||
osascript -e 'tell application "Spotify" to quit';
|
||||
exit 1 ;;
|
||||
|
||||
"next" )
|
||||
cecho "Going to next track." ;
|
||||
osascript -e 'tell application "Spotify" to next track';
|
||||
break ;;
|
||||
|
||||
"prev" )
|
||||
cecho "Going to previous track.";
|
||||
osascript -e 'tell application "Spotify" to previous track';
|
||||
break ;;
|
||||
|
||||
"vol" )
|
||||
vol=$(osascript -e 'tell application "Spotify" to sound volume as integer');
|
||||
if [[ "$2" = "show" || "$2" = "" ]]; then
|
||||
cecho "Current Spotify volume level is $vol.";
|
||||
break ;
|
||||
elif [ "$2" = "up" ]; then
|
||||
if [ "$vol" -le 90 ]; then
|
||||
newvol=$(( vol+10 ));
|
||||
cecho "Increasing Spotify volume to $newvol.";
|
||||
else
|
||||
newvol=100;
|
||||
cecho "Spotify volume level is at max.";
|
||||
fi
|
||||
elif [ "$2" = "down" ]; then
|
||||
if [ "$vol" -ge 10 ]; then
|
||||
newvol=$(( vol-10 ));
|
||||
cecho "Reducing Spotify volume to $newvol.";
|
||||
else
|
||||
newvol=0;
|
||||
cecho "Spotify volume level is at min.";
|
||||
fi
|
||||
elif [ "$2" -ge 0 ]; then
|
||||
newvol=$2;
|
||||
fi
|
||||
|
||||
osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
|
||||
break ;;
|
||||
|
||||
"toggle" )
|
||||
if [ "$2" = "shuffle" ]; then
|
||||
osascript -e 'tell application "Spotify" to set shuffling to not shuffling';
|
||||
curr=$(osascript -e 'tell application "Spotify" to shuffling');
|
||||
cecho "Spotify shuffling set to $curr";
|
||||
elif [ "$2" = "repeat" ]; then
|
||||
osascript -e 'tell application "Spotify" to set repeating to not repeating';
|
||||
curr=$(osascript -e 'tell application "Spotify" to repeating');
|
||||
cecho "Spotify repeating set to $curr";
|
||||
fi
|
||||
break ;;
|
||||
|
||||
"pos" )
|
||||
cecho "Adjusting Spotify play position."
|
||||
osascript -e "tell application \"Spotify\" to set player position to $2";
|
||||
break;;
|
||||
|
||||
"status" )
|
||||
showStatus;
|
||||
break ;;
|
||||
|
||||
"info" )
|
||||
info=$(osascript -e 'tell application "Spotify"
|
||||
set tM to round (duration of current track / 60) rounding down
|
||||
set tS to duration of current track mod 60
|
||||
set pos to player position as text
|
||||
set myTime to tM as text & "min " & tS as text & "s"
|
||||
set nM to round (player position / 60) rounding down
|
||||
set nS to round (player position mod 60) rounding down
|
||||
set nowAt to nM as text & "min " & nS as text & "s"
|
||||
set info to "" & "\nArtist: " & artist of current track
|
||||
set info to info & "\nTrack: " & name of current track
|
||||
set info to info & "\nAlbum Artist: " & album artist of current track
|
||||
set info to info & "\nAlbum: " & album of current track
|
||||
set info to info & "\nSeconds: " & duration of current track
|
||||
set info to info & "\nSeconds played: " & pos
|
||||
set info to info & "\nDuration: " & mytime
|
||||
set info to info & "\nNow at: " & nowAt
|
||||
set info to info & "\nPlayed Count: " & played count of current track
|
||||
set info to info & "\nTrack Number: " & track number of current track
|
||||
set info to info & "\nPopularity: " & popularity of current track
|
||||
set info to info & "\nId: " & id of current track
|
||||
set info to info & "\nSpotify URL: " & spotify url of current track
|
||||
set info to info & "\nArtwork: " & artwork of current track
|
||||
set info to info & "\nPlayer: " & player state
|
||||
set info to info & "\nVolume: " & sound volume
|
||||
set info to info & "\nShuffle: " & shuffling
|
||||
set info to info & "\nRepeating: " & repeating
|
||||
end tell
|
||||
return info')
|
||||
echo "$info";
|
||||
break ;;
|
||||
|
||||
"share" )
|
||||
url=$(osascript -e 'tell application "Spotify" to spotify url of current track');
|
||||
remove='spotify:track:'
|
||||
url=${url#$remove}
|
||||
url="http://open.spotify.com/track/$url"
|
||||
cecho "Share URL: $url";
|
||||
cecho -n "$url" | pbcopy
|
||||
break;;
|
||||
|
||||
-h|--help| *)
|
||||
showHelp;
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Show/hide hidden files in the Finder
|
||||
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
### Aliases
|
||||
|
||||
# Set all files' permissions to 644 recursively in a directory
|
||||
alias set644='find . -type f -print0 | xargs -0 chmod 644'
|
||||
alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644'
|
||||
|
||||
# Set all directories' permissions to 755 recursively in a directory
|
||||
alias set755='find . -type d -print0 | xargs -0 chmod 755'
|
||||
alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755'
|
||||
|
||||
### Functions
|
||||
|
||||
|
|
@ -63,14 +63,14 @@ EOF
|
|||
exit_status=0;
|
||||
if [[ $use_slow == true ]]; then
|
||||
# Process directories first so non-traversable ones are fixed as we go
|
||||
find "$target" -type d -exec chmod $chmod_opts 755 {} \;
|
||||
find "$target" -type d ! -perm 755 -exec chmod $chmod_opts 755 {} \;
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
find "$target" -type f -exec chmod $chmod_opts 644 {} \;
|
||||
find "$target" -type f ! -perm 644 -exec chmod $chmod_opts 644 {} \;
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
else
|
||||
find "$target" -type d -print0 | xargs -0 chmod $chmod_opts 755
|
||||
find "$target" -type d ! -perm 755 -print0 | xargs -0 chmod $chmod_opts 755
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
find "$target" -type f -print0 | xargs -0 chmod $chmod_opts 644
|
||||
find "$target" -type f ! -perm 644 -print0 | xargs -0 chmod $chmod_opts 644
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
fi
|
||||
echo "Complete"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ alias -g RET='RAILS_ENV=test'
|
|||
|
||||
# Rails aliases
|
||||
alias rc='rails console'
|
||||
alias rcs='rails console --sandbox'
|
||||
alias rd='rails destroy'
|
||||
alias rdb='rails dbconsole'
|
||||
alias rg='rails generate'
|
||||
|
|
|
|||
38
plugins/ssh-agent/README.md
Normal file
38
plugins/ssh-agent/README.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# ssh-agent plugin
|
||||
|
||||
This plugin starts automatically `ssh-agent` to set up and load whichever
|
||||
credentials you want for ssh connections.
|
||||
|
||||
To enable it, add `ssh-agent` to your plugins:
|
||||
|
||||
```zsh
|
||||
plugins=(... ssh-agent)
|
||||
```
|
||||
|
||||
## Instructions
|
||||
|
||||
To enable **agent forwarding support** add the following to your zshrc file:
|
||||
|
||||
```zsh
|
||||
zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||
```
|
||||
|
||||
To **load multiple identities** use the `identities` style, For example:
|
||||
|
||||
```zsh
|
||||
zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github
|
||||
```
|
||||
|
||||
To **set the maximum lifetime of the identities**, use the `lifetime` style.
|
||||
The lifetime may be specified in seconds or as described in sshd_config(5)
|
||||
(see _TIME FORMATS_). If left unspecified, the default lifetime is forever.
|
||||
|
||||
```zsh
|
||||
zstyle :omz:plugins:ssh-agent lifetime 4h
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Based on code from Joseph M. Reagle: http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
|
||||
|
||||
Agent-forwarding support based on ideas from Florent Thoumie and Jonas Pfenniger
|
||||
|
|
@ -1,79 +1,42 @@
|
|||
#
|
||||
# INSTRUCTIONS
|
||||
#
|
||||
# To enable agent forwarding support add the following to
|
||||
# your .zshrc file:
|
||||
#
|
||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||
#
|
||||
# To load multiple identities use the identities style, For
|
||||
# example:
|
||||
#
|
||||
# zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github
|
||||
#
|
||||
# To set the maximum lifetime of the identities, use the
|
||||
# lifetime style. The lifetime may be specified in seconds
|
||||
# or as described in sshd_config(5) (see TIME FORMATS)
|
||||
# If left unspecified, the default lifetime is forever.
|
||||
#
|
||||
# zstyle :omz:plugins:ssh-agent lifetime 4h
|
||||
#
|
||||
# CREDITS
|
||||
#
|
||||
# Based on code from Joseph M. Reagle
|
||||
# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
|
||||
#
|
||||
# Agent forwarding support based on ideas from
|
||||
# Florent Thoumie and Jonas Pfenniger
|
||||
#
|
||||
typeset _agent_forwarding _ssh_env_cache
|
||||
|
||||
local _plugin__ssh_env
|
||||
local _plugin__forwarding
|
||||
function _start_agent() {
|
||||
local lifetime
|
||||
local -a identities
|
||||
|
||||
function _plugin__start_agent()
|
||||
{
|
||||
local -a identities
|
||||
local lifetime
|
||||
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
|
||||
# start ssh-agent and setup environment
|
||||
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
|
||||
|
||||
# start ssh-agent and setup environment
|
||||
/usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! ${_plugin__ssh_env}
|
||||
chmod 600 ${_plugin__ssh_env}
|
||||
. ${_plugin__ssh_env} > /dev/null
|
||||
ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache
|
||||
chmod 600 $_ssh_env_cache
|
||||
. $_ssh_env_cache > /dev/null
|
||||
|
||||
# load identies
|
||||
zstyle -a :omz:plugins:ssh-agent identities identities
|
||||
echo starting ssh-agent...
|
||||
# load identies
|
||||
zstyle -a :omz:plugins:ssh-agent identities identities
|
||||
|
||||
/usr/bin/ssh-add $HOME/.ssh/${^identities}
|
||||
echo starting ssh-agent...
|
||||
ssh-add $HOME/.ssh/${^identities}
|
||||
}
|
||||
|
||||
# Get the filename to store/lookup the environment from
|
||||
if (( $+commands[scutil] )); then
|
||||
# It's OS X!
|
||||
_plugin__ssh_env="$HOME/.ssh/environment-$(scutil --get ComputerName)"
|
||||
else
|
||||
_plugin__ssh_env="$HOME/.ssh/environment-$HOST"
|
||||
fi
|
||||
_ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST"
|
||||
|
||||
# test if agent-forwarding is enabled
|
||||
zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding
|
||||
if [[ ${_plugin__forwarding} == "yes" && -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
|
||||
zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding
|
||||
|
||||
elif [ -f "${_plugin__ssh_env}" ]; then
|
||||
# Source SSH settings, if applicable
|
||||
. ${_plugin__ssh_env} > /dev/null
|
||||
ps x | grep ${SSH_AGENT_PID} | grep ssh-agent > /dev/null || {
|
||||
_plugin__start_agent;
|
||||
}
|
||||
if [[ $_agent_forwarding == "yes" && -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
|
||||
elif [[ -f "$_ssh_env_cache" ]]; then
|
||||
# Source SSH settings, if applicable
|
||||
. $_ssh_env_cache > /dev/null
|
||||
ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || {
|
||||
_start_agent
|
||||
}
|
||||
else
|
||||
_plugin__start_agent;
|
||||
_start_agent
|
||||
fi
|
||||
|
||||
# tidy up after ourselves
|
||||
unfunction _plugin__start_agent
|
||||
unset _plugin__forwarding
|
||||
unset _plugin__ssh_env
|
||||
|
||||
unset _agent_forwarding _ssh_env_cache
|
||||
unfunction _start_agent
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ function zle-keymap-select() {
|
|||
|
||||
# Ensure that the prompt is redrawn when the terminal size changes.
|
||||
TRAPWINCH() {
|
||||
zle && { zle reset-prompt; zle -R }
|
||||
zle && zle -R
|
||||
}
|
||||
|
||||
zle -N zle-keymap-select
|
||||
|
|
@ -28,6 +28,13 @@ bindkey '^?' backward-delete-char
|
|||
bindkey '^h' backward-delete-char
|
||||
bindkey '^w' backward-kill-word
|
||||
|
||||
# allow ctrl-r to perform backward search in history
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
|
||||
# allow ctrl-a and ctrl-e to move to beginning/end of line
|
||||
bindkey '^a' beginning-of-line
|
||||
bindkey '^e' end-of-line
|
||||
|
||||
# if mode indicator wasn't setup by theme, define default
|
||||
if [[ "$MODE_INDICATOR" == "" ]]; then
|
||||
MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -127,6 +127,27 @@ prompt_git() {
|
|||
fi
|
||||
}
|
||||
|
||||
prompt_bzr() {
|
||||
if (bzr status >/dev/null 2>&1); then
|
||||
status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
|
||||
status_all=`bzr status | head -n1 | wc -m`
|
||||
revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
|
||||
if [[ $status_mod -gt 0 ]] ; then
|
||||
prompt_segment yellow black
|
||||
echo -n "bzr@"$revision "✚ "
|
||||
else
|
||||
if [[ $status_all -gt 0 ]] ; then
|
||||
prompt_segment yellow black
|
||||
echo -n "bzr@"$revision
|
||||
|
||||
else
|
||||
prompt_segment green black
|
||||
echo -n "bzr@"$revision
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_hg() {
|
||||
(( $+commands[hg] )) || return
|
||||
local rev status
|
||||
|
|
@ -198,6 +219,7 @@ build_prompt() {
|
|||
prompt_context
|
||||
prompt_dir
|
||||
prompt_git
|
||||
prompt_bzr
|
||||
prompt_hg
|
||||
prompt_end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,4 @@ PROMPT='
|
|||
%~
|
||||
${smiley} %{$reset_color%}'
|
||||
|
||||
if [[ -d ~/.rvm ]] && [[ -e ~/.rvm/bin/rvm-prompt ]]; then
|
||||
rvm_prompt='$(~/.rvm/bin/rvm-prompt)'
|
||||
else
|
||||
rvm_prompt=''
|
||||
fi
|
||||
|
||||
RPROMPT='%{$fg[white]%} $rvm_prompt$(git_prompt)%{$reset_color%}'
|
||||
RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue