summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/asdf/asdf.plugin.zsh8
-rw-r--r--plugins/brew/README.md2
-rw-r--r--plugins/brew/brew.plugin.zsh2
-rw-r--r--plugins/emacs/emacs.plugin.zsh2
-rw-r--r--plugins/jenv/jenv.plugin.zsh2
-rw-r--r--plugins/kubectl/README.md2
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh4
-rw-r--r--plugins/laravel/README.md45
-rw-r--r--plugins/laravel/laravel.plugin.zsh23
-rw-r--r--plugins/osx/spotify11
-rw-r--r--plugins/ros/README.mkd10
-rw-r--r--plugins/ros/_ros64
-rw-r--r--plugins/timer/README.md17
-rw-r--r--plugins/timer/timer.plugin.zsh29
-rw-r--r--plugins/web-search/web-search.plugin.zsh2
-rw-r--r--plugins/z/z.sh6
16 files changed, 209 insertions, 20 deletions
diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
index 75395c718..38b225538 100644
--- a/plugins/asdf/asdf.plugin.zsh
+++ b/plugins/asdf/asdf.plugin.zsh
@@ -1,9 +1,11 @@
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
+ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for Homebrew package
-if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then
+if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)"
+ ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
fi
# Load command
@@ -11,7 +13,7 @@ if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
. "$ASDF_DIR/asdf.sh"
# Load completions
- if [[ -f "$ASDF_DIR/completions/asdf.bash" ]]; then
- . "$ASDF_DIR/completions/asdf.bash"
+ if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
+ . "$ASDF_COMPLETIONS/asdf.bash"
fi
fi
diff --git a/plugins/brew/README.md b/plugins/brew/README.md
index aab55ea39..c129a7652 100644
--- a/plugins/brew/README.md
+++ b/plugins/brew/README.md
@@ -17,3 +17,5 @@ plugins=(... brew)
| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
+| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
+| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. | \ No newline at end of file
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
index 60b81f8ec..cfbaa3480 100644
--- a/plugins/brew/brew.plugin.zsh
+++ b/plugins/brew/brew.plugin.zsh
@@ -4,6 +4,8 @@ alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
+alias bcubo='brew update && brew cask outdated'
+alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
print -P '%F{yellow}'Oh My Zsh brew plugin:
diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
index db0ab13af..934c8d673 100644
--- a/plugins/emacs/emacs.plugin.zsh
+++ b/plugins/emacs/emacs.plugin.zsh
@@ -16,7 +16,7 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
# set EDITOR if not already defined.
export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}"
- alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
+ alias emacs="$EMACS_PLUGIN_LAUNCHER -t"
alias e=emacs
# open terminal emacsclient
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh
index 14c586be9..2eda8037b 100644
--- a/plugins/jenv/jenv.plugin.zsh
+++ b/plugins/jenv/jenv.plugin.zsh
@@ -1,4 +1,4 @@
-jenvdirs=("$HOME/.jenv" "/usr/local/jenv" "/opt/jenv")
+jenvdirs=("$HOME/.jenv" "/usr/local" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0
for jenvdir in $jenvdirs; do
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index a93a9339e..b30f90548 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -46,6 +46,7 @@ plugins=(... kubectl)
| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
| | | **Namespace management** |
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
+| kcn | `kubectl config set-context ...` | Change current namespace |
| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
@@ -67,6 +68,7 @@ plugins=(... kubectl)
| kdeld | `kubectl delete deployment` | Delete the deployment |
| ksd | `kubectl scale deployment` | Scale a deployment |
| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
+| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
| | | **Rollout management** |
| kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment |
| krh | `kubectl rollout history` | Check the revisions of this deployment |
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index 4cfe3f45b..d388d6543 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -59,6 +59,7 @@ alias kgns='kubectl get namespaces'
alias kens='kubectl edit namespace'
alias kdns='kubectl describe namespace'
alias kdelns='kubectl delete namespace'
+alias kcn='kubectl config set-context $(kubectl config current-context) --namespace'
# ConfigMap management
alias kgcm='kubectl get configmaps'
@@ -80,6 +81,9 @@ alias kdd='kubectl describe deployment'
alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'
+kres(){
+ kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S)
+}
# Rollout management.
alias kgrs='kubectl get rs'
diff --git a/plugins/laravel/README.md b/plugins/laravel/README.md
index 067c1e9fb..44798b68d 100644
--- a/plugins/laravel/README.md
+++ b/plugins/laravel/README.md
@@ -1,19 +1,40 @@
-# Laravel plugin
+# Laravel
This plugin adds aliases and autocompletion for Laravel [Artisan](https://laravel.com/docs/artisan) and [Bob](http://daylerees.github.io/laravel-bob/) command-line interfaces.
-**NOTE:** completion might not work for recent Laravel versions since it hasn't been updated since 2012.
-In that case, check out plugins `laravel4` and `laravel5`.
-
-To use it, add `laravel` to the plugins array in your zshrc file:
-
-```zsh
+```
plugins=(... laravel)
```
-## Aliases
+| Alias | Description |
+|:-:|:-:|
+| `artisan` | `php artisan` |
+| `pas` | `php artisan serve` |
+
+## Database
+
+| Alias | Description |
+|:-:|:-:|
+| `pam` | `php artisan migrate` |
+| `pamf` | `php artisan migrate:fresh` |
+| `pamfs` | `php artisan migrate:fresh --seed` |
+| `pamr` | `php artisan migrate:rollback` |
+| `pads` | `php artisan db:seed` |
+
+## Makers
+
+| Alias | Description |
+|:-:|:-:|
+| `pamm` | `php artisan make:model` |
+| `pamc` | `php artisan make:controller` |
+| `pams` | `php artisan make:seeder` |
+| `pamt` | `php artisan make:test` |
+
+## Clears
-| Alias | Command | Description |
-|-----------|--------------------------|----------------------|
-| artisan | `php artisan` | Main Artisan command |
-| bob | `php artisan bob::build` | Main Bob command |
+| Alias | Description |
+|:-:|:-:|
+| `pacac` | `php artisan cache:clear` |
+| `pacoc` | `php artisan config:clear` |
+| `pavic` | `php artisan view:clear` |
+| `paroc` | `php artisan route:clear` |
diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh
index ed932ee89..7ddfd85ba 100644
--- a/plugins/laravel/laravel.plugin.zsh
+++ b/plugins/laravel/laravel.plugin.zsh
@@ -1,3 +1,26 @@
#!zsh
alias artisan='php artisan'
alias bob='php artisan bob::build'
+
+# Development
+alias pas='php artisan serve'
+
+# Database
+alias pam='php artisan migrate'
+alias pamf='php artisan migrate:fresh'
+alias pamfs='php artisan migrate:fresh --seed'
+alias pamr='php artisan migrate:rollback'
+alias pads='php artisan db:seed'
+
+# Makers
+alias pamm='php artisan make:model'
+alias pamc='php artisan make:controller'
+alias pams='php artisan make:seeder'
+alias pamt='php artisan make:test'
+
+
+# Clears
+alias pacac='php artisan cache:clear'
+alias pacoc='php artisan config:clear'
+alias pavic='php artisan view:clear'
+alias paroc='php artisan route:clear'
diff --git a/plugins/osx/spotify b/plugins/osx/spotify
index 2ab98d3a0..b4215dbe7 100644
--- a/plugins/osx/spotify
+++ b/plugins/osx/spotify
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
function spotify() {
-# Copyright (c) 2012--2017 Harish Narayanan <mail@harishnarayanan.org>
+# Copyright (c) 2012--2018 Harish Narayanan <mail@harishnarayanan.org>
#
# Contains numerous helpful contributions from Jorge Colindres, Thomas
# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin
@@ -134,8 +134,13 @@ showStatus () {
if [ $# = 0 ]; then
showHelp;
else
+ if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
+ echo "The Spotify application must be installed."
+ exit 1
+ fi
+
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
- osascript -e 'tell application "Spotify" to activate'
+ osascript -e 'tell application "Spotify" to activate' || exit 1
sleep 2
fi
fi
@@ -160,7 +165,7 @@ while [ $# -gt 0 ]; do
showAPIHelp;
exit 1;
fi
- SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n");
+ SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI="";
getAccessToken() {
diff --git a/plugins/ros/README.mkd b/plugins/ros/README.mkd
new file mode 100644
index 000000000..83573e499
--- /dev/null
+++ b/plugins/ros/README.mkd
@@ -0,0 +1,10 @@
+# Roswell Plugin
+
+This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/).
+
+To use it, add `ros` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ros)
+```
+
diff --git a/plugins/ros/_ros b/plugins/ros/_ros
new file mode 100644
index 000000000..6a04d3c8f
--- /dev/null
+++ b/plugins/ros/_ros
@@ -0,0 +1,64 @@
+#compdef ros
+#autoload
+
+# roswell zsh completion, based on gem completion
+
+local -a _1st_arguments
+_1st_arguments=(
+'run: Run repl'
+'install:Install a given implementation or a system for roswell environment'
+'update:Update installed systems.'
+'build:Make executable from script.'
+'use:Change default implementation.'
+'init:a new ros script, optionally based on a template.'
+'fmt:Indent lisp source.'
+'list:Information'
+'template:[WIP] Manage templates'
+'delete:Delete installed implementations'
+'config:Get and set options'
+'version:Show the roswell version information'
+"help:Use \"ros help [command]\" for more information about a command."$'\n\t\t'"Use \"ros help [topic]\" for more information about the topic."
+)
+
+#local expl
+
+_arguments \
+ '(--version)'--version'[Print version information and quit]' \
+ '(-w --wrap)'{-w,--wrap}'[\[CODE\] Run roswell with a shell wrapper CODE]' \
+ '(-m --image)'{-m,--image}'[\[IMAGE\] continue from Lisp image IMAGE]' \
+ '(-M --module)'{-M,--module}'[\[NAME\] Execute ros script found in ROSWELLPATH. (pythons -m)]' \
+ '(-L --lisp)'{-L,--lisp}'[\[NAME\] Run roswell with a lisp impl NAME\[/VERSION\].]' \
+ '(-l --load)'{-l,--load}'[\[FILE\] load lisp FILE while building]' \
+ '(-S --source-registry)'{-S,--source-registry}'[\[X\] override source registry of asdf systems]' \
+ '(-s --system --load-system)'{-s,--system,--load-system}'[\[SYSTEM\] load asdf SYSTEM while building]' \
+ '(-p --package)'{-p,--package}'[\[PACKAGE\] change current package to \[PACKAGE\]]' \
+ '(-sp --system-package)'{-sp,--system-package}'[\[SP\] combination of -s \[SP\] and -p \[SP\]]' \
+ '(-e --eval)'{-e,--eval}'[\[FORM\] evaluate \[FORM\] while building]' \
+ '--require'--require'[\[MODULE\] require \[MODULE\] while building]' \
+ '(-q --quit)'{-q,--quit}'[quit lisp here]' \
+ '(-r --restart)'{-r,--restart}'[\[FUNC\] restart from build by calling (\[FUNC\])]' \
+ '(-E --entry)'{-E,--entry}'[\[FUNC\] restart from build by calling (\[FUNC\] argv)]' \
+ '(-i --init)'{-i,--init}'[\[FORM\] evaluate \[FORM\] after restart]' \
+ '(-ip --print)'{-ip,--print}'[\[FORM\] evaluate and princ \[FORM\] after restart]' \
+ '(-iw --write)'{-iw,--write}'[\[FORM\] evaluate and write \[FORM\] after restart]' \
+ '(-F --final)'{-F,--final}'[\[FORM\] evaluate \[FORM\] before dumping IMAGE]' \
+ '(\+R --no-rc)'{\+R,--no-rc}'[skip /etc/rosrc, ~/.roswell/init.lisp]' \
+ '(-A --asdf)'{-A,--asdf}'[use new asdf]' \
+ '(\+Q --no-quicklisp)'{\+Q,--no-quicklisp}'[do not use quicklisp]' \
+ '(-v --verbose)'{-v,--verbose}'[be quite noisy while building]' \
+ '--quiet'--quiet'[be quite quiet while building default]' \
+ '--test'--test'[for test purpose]' \
+ '*:: :->subcmds' && return 0
+
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "ros subcommand" _1st_arguments
+ return
+fi
+
+# _files
+case "$words[1]" in
+ -l|--load)
+ _files
+ ;;
+esac
diff --git a/plugins/timer/README.md b/plugins/timer/README.md
new file mode 100644
index 000000000..321307e59
--- /dev/null
+++ b/plugins/timer/README.md
@@ -0,0 +1,17 @@
+This plugin allows to display command's execution time in a very nonintrusive way.
+
+Timer can be tuned by these two variables:
+* `TIMER_PRECISION` allows to control number of decimal places (default `1`)
+* `TIMER_FORMAT` allows to adjust display format (default `'/%d'`)
+
+Sample session:
+
+ me@here:~$ sleep 1 /1.0s
+ me@here:~$ sleep 73 /1m13.0s
+ me@here:~$ TIMER_FORMAT='[%d]'; TIMER_PRECISION=2 [0.00s]
+ me@here:~$ head -c50 < /dev/urandom | hexdump
+ 0000000 b2 16 20 f0 29 1f 61 2d 8a 29 20 8c 8c 39 5a ab
+ 0000010 21 47 0e f9 ee a4 76 46 71 9e 4f 6b a4 c4 51 cb
+ 0000020 f9 1f 7e b9 6f 2c ae dd cf 40 6d 64 a8 fb d3 db
+ 0000030 09 37
+ 0000032 [0.02s]
diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh
new file mode 100644
index 000000000..231134e7d
--- /dev/null
+++ b/plugins/timer/timer.plugin.zsh
@@ -0,0 +1,29 @@
+__timer_current_time() {
+ perl -MTime::HiRes=time -e'print time'
+}
+
+__timer_format_duration() {
+ local mins=$(printf '%.0f' $(($1 / 60)))
+ local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
+ local duration_str=$(echo "${mins}m${secs}s")
+ local format="${TIMER_FORMAT:-/%d}"
+ echo "${format//\%d/${duration_str#0m}}"
+}
+
+__timer_save_time_preexec() {
+ __timer_cmd_start_time=$(__timer_current_time)
+}
+
+__timer_display_timer_precmd() {
+ if [ -n "${__timer_cmd_start_time}" ]; then
+ local cmd_end_time=$(__timer_current_time)
+ local tdiff=$((cmd_end_time - __timer_cmd_start_time))
+ unset __timer_cmd_start_time
+ local tdiffstr=$(__timer_format_duration ${tdiff})
+ local cols=$((COLUMNS - ${#tdiffstr} - 1))
+ echo -e "\033[1A\033[${cols}C ${tdiffstr}"
+ fi
+}
+
+preexec_functions+=(__timer_save_time_preexec)
+precmd_functions+=(__timer_display_timer_precmd)
diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
index 863384223..18cc0614a 100644
--- a/plugins/web-search/web-search.plugin.zsh
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -17,6 +17,7 @@ function web_search() {
ecosia "https://www.ecosia.org/search?q="
goodreads "https://www.goodreads.com/search?q="
qwant "https://www.qwant.com/?q="
+ stackoverflow "https://stackoverflow.com/search?q="
)
# check whether the search engine is supported
@@ -51,6 +52,7 @@ alias baidu='web_search baidu'
alias ecosia='web_search ecosia'
alias goodreads='web_search goodreads'
alias qwant='web_search qwant'
+alias stack='web_search stackoverflow'
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
diff --git a/plugins/z/z.sh b/plugins/z/z.sh
index 4fc75dc6a..5fe6d5266 100644
--- a/plugins/z/z.sh
+++ b/plugins/z/z.sh
@@ -222,10 +222,16 @@ if type compctl >/dev/null 2>&1; then
if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
_z_precmd() {
(_z --add "${PWD:a}" &)
+ # Reference $RANDOM to refresh its value inside the subshell
+ # Otherwise, multiple runs get the same value
+ : $RANDOM
}
else
_z_precmd() {
(_z --add "${PWD:A}" &)
+ # Reference $RANDOM to refresh its value inside the subshell
+ # Otherwise, multiple runs get the same value
+ : $RANDOM
}
fi
[[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {