mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
commit
9970ec0064
79 changed files with 1377 additions and 337 deletions
|
|
@ -1,6 +1,7 @@
|
|||
The MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2009-2015 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
|
||||
Copyright (c) 2009-2016 Robby Russell and contributors
|
||||
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
@ -9,13 +10,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||

|
||||
|
||||
<p align="center">
|
||||
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
|
||||
</p>
|
||||
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again.
|
||||
|
||||
__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able to take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often.
|
||||
|
||||
To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
||||
### Prerequisites
|
||||
|
||||
__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._
|
||||
__Disclaimer:__ _Oh My Zsh works best on OS X and Linux._
|
||||
|
||||
* Unix-based operating system (Mac OS X or Linux)
|
||||
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* Unix-based operating system (OS X or Linux)
|
||||
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* `curl` or `wget` should be installed
|
||||
* `git` should be installed
|
||||
|
||||
|
|
@ -26,13 +26,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
|||
#### via curl
|
||||
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### via wget
|
||||
|
||||
```shell
|
||||
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||
```
|
||||
|
||||
## Using Oh My Zsh
|
||||
|
|
@ -104,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory)
|
|||
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
|
||||
|
||||
```shell
|
||||
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### Manual Installation
|
||||
|
|
@ -210,4 +210,4 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-
|
|||
|
||||
## License
|
||||
|
||||
Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt).
|
||||
Oh My Zsh is released under the [MIT license](MIT-LICENSE.txt).
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ alias -g ....='../../..'
|
|||
alias -g .....='../../../..'
|
||||
alias -g ......='../../../../..'
|
||||
|
||||
alias -- -='cd -'
|
||||
alias 1='cd -'
|
||||
alias 2='cd -2'
|
||||
alias 3='cd -3'
|
||||
|
|
|
|||
91
lib/git.zsh
91
lib/git.zsh
|
|
@ -1,5 +1,6 @@
|
|||
# get the name of the branch we are on
|
||||
# Outputs current branch info in prompt format
|
||||
function git_prompt_info() {
|
||||
local ref
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
|
||||
|
|
@ -7,9 +8,8 @@ function git_prompt_info() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
# Checks if working tree is dirty
|
||||
parse_git_dirty() {
|
||||
function parse_git_dirty() {
|
||||
local STATUS=''
|
||||
local FLAGS
|
||||
FLAGS=('--porcelain')
|
||||
|
|
@ -29,32 +29,28 @@ parse_git_dirty() {
|
|||
fi
|
||||
}
|
||||
|
||||
# get the difference between the local and remote branches
|
||||
git_remote_status() {
|
||||
# Gets the difference between the local and remote branches
|
||||
function git_remote_status() {
|
||||
local remote ahead behind git_remote_status git_remote_status_detailed
|
||||
remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
|
||||
if [[ -n ${remote} ]] ; then
|
||||
if [[ -n ${remote} ]]; then
|
||||
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
|
||||
if [ $ahead -eq 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
|
||||
elif [ $behind -gt 0 ] && [ $ahead -eq 0 ]
|
||||
then
|
||||
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||
fi
|
||||
|
||||
if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]
|
||||
then
|
||||
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
|
||||
fi
|
||||
|
||||
|
|
@ -62,9 +58,26 @@ git_remote_status() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Outputs the name of the current branch
|
||||
# Usage example: git pull origin $(git_current_branch)
|
||||
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
|
||||
# it's not a symbolic ref, but in a Git repo.
|
||||
function git_current_branch() {
|
||||
local ref
|
||||
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
local ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $ret == 128 ]] && return # no git repo.
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
|
||||
fi
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
local COMMITS
|
||||
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
|
|
@ -72,21 +85,21 @@ function git_commits_ahead() {
|
|||
|
||||
# Outputs if current branch is ahead of remote
|
||||
function git_prompt_ahead() {
|
||||
if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is behind remote
|
||||
function git_prompt_behind() {
|
||||
if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then
|
||||
if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch exists on remote or not
|
||||
function git_prompt_remote() {
|
||||
if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then
|
||||
if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING"
|
||||
|
|
@ -95,16 +108,19 @@ function git_prompt_remote() {
|
|||
|
||||
# Formats prompt string for current git commit short SHA
|
||||
function git_prompt_short_sha() {
|
||||
local SHA
|
||||
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit long SHA
|
||||
function git_prompt_long_sha() {
|
||||
local SHA
|
||||
SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
}
|
||||
|
||||
# Get the status of the working tree
|
||||
git_prompt_status() {
|
||||
function git_prompt_status() {
|
||||
local INDEX STATUS
|
||||
INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
|
||||
|
|
@ -150,15 +166,14 @@ git_prompt_status() {
|
|||
echo $STATUS
|
||||
}
|
||||
|
||||
#compare the provided version of git to the version installed and on path
|
||||
#prints 1 if input version <= installed version
|
||||
#prints -1 otherwise
|
||||
# Compares the provided version of git to the version installed and on path
|
||||
# Outputs -1, 0, or 1 if the installed version is less than, equal to, or
|
||||
# greater than the input version, respectively.
|
||||
function git_compare_version() {
|
||||
local INPUT_GIT_VERSION=$1;
|
||||
local INSTALLED_GIT_VERSION
|
||||
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
|
||||
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null));
|
||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||
local INPUT_GIT_VERSION INSTALLED_GIT_VERSION
|
||||
INPUT_GIT_VERSION=(${(s/./)1})
|
||||
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null))
|
||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]})
|
||||
|
||||
for i in {1..3}; do
|
||||
if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
|
||||
|
|
@ -173,7 +188,19 @@ function git_compare_version() {
|
|||
echo 0
|
||||
}
|
||||
|
||||
#this is unlikely to change so make it all statically assigned
|
||||
# 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
|
||||
unset -f git_compare_version
|
||||
# Clean up the namespace slightly by removing the checker function
|
||||
unfunction git_compare_version
|
||||
|
|
|
|||
|
|
@ -27,11 +27,17 @@ if [[ "${terminfo[knp]}" != "" ]]; then
|
|||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||
fi
|
||||
|
||||
# start typing + [Up-Arrow] - fuzzy find history forward
|
||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||
autoload -U up-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
fi
|
||||
# start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
fi
|
||||
|
||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# P.C. Shyamshankar <sykora@lucentbeing.com>
|
||||
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
|
||||
|
||||
typeset -Ag FX FG BG
|
||||
typeset -AHg FX FG BG
|
||||
|
||||
FX=(
|
||||
reset "%{[00m%}"
|
||||
|
|
@ -25,13 +25,13 @@ ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab o
|
|||
# Show all 256 colors with color number
|
||||
function spectrum_ls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f"
|
||||
print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
|
||||
done
|
||||
}
|
||||
|
||||
# Show all 256 colors where the background is set to specific color
|
||||
function spectrum_bls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}"
|
||||
print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,14 @@ function title {
|
|||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$2:q\a" # set window name
|
||||
print -Pn "\e]1;$1:q\a" # set tab name
|
||||
else
|
||||
# Try to use terminfo to set the title
|
||||
# If the feature is available set title
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
|
||||
|
||||
# Look for yaourt, and add some useful functions if we have it.
|
||||
if [[ -x `command -v yaourt` ]]; then
|
||||
if (( $+commands[yaourt] )); then
|
||||
upgrade () {
|
||||
yaourt -Syu
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ if [[ -x `command -v yaourt` ]]; then
|
|||
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||
# Additional yaourt alias examples
|
||||
if [[ -x `command -v abs` && -x `command -v aur` ]]; then
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `command -v abs` ]]; then
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `command -v aur` ]]; then
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
|
||||
|
|
@ -49,11 +49,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori
|
|||
alias pacloc='pacman -Qi' # Display information about a given package in the local database
|
||||
alias paclocs='pacman -Qs' # Search for package(s) in the local database
|
||||
# Additional pacman alias examples
|
||||
if [[ -x `command -v abs` && -x `command -v aur` ]]; then
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `command -v abs` ]]; then
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `command -v aur` ]]; then
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
|
||||
|
|
|
|||
27
plugins/asdf/README.md
Normal file
27
plugins/asdf/README.md
Normal file
|
|
@ -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
plugins/asdf/asdf.plugin.zsh
Normal file
7
plugins/asdf/asdf.plugin.zsh
Normal file
|
|
@ -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
|
||||
33
plugins/branch/README.md
Normal file
33
plugins/branch/README.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Branch
|
||||
|
||||
Displays the current Git or Mercurial branch fast.
|
||||
|
||||
## Speed test
|
||||
|
||||
### Mercurial
|
||||
|
||||
```shell
|
||||
$ time hg branch
|
||||
0.11s user 0.14s system 70% cpu 0.355 total
|
||||
```
|
||||
|
||||
### Branch plugin
|
||||
|
||||
```shell
|
||||
$ time zsh /tmp/branch_prompt_info_test.zsh
|
||||
0.00s user 0.01s system 78% cpu 0.014 total
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`)
|
||||
adding `$(branch_prompt_info)` in your prompt like this:
|
||||
|
||||
```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)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Victor Torres (<vpaivatorres@gmail.com>)
|
||||
26
plugins/branch/branch.plugin.zsh
Normal file
26
plugins/branch/branch.plugin.zsh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Branch: displays the current Git or Mercurial branch fast.
|
||||
# Victor Torres <vpaivatorres@gmail.com>
|
||||
# Oct 2, 2015
|
||||
|
||||
function branch_prompt_info() {
|
||||
# Defines path as current directory
|
||||
local current_dir=$PWD
|
||||
# While current path is not root path
|
||||
while [[ $current_dir != '/' ]]
|
||||
do
|
||||
# Git repository
|
||||
if [[ -d "${current_dir}/.git" ]]
|
||||
then
|
||||
echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/}
|
||||
return;
|
||||
fi
|
||||
# Mercurial repository
|
||||
if [[ -d "${current_dir}/.hg" ]]
|
||||
then
|
||||
echo '☿' $(<"$current_dir/.hg/branch")
|
||||
return;
|
||||
fi
|
||||
# Defines path as parent directory and keeps looking for :)
|
||||
current_dir="${current_dir:h}"
|
||||
done
|
||||
}
|
||||
|
|
@ -1,7 +1,13 @@
|
|||
#compdef brew
|
||||
#autoload
|
||||
|
||||
# imported from the latest homebrew contributions
|
||||
# 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`)
|
||||
|
|
@ -15,6 +21,14 @@ _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`)
|
||||
}
|
||||
|
|
@ -25,8 +39,10 @@ _1st_arguments=(
|
|||
'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 of a 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'
|
||||
|
|
@ -37,40 +53,45 @@ _1st_arguments=(
|
|||
'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 linkage between installed versions of a formula'
|
||||
'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:pull latest 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 outdated_formulae
|
||||
local -a formulae installed_formulae installed_taps official_taps outdated_formulae
|
||||
|
||||
_arguments \
|
||||
'(-v)-v[verbose]' \
|
||||
'(--cellar)--cellar[brew cellar]' \
|
||||
'(--config)--config[brew configuration]' \
|
||||
'(--env)--env[brew environment]' \
|
||||
'(--repository)--repository[brew repository]' \
|
||||
'(--version)--version[version information]' \
|
||||
'(--prefix)--prefix[where brew lives on this system]' \
|
||||
'(--cache)--cache[brew cache]' \
|
||||
'(--force)--force[brew force]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
|
|
@ -79,9 +100,18 @@ if (( CURRENT == 1 )); then
|
|||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options)
|
||||
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]' \
|
||||
|
|
@ -100,9 +130,15 @@ case "$words[1]" in
|
|||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
untap)
|
||||
untap|tap-info|tap-pin)
|
||||
_brew_installed_taps
|
||||
_wanted installed_taps expl 'installed taps' compadd -a 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 ;;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
# rvm and rbenv plugins also provide this alias
|
||||
alias rubies='chruby'
|
||||
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
_homebrew-installed() {
|
||||
whence brew &> /dev/null
|
||||
}
|
||||
|
|
@ -42,6 +39,9 @@ if _ruby-build_installed; then
|
|||
fi
|
||||
|
||||
_source_from_omz_settings() {
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
if [[ "$OSTYPE" = solaris* ]]
|
||||
then
|
||||
if [ ! -x ${HOME}/bin/nroff ]
|
||||
if [[ ! -x "$HOME/bin/nroff" ]]
|
||||
then
|
||||
mkdir -p ${HOME}/bin
|
||||
cat > ${HOME}/bin/nroff <<EOF
|
||||
mkdir -p "$HOME/bin"
|
||||
cat > "$HOME/bin/nroff" <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
|
||||
exec /usr/bin/nroff -u\$_NROFF_U "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x ${HOME}/bin/nroff
|
||||
chmod +x "$HOME/bin/nroff"
|
||||
fi
|
||||
fi
|
||||
|
||||
man() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER=/usr/bin/less \
|
||||
_NROFF_U=1 \
|
||||
PATH=${HOME}/bin:${PATH} \
|
||||
man "$@"
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" \
|
||||
man "$@"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,3 +23,11 @@ if [ -f /usr/libexec/pk-command-not-found ]; then
|
|||
return $retval
|
||||
}
|
||||
fi
|
||||
|
||||
# OSX command-not-found support
|
||||
# https://github.com/Homebrew/homebrew-command-not-found
|
||||
if type brew &> /dev/null; then
|
||||
if brew command command-not-found-init > /dev/null 2>&1; then
|
||||
eval "$(brew command-not-found-init)";
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ alias mv='mv -i'
|
|||
|
||||
# zsh is able to auto-do some kungfoo
|
||||
# depends on the SUFFIX :)
|
||||
if [ ${ZSH_VERSION//\./} -ge 420 ]; then
|
||||
if is-at-least 4.2.0; then
|
||||
# open browser on urls
|
||||
_browser_fts=(htm html de org net com at cx nl se dk dk php)
|
||||
for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
# Composer basic command completion
|
||||
_composer_get_command_list () {
|
||||
$_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
$_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_composer_get_required_list () {
|
||||
$_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
$_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
}
|
||||
|
||||
_composer () {
|
||||
|
|
|
|||
25
plugins/dnf/README.md
Executable file
25
plugins/dnf/README.md
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
## Description
|
||||
|
||||
This plugin makes `dnf` usage easier by adding aliases for the most
|
||||
common commands.
|
||||
|
||||
`dnf` is the new package manager for RPM-based distributions, which
|
||||
replaces `yum`.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------------------|--------------------------|
|
||||
| dnfl | `dnf list` | List packages |
|
||||
| dnfli | `dnf list installed` | List installed packages |
|
||||
| dnfgl | `dnf grouplist` | List package groups |
|
||||
| dnfmc | `dnf makecache` | Generate metadata cache |
|
||||
| dnfp | `dnf info` | Show package information |
|
||||
| dnfs | `dnf search` | Search package |
|
||||
| **Use `sudo`** |
|
||||
| dnfu | `sudo dnf upgrade` | Upgrade package |
|
||||
| dnfi | `sudo dnf install` | Install package |
|
||||
| dnfgi | `sudo dnf groupinstall` | Install package group |
|
||||
| dnfr | `sudo dnf remove` | Remove package |
|
||||
| dnfgr | `sudo dnf groupremove` | Remove package group |
|
||||
| dnfc | `sudo dnf clean all` | Clean cache |
|
||||
15
plugins/dnf/dnf.plugin.zsh
Normal file
15
plugins/dnf/dnf.plugin.zsh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
## Aliases
|
||||
|
||||
alias dnfl="dnf list" # List packages
|
||||
alias dnfli="dnf list installed" # List installed packages
|
||||
alias dnfgl="dnf grouplist" # List package groups
|
||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
||||
alias dnfp="dnf info" # Show package information
|
||||
alias dnfs="dnf search" # Search package
|
||||
|
||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
||||
alias dnfi="sudo dnf install" # Install package
|
||||
alias dnfgi="sudo dnf groupinstall" # Install package group
|
||||
alias dnfr="sudo dnf remove" # Remove package
|
||||
alias dnfgr="sudo dnf groupremove" # Remove package group
|
||||
alias dnfc="sudo dnf clean all" # Clean cache
|
||||
|
|
@ -6,14 +6,16 @@ Ember CLI (http://www.ember-cli.com/)
|
|||
|
||||
### List of Aliases
|
||||
|
||||
alias es='ember serve'
|
||||
alias ea='ember addon'
|
||||
alias eb='ember build'
|
||||
alias ed='ember destroy'
|
||||
alias eg='ember generate'
|
||||
alias eh='ember help'
|
||||
alias ein='ember init'
|
||||
alias ei='ember install'
|
||||
alias et='ember test'
|
||||
alias eu='ember update'
|
||||
alias ev='ember version'
|
||||
Alias | Ember-CLI command
|
||||
----- | -----------------
|
||||
**es** | *ember serve*
|
||||
**ea** | *ember addon*
|
||||
**eb** | *ember build*
|
||||
**ed** | *ember destroy*
|
||||
**eg** | *ember generate*
|
||||
**eh** | *ember help*
|
||||
**ein** | *ember init*
|
||||
**ei** | *ember install*
|
||||
**et** | *ember test*
|
||||
**eu** | *ember update*
|
||||
**ev** | *ember version*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,17 @@
|
|||
encode64(){ printf '%s' $1 | base64 }
|
||||
decode64(){ printf '%s' $1 | base64 --decode }
|
||||
encode64() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat | base64
|
||||
else
|
||||
printf '%s' $1 | base64
|
||||
fi
|
||||
}
|
||||
|
||||
decode64() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat | base64 --decode
|
||||
else
|
||||
printf '%s' $1 | base64 --decode
|
||||
fi
|
||||
}
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ function extract() {
|
|||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ Plugin for ForkLift, an FTP application for OS X.
|
|||
|
||||
### Requirements
|
||||
|
||||
* [ForkLift](http://forkliftapp.com/forklift/)
|
||||
* [ForkLift](http://www.binarynights.com/forklift/)
|
||||
|
||||
### Usage
|
||||
|
||||
* If `fl` is called without arguments then the current folder is opened in ForkLift. Is equivalent to `fl .`
|
||||
<code>fl [*file_or_folder*]</code>
|
||||
|
||||
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift
|
||||
* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
|
||||
|
||||
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Available search contexts are:
|
|||
| bootsnipp | `http://bootsnipp.com/search?q=` |
|
||||
| caniuse | `http://caniuse.com/#search=` |
|
||||
| codepen | `http://codepen.io/search?q=` |
|
||||
| compass | `http://compass-style.org/search?q=` |
|
||||
| compassdoc | `http://compass-style.org/search?q=` |
|
||||
| cssflow | `http://www.cssflow.com/search?q=` |
|
||||
| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
|
||||
| emberjs | `http://emberjs.com/api/#stp=1&stq=` |
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function _frontend() {
|
|||
commands=(
|
||||
'jquery: Search in jQuery website'
|
||||
'mdn: Search in MDN website'
|
||||
'compass: Search in COMPASS website'
|
||||
'compassdoc: Search in COMPASS website'
|
||||
'html5please: Search in HTML5 Please website'
|
||||
'caniuse: Search in Can I Use website'
|
||||
'aurajs: Search in AuraJs website'
|
||||
|
|
@ -57,7 +57,7 @@ function _frontend() {
|
|||
mdn)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
compass)
|
||||
compassdoc)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
html5please)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ alias bem='frontend bem'
|
|||
alias bootsnipp='frontend bootsnipp'
|
||||
alias caniuse='frontend caniuse'
|
||||
alias codepen='frontend codepen'
|
||||
alias compass='frontend compass'
|
||||
alias compassdoc='frontend compassdoc'
|
||||
alias cssflow='frontend cssflow'
|
||||
alias dartlang='frontend dartlang'
|
||||
alias emberjs='frontend emberjs'
|
||||
|
|
@ -32,7 +32,7 @@ function frontend() {
|
|||
bootsnipp 'http://bootsnipp.com/search?q='
|
||||
caniuse 'http://caniuse.com/#search='
|
||||
codepen 'http://codepen.io/search?q='
|
||||
compass 'http://compass-style.org/search?q='
|
||||
compassdoc 'http://compass-style.org/search?q='
|
||||
cssflow 'http://www.cssflow.com/search?q='
|
||||
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
|
||||
emberjs 'http://emberjs.com/api/#stp=1&stq='
|
||||
|
|
@ -57,7 +57,7 @@ function frontend() {
|
|||
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
|
||||
print -P "and %Ucontext%u is one of the following:"
|
||||
print -P ""
|
||||
print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow,"
|
||||
print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
|
||||
print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
|
||||
print -P " qunit, reactjs, smacss, stackoverflow, unheap"
|
||||
print -P ""
|
||||
|
|
@ -73,7 +73,7 @@ function frontend() {
|
|||
echo ""
|
||||
echo "Valid contexts are:"
|
||||
echo ""
|
||||
echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, "
|
||||
echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, "
|
||||
echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, "
|
||||
echo " qunit, reactjs, smacss, stackoverflow, unheap"
|
||||
echo ""
|
||||
|
|
|
|||
12
plugins/geeknote/README.md
Normal file
12
plugins/geeknote/README.md
Normal file
|
|
@ -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
plugins/geeknote/_geeknote
Normal file
136
plugins/geeknote/_geeknote
Normal file
|
|
@ -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
plugins/geeknote/geeknote.plugin.zsh
Normal file
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#Alias
|
||||
alias gn='geeknote'
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# Completion script for git-extras (http://github.com/tj/git-extras).
|
||||
#
|
||||
# This depends on and reueses some of the internals of the _git completion
|
||||
# This depends on and reuses some of the internals of the _git completion
|
||||
# function that ships with zsh itself. It will not work with the _git that ships
|
||||
# with git.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# To achieve git-flow completion nirvana:
|
||||
#
|
||||
# 0. Update your zsh's git-completion module to the newest version.
|
||||
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
|
||||
# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git
|
||||
#
|
||||
# 1. Install this file. Either:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -6,19 +6,12 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
|
|||
# Functions
|
||||
#
|
||||
|
||||
# The current branch name
|
||||
# Usage example: git pull origin $(current_branch)
|
||||
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
|
||||
# it's not a symbolic ref, but in a Git repo.
|
||||
# The name of the current branch
|
||||
# Back-compatibility wrapper for when this function was defined here in
|
||||
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
|
||||
# to fix the core -> git plugin dependency.
|
||||
function current_branch() {
|
||||
local ref
|
||||
ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
local ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $ret == 128 ]] && return # no git repo.
|
||||
ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return
|
||||
fi
|
||||
echo ${ref#refs/heads/}
|
||||
git_current_branch
|
||||
}
|
||||
# The list of remotes
|
||||
function current_repository() {
|
||||
|
|
@ -99,7 +92,7 @@ alias gfo='git fetch origin'
|
|||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
ggf() {
|
||||
[[ "$#" != 1 ]] && local b="$(current_branch)"
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggf=git-checkout
|
||||
|
|
@ -107,23 +100,23 @@ ggl() {
|
|||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(current_branch)"
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-checkout
|
||||
alias ggpull='git pull origin $(current_branch)'
|
||||
alias ggpull='git pull origin $(git_current_branch)'
|
||||
compdef _git ggpull=git-checkout
|
||||
ggp() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(current_branch)"
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git push origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggp=git-checkout
|
||||
alias ggpush='git push origin $(current_branch)'
|
||||
alias ggpush='git push origin $(git_current_branch)'
|
||||
compdef _git ggpush=git-checkout
|
||||
ggpnp() {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
|
|
@ -133,9 +126,9 @@ ggl "${*}" && ggp "${*}"
|
|||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(current_branch)'
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
ggu() {
|
||||
[[ "$#" != 1 ]] && local b="$(current_branch)"
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggu=git-checkout
|
||||
|
|
@ -153,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
|
||||
|
||||
|
|
@ -220,7 +213,5 @@ alias gup='git pull --rebase'
|
|||
alias gupv='git pull --rebase -v'
|
||||
alias glum='git pull upstream master'
|
||||
|
||||
alias gvt='git verify-tag'
|
||||
|
||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# github
|
||||
|
||||
This plugin supports working with GitHub the command line. It provides a few things:
|
||||
This plugin supports working with GitHub from the command line. It provides a few things:
|
||||
|
||||
* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed.
|
||||
* Completion for the `github` Ruby gem.
|
||||
|
|
@ -37,7 +37,7 @@ See `man hub` for more details.
|
|||
|
||||
### Homebrew installation note
|
||||
|
||||
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
|
||||
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
|
||||
|
||||
```zsh
|
||||
if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then
|
||||
|
|
|
|||
163
plugins/github/_hub
Normal file
163
plugins/github/_hub
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
#compdef hub
|
||||
|
||||
# Zsh will source this file when attempting to autoload the "_hub" function,
|
||||
# typically on the first attempt to complete the hub command. We define two new
|
||||
# setup helper routines (one for the zsh-distributed version, one for the
|
||||
# git-distributed, bash-based version). Then we redefine the "_hub" function to
|
||||
# call "_git" after some other interception.
|
||||
#
|
||||
# This is pretty fragile, if you think about it. Any number of implementation
|
||||
# changes in the "_git" scripts could cause problems down the road. It would be
|
||||
# better if the stock git completions were just a bit more permissive about how
|
||||
# it allowed third-party commands to be added.
|
||||
|
||||
(( $+functions[__hub_setup_zsh_fns] )) ||
|
||||
__hub_setup_zsh_fns () {
|
||||
(( $+functions[_git-alias] )) ||
|
||||
_git-alias () {
|
||||
_arguments \
|
||||
'-s[output shell script suitable for eval]' \
|
||||
'1::shell:(zsh bash csh)'
|
||||
}
|
||||
|
||||
(( $+functions[_git-browse] )) ||
|
||||
_git-browse () {
|
||||
_arguments \
|
||||
'-u[output the URL]' \
|
||||
'2::subpage:(wiki commits issues)'
|
||||
}
|
||||
|
||||
(( $+functions[_git-compare] )) ||
|
||||
_git-compare () {
|
||||
_arguments \
|
||||
'-u[output the URL]' \
|
||||
':[start...]end range:'
|
||||
}
|
||||
|
||||
(( $+functions[_git-create] )) ||
|
||||
_git-create () {
|
||||
_arguments \
|
||||
'::name (REPOSITORY or ORGANIZATION/REPOSITORY):' \
|
||||
'-p[make repository private]' \
|
||||
'-d[description]:description' \
|
||||
'-h[home page]:repository home page URL:_urls'
|
||||
}
|
||||
|
||||
(( $+functions[_git-fork] )) ||
|
||||
_git-fork () {
|
||||
_arguments \
|
||||
'--no-remote[do not add a remote for the new fork]'
|
||||
}
|
||||
|
||||
(( $+functions[_git-pull-request] )) ||
|
||||
_git-pull-request () {
|
||||
_arguments \
|
||||
'-f[force (skip check for local commits)]' \
|
||||
'-b[base]:base ("branch", "owner\:branch", "owner/repo\:branch"):' \
|
||||
'-h[head]:head ("branch", "owner\:branch", "owner/repo\:branch"):' \
|
||||
- set1 \
|
||||
'-m[message]' \
|
||||
'-F[file]' \
|
||||
'-a[user]' \
|
||||
'-M[milestone]' \
|
||||
'-l[labels]' \
|
||||
- set2 \
|
||||
'-i[issue]:issue number:' \
|
||||
- set3 \
|
||||
'::issue-url:_urls'
|
||||
}
|
||||
|
||||
# stash the "real" command for later
|
||||
functions[_hub_orig_git_commands]=$functions[_git_commands]
|
||||
|
||||
# Replace it with our own wrapper.
|
||||
declare -f _git_commands >& /dev/null && unfunction _git_commands
|
||||
_git_commands () {
|
||||
local ret=1
|
||||
# call the original routine
|
||||
_call_function ret _hub_orig_git_commands
|
||||
|
||||
# Effectively "append" our hub commands to the behavior of the original
|
||||
# _git_commands function. Using this wrapper function approach ensures
|
||||
# that we only offer the user the hub subcommands when the user is
|
||||
# actually trying to complete subcommands.
|
||||
hub_commands=(
|
||||
alias:'show shell instructions for wrapping git'
|
||||
pull-request:'open a pull request on GitHub'
|
||||
fork:'fork origin repo on GitHub'
|
||||
create:'create new repo on GitHub for the current project'
|
||||
browse:'browse the project on GitHub'
|
||||
compare:'open GitHub compare view'
|
||||
ci-status:'lookup commit in GitHub Status API'
|
||||
)
|
||||
_describe -t hub-commands 'hub command' hub_commands && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
(( $+functions[__hub_setup_bash_fns] )) ||
|
||||
__hub_setup_bash_fns () {
|
||||
# TODO more bash-style fns needed here to complete subcommand args. They take
|
||||
# the form "_git_CMD" where "CMD" is something like "pull-request".
|
||||
|
||||
# Duplicate and rename the 'list_all_commands' function
|
||||
eval "$(declare -f __git_list_all_commands | \
|
||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
||||
|
||||
# Wrap the 'list_all_commands' function with extra hub commands
|
||||
__git_list_all_commands() {
|
||||
cat <<-EOF
|
||||
alias
|
||||
pull-request
|
||||
fork
|
||||
create
|
||||
browse
|
||||
compare
|
||||
ci-status
|
||||
EOF
|
||||
__git_list_all_commands_without_hub
|
||||
}
|
||||
|
||||
# Ensure cached commands are cleared
|
||||
__git_all_commands=""
|
||||
}
|
||||
|
||||
# redefine _hub to a much smaller function in the steady state
|
||||
_hub () {
|
||||
# only attempt to intercept the normal "_git" helper functions once
|
||||
(( $+__hub_func_replacement_done )) ||
|
||||
() {
|
||||
# At this stage in the shell's execution the "_git" function has not yet
|
||||
# been autoloaded, so the "_git_commands" or "__git_list_all_commands"
|
||||
# functions will not be defined. Call it now (with a bogus no-op service
|
||||
# to prevent premature completion) so that we can wrap them.
|
||||
if declare -f _git >& /dev/null ; then
|
||||
_hub_noop () { __hub_zsh_provided=1 } # zsh-provided will call this one
|
||||
__hub_noop_main () { __hub_git_provided=1 } # git-provided will call this one
|
||||
local service=hub_noop
|
||||
_git
|
||||
unfunction _hub_noop
|
||||
unfunction __hub_noop_main
|
||||
service=git
|
||||
fi
|
||||
|
||||
if (( $__hub_zsh_provided )) ; then
|
||||
__hub_setup_zsh_fns
|
||||
elif (( $__hub_git_provided )) ; then
|
||||
__hub_setup_bash_fns
|
||||
fi
|
||||
|
||||
__hub_func_replacement_done=1
|
||||
}
|
||||
|
||||
# Now perform the actual completion, allowing the "_git" function to call our
|
||||
# replacement "_git_commands" function as needed. Both versions expect
|
||||
# service=git or they will call nonexistent routines or end up in an infinite
|
||||
# loop.
|
||||
service=git
|
||||
declare -f _git >& /dev/null && _git
|
||||
}
|
||||
|
||||
# make sure we actually attempt to complete on the first "tab" from the user
|
||||
_hub
|
||||
|
|
@ -71,7 +71,7 @@ exist_gh() { # [DIRECTORY]
|
|||
#
|
||||
git.io() {
|
||||
emulate -L zsh
|
||||
curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
|
||||
curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
|
||||
}
|
||||
|
||||
# End Functions #############################################################
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
function gi() { curl -sL https://www.gitignore.io/api/$@ ;}
|
||||
function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} }
|
||||
|
||||
_gitignoreio_get_command_list() {
|
||||
curl -sL https://www.gitignore.io/api/list | tr "," "\n"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#
|
||||
# gulp-autocompletion-zsh
|
||||
#
|
||||
#
|
||||
# Autocompletion for your gulp.js tasks
|
||||
#
|
||||
# Copyright(c) 2014 André König <andre.koenig@posteo.de>
|
||||
# MIT Licensed
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# André König
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
# in the current directory.
|
||||
#
|
||||
function $$gulp_completion {
|
||||
compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)"
|
||||
compls=$(gulp --tasks-simple 2>/dev/null)
|
||||
|
||||
completions=(${=compls})
|
||||
compadd -- $completions
|
||||
|
|
|
|||
|
|
@ -13,11 +13,14 @@ fi
|
|||
|
||||
|
||||
# Bind terminal-specific up and down keys
|
||||
|
||||
# Bind in both emacs and vi modes so it works in both, and is not
|
||||
# sensitive to whether this is loaded before or after the vi-mode plugin
|
||||
if [[ -n "$terminfo[kcuu1]" ]]; then
|
||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up
|
||||
fi
|
||||
if [[ -n "$terminfo[kcud1]" ]]; then
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M viins "$terminfo[kcud1]" history-substring-search-down
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh <<EOF
|
|||
# Bind terminal-specific up and down keys
|
||||
|
||||
if [[ -n "\$terminfo[kcuu1]" ]]; then
|
||||
bindkey "\$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up
|
||||
fi
|
||||
if [[ -n "\$terminfo[kcud1]" ]]; then
|
||||
bindkey "\$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down
|
||||
fi
|
||||
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ alias hgo='hg outgoing'
|
|||
alias hgp='hg push'
|
||||
alias hgs='hg status'
|
||||
alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" '
|
||||
# this is the 'git commit --amend' equivalent
|
||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
||||
alias hgca='hg commit --amend'
|
||||
# list unresolved files (since hg does not list unmerged files in the status command)
|
||||
alias hgun='hg resolve --list'
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,10 @@ case $state in
|
|||
case $line[1] in
|
||||
(help)
|
||||
_arguments ':feature:__task_list'
|
||||
;;
|
||||
(test)
|
||||
_files
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
# mvn-color based on https://gist.github.com/1027800
|
||||
export BOLD=`tput bold`
|
||||
export UNDERLINE_ON=`tput smul`
|
||||
export UNDERLINE_OFF=`tput rmul`
|
||||
export TEXT_BLACK=`tput setaf 0`
|
||||
export TEXT_RED=`tput setaf 1`
|
||||
export TEXT_GREEN=`tput setaf 2`
|
||||
export TEXT_YELLOW=`tput setaf 3`
|
||||
export TEXT_BLUE=`tput setaf 4`
|
||||
export TEXT_MAGENTA=`tput setaf 5`
|
||||
export TEXT_CYAN=`tput setaf 6`
|
||||
export TEXT_WHITE=`tput setaf 7`
|
||||
export BACKGROUND_BLACK=`tput setab 0`
|
||||
export BACKGROUND_RED=`tput setab 1`
|
||||
export BACKGROUND_GREEN=`tput setab 2`
|
||||
export BACKGROUND_YELLOW=`tput setab 3`
|
||||
export BACKGROUND_BLUE=`tput setab 4`
|
||||
export BACKGROUND_MAGENTA=`tput setab 5`
|
||||
export BACKGROUND_CYAN=`tput setab 6`
|
||||
export BACKGROUND_WHITE=`tput setab 7`
|
||||
export RESET_FORMATTING=`tput sgr0`
|
||||
BOLD=`tput bold`
|
||||
UNDERLINE_ON=`tput smul`
|
||||
UNDERLINE_OFF=`tput rmul`
|
||||
TEXT_BLACK=`tput setaf 0`
|
||||
TEXT_RED=`tput setaf 1`
|
||||
TEXT_GREEN=`tput setaf 2`
|
||||
TEXT_YELLOW=`tput setaf 3`
|
||||
TEXT_BLUE=`tput setaf 4`
|
||||
TEXT_MAGENTA=`tput setaf 5`
|
||||
TEXT_CYAN=`tput setaf 6`
|
||||
TEXT_WHITE=`tput setaf 7`
|
||||
BACKGROUND_BLACK=`tput setab 0`
|
||||
BACKGROUND_RED=`tput setab 1`
|
||||
BACKGROUND_GREEN=`tput setab 2`
|
||||
BACKGROUND_YELLOW=`tput setab 3`
|
||||
BACKGROUND_BLUE=`tput setab 4`
|
||||
BACKGROUND_MAGENTA=`tput setab 5`
|
||||
BACKGROUND_CYAN=`tput setab 6`
|
||||
BACKGROUND_WHITE=`tput setab 7`
|
||||
RESET_FORMATTING=`tput sgr0`
|
||||
|
||||
|
||||
# Wrapper function for Maven's mvn command.
|
||||
|
|
|
|||
|
|
@ -17,3 +17,6 @@ alias npmD="npm i -D "
|
|||
# Execute command from node_modules folder based on current directory
|
||||
# i.e npmE gulp
|
||||
alias npmE='PATH="$(npm bin)":"$PATH"'
|
||||
|
||||
# Check which npm modules are outdated
|
||||
alias npmO="npm outdated"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,16 @@ EOF
|
|||
end tell
|
||||
EOF
|
||||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm"
|
||||
tell current window
|
||||
create tab with default profile
|
||||
tell current session to write text "${command}"
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "tab: unsupported terminal app: $the_app"
|
||||
false
|
||||
|
|
@ -73,6 +83,19 @@ function vsplit_tab() {
|
|||
end tell
|
||||
EOF
|
||||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm"
|
||||
tell current session of first window
|
||||
set newSession to (split vertically with same profile)
|
||||
tell newSession
|
||||
write text "${command}"
|
||||
select
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
false
|
||||
|
|
@ -100,6 +123,19 @@ function split_tab() {
|
|||
end tell
|
||||
EOF
|
||||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm"
|
||||
tell current session of first window
|
||||
set newSession to (split horizontally with same profile)
|
||||
tell newSession
|
||||
write text "${command}"
|
||||
select
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
false
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# Aliases
|
||||
alias pylint-quick='pylint --reports=n --include-ids=y'
|
||||
compdef _pylint-quick pylint-quick='pylint --reports=n --include-ids=y'
|
||||
alias pylint-quick='pylint --reports=n'
|
||||
compdef _pylint-quick pylint-quick='pylint --reports=n'
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ alias rr='rake routes'
|
|||
alias rrg='rake routes | grep'
|
||||
alias rt='rake test'
|
||||
alias rmd='rake middleware'
|
||||
alias rsts='rake stats'
|
||||
|
||||
# legacy stuff
|
||||
alias sstat='thin --stats "/thin/stats" start'
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
18
plugins/vault/README.md
Normal file
18
plugins/vault/README.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
## Vault (https://www.vaultproject.io) autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all vault commands.
|
||||
|
||||
####Show help for all commands
|
||||

|
||||
|
||||
|
||||
####Create new Vault token
|
||||

|
||||
|
||||
|
||||
####Enable audit backends
|
||||

|
||||
|
||||
|
||||
|
||||
Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))
|
||||
400
plugins/vault/_vault
Normal file
400
plugins/vault/_vault
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
#compdef vault
|
||||
|
||||
typeset -a main_args
|
||||
main_args=(
|
||||
'(-version)-version[Prints the Vault version]'
|
||||
'(-help)-help[Prints Vault Help]'
|
||||
)
|
||||
|
||||
typeset -a general_args
|
||||
general_args=(
|
||||
'(-help)-help[Prints Help]'
|
||||
'(-address)-address=-[The address of the Vault server. Overrides the VAULT_ADDR environment variable if set.]:address:'
|
||||
'(-ca-cert)-ca-cert=-[Path to a PEM encoded CA cert file to use to verify the Vault server SSL certificate. Overrides the VAULT_CACERT environment variable if set.]:file:_files -g "*.pem"'
|
||||
'(-ca-path)-ca-path=-[Path to a directory of PEM encoded CA cert files to verify the Vault server SSL certificate. If both -ca-cert and -ca-path are specified, -ca-path is used.Overrides the VAULT_CAPATH environment variable if set.]:directory:_directories'
|
||||
'(-client-cert)-client-cert=-[Path to a PEM encoded client certificate for TLS authentication to the Vault server. Must also specify -client-key. Overrides the VAULT_CLIENT_CERT environment variable if set.]:file:_files -g "*.pem"'
|
||||
'(-client-key)-client-key=-[Path to an unencrypted PEM encoded private key matching the client certificate from -client-cert. Overrides the VAULT_CLIENT_KEY environment variable if set.]:file:_files -g "*.pem"'
|
||||
'(-tls-skip-verify)-tls-skip-verify[Do not verify TLS certificate. This is highly not recommended. Verification will also be skipped if VAULT_SKIP_VERIFY is set.]'
|
||||
)
|
||||
|
||||
typeset -a audit_enable_args
|
||||
audit_enable_args=(
|
||||
'(-description)-description=-[A human-friendly description for the backend. This shows up only when querying the enabled backends.]:description:'
|
||||
'(-id)-id=-[Specify a unique ID for this audit backend. This is purely for referencing this audit backend. By default this will be the backend type.]:id:'
|
||||
)
|
||||
|
||||
typeset -a auth_args
|
||||
auth_args=(
|
||||
'(-method)-method=-[Outputs help for the authentication method with the given name for the remote server. If this authentication method is not available, exit with code 1.]:method:(cert ldap github userpass app-id)'
|
||||
'(-method-help)-method-help[If set, the help for the selected method will be shown.]'
|
||||
'(-methods)-methods[List the available auth methods.]'
|
||||
'(-no-verify)-no-verify[Do not verify the token after creation; avoids a use count]'
|
||||
)
|
||||
|
||||
typeset -a auth_enable_args
|
||||
auth_enable_args=(
|
||||
'(-description)-description=-[Human-friendly description of the purpose for the auth provider. This shows up in the auth-list command.]:description:'
|
||||
'(-path)-path=-[Mount point for the auth provider. This defaults to the type of the mount. This will make the auth provider available at "/auth/<path>"]:path:'
|
||||
)
|
||||
|
||||
typeset -a init_args
|
||||
init_args=(
|
||||
'(-key-shares)-key-shares=-[(default: 5) The number of key shares to split the master key into.]:keyshares:'
|
||||
'(-key-threshold)-key-threshold=-[(default: 3) The number of key shares required to reconstruct the master key.]:keythreshold:'
|
||||
'(-pgp-keys)-pgp-keys[If provided, must be a comma-separated list of files on disk containing binary- or base64-format public PGP keys. The number of files must match "key-shares". The output unseal keys will encrypted and hex-encoded, in order, with the given public keys. If you want to use them with the "vault unseal" command, you will need to hex decode and decrypt; this will be the plaintext unseal key.]:pgpkeys:_files'
|
||||
)
|
||||
|
||||
typeset -a mount_tune_args
|
||||
mount_tune_args=(
|
||||
'(-default-lease-ttl)-default-lease-ttl=-[Default lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:defaultleasettl:'
|
||||
'(-max-lease-ttl)-max-lease-ttl=-[Max lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:maxleasettl:'
|
||||
)
|
||||
|
||||
typeset -a mount_args
|
||||
mount_args=(
|
||||
$mount_tune_args
|
||||
'(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:'
|
||||
'(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:'
|
||||
)
|
||||
|
||||
typeset -a rekey_args
|
||||
rekey_args=(
|
||||
$init_args
|
||||
'(-init)-init[Initialize the rekey operation by setting the desired number of shares and the key threshold. This can only be done if no rekey is already initiated.]:init:'
|
||||
'(-cancel)-cancel[Reset the rekey process by throwing away prior keys and the rekey configuration.]:cancel:'
|
||||
'(-status)-status[Prints the status of the current rekey operation. This can be used to see the status without attempting to provide an unseal key.]:status:'
|
||||
)
|
||||
|
||||
typeset -a ssh_args
|
||||
ssh_args=(
|
||||
'(-role)-role[Role to be used to create the key. ]:role:'
|
||||
'(-no-exec)-no-exec[Shows the credentials but does not establish connection.]:noexec:'
|
||||
'(-mount-point)-mount-point[Mount point of SSH backend. If the backend is mounted at "ssh", which is the default as well, this parameter can be skipped.]:mountpoint:'
|
||||
'(-format)-format[If no-exec option is enabled, then the credentials will be printed out and SSH connection will not be established. The format of the output can be "json" or "table". JSON output is useful when writing scripts. Default is "table".]:format:(json table)'
|
||||
)
|
||||
|
||||
typeset -a token_create_args
|
||||
token_create_args=(
|
||||
'(-id)-id=-[The token value that clients will use to authenticate with vault. If not provided this defaults to a 36 character UUID. A root token is required to specify the ID of a token.]:id:'
|
||||
'(-display-name)-display-name=-[A display name to associate with this token. This is a non-security sensitive value used to help identify created secrets, i.e. prefixes.]:displayname:'
|
||||
'(-ttl)-ttl=-[TTL to associate with the token. This option enables the tokens to be renewable.]:ttl:'
|
||||
'*-metadata=-[Metadata to associate with the token. This shows up in the audit log. This can be specified multiple times.]:metadata:'
|
||||
'(-orphan)-orphan[If specified, the token will have no parent. Only root tokens can create orphan tokens. This prevents the new token from being revoked with your token.]:orphan:'
|
||||
'(-no-default-policy)-no-default-policy[If specified, the token will not have the "default" policy included in its policy set.]:nodefaultpolicy:'
|
||||
'*-policy=-[Policy to associate with this token. This can be specified multiple times.]:policy:__vault_policies'
|
||||
'(-use-limit)-use-limit=-[The number of times this token can be used until it is automatically revoked.]:uselimit:'
|
||||
'(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)'
|
||||
)
|
||||
|
||||
typeset -a server_args
|
||||
server_args=(
|
||||
'*-config=-[Path to the configuration file or directory. This can be specified multiple times. If it is a directory, all files with a ".hcl" or ".json" suffix will be loaded.]:config:_files'
|
||||
'-dev[Enables Dev mode. In this mode, Vault is completely in-memory and unsealed. Do not run the Dev server in production!]:dev:'
|
||||
'-log-level=-[Log verbosity. Defaults to "info", will be outputtedto stderr. Supported values: "trace", "debug", "info", "warn", "err"]:loglevel:(trace debug info warn err)'
|
||||
)
|
||||
|
||||
_vault_audit-list() {
|
||||
_arguments : \
|
||||
${general_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_audit-disable() {
|
||||
# vault audit-list doesn't print the backend id so for now
|
||||
# no *smart* autocompletion for this subcommand.
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
':::(file syslog)' && ret=0
|
||||
}
|
||||
|
||||
_vault_audit-enable() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${audit_enable_args[@]} \
|
||||
': :->backends' \
|
||||
'*:: :->backendconfig' && ret=0
|
||||
|
||||
case $state in
|
||||
backends)
|
||||
local -a backends
|
||||
backends=(
|
||||
'file:The "file" audit backend writes audit logs to a file.'
|
||||
'syslog:The "syslog" audit backend writes audit logs to syslog.'
|
||||
)
|
||||
_describe -t backends 'vault audit backends' backends && ret=0
|
||||
;;
|
||||
backendconfig)
|
||||
case ${line[1]} in
|
||||
file)
|
||||
_values -w "Audit Backend File" \
|
||||
'path[(required) - The path to where the file will be written. If this path exists, the audit backend will append to it.]:file:_files' \
|
||||
'log_raw[(optional) Should security sensitive information be logged raw. Defaults to "false".]:log_raw:(true false)' && ret=0
|
||||
;;
|
||||
syslog)
|
||||
_values -w "Audit Backend Syslog" \
|
||||
'facility[(optional) - The syslog facility to use. Defaults to "AUTH".]:facility:(kern user mail daemon auth syslog lpr news uucp authpriv ftp cron local0 local1 local2 local3 local4 local5 local6 local7)' \
|
||||
'tag[(optional) - The syslog tag to use. Defaults to "vault".]:tag:' \
|
||||
'log_raw[(optional) Should security sensitive information be logged raw.]:log_raw:(true false)' && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_vault_auth() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${auth_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_auth-enable() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${auth_enable_args[@]} \
|
||||
':::(cert ldap github userpass app-id)' && ret=0
|
||||
}
|
||||
|
||||
__vault_auth_methods() {
|
||||
local -a authmethods
|
||||
authmethods=($(vault auth -methods | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}'))
|
||||
_describe -t authmethods 'authmethods' authmethods && ret=0
|
||||
}
|
||||
|
||||
_vault_auth-disable() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
':::__vault_auth_methods' && ret=0
|
||||
|
||||
}
|
||||
|
||||
_vault_init() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${init_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_key-status() {
|
||||
_arguments : \
|
||||
${general_args[@]} && ret=0
|
||||
}
|
||||
|
||||
__vault_mounts() {
|
||||
local -a mounts
|
||||
mounts=($(vault mounts | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}'))
|
||||
_describe -t mounts 'mounts' mounts && ret=0
|
||||
}
|
||||
|
||||
_vault_mounts() {
|
||||
_arguments : \
|
||||
${general_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_mount() {
|
||||
# to find out how many types of backens are there
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${mount_args[@]} \
|
||||
':::(generic ssh)' && ret=0
|
||||
}
|
||||
|
||||
_vault_mount-tune() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${mount_tune_args[@]} \
|
||||
':::__vault_mounts' && ret=0
|
||||
}
|
||||
|
||||
_vault_unmount() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
':::__vault_mounts' && ret=0
|
||||
}
|
||||
|
||||
_vault_remount() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
':::__vault_mounts' \
|
||||
':::' && ret=0
|
||||
}
|
||||
|
||||
__vault_policies() {
|
||||
local -a policies
|
||||
policies=($(vault policies | awk '{print $1":["$1"]"}'))
|
||||
_describe -t policies 'policies' policies && ret=0
|
||||
}
|
||||
|
||||
_vault_policies() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
':::__vault_policies' && ret=0
|
||||
}
|
||||
|
||||
_vault_policy-delete() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
':::__vault_policies' && ret=0
|
||||
}
|
||||
|
||||
_vault_policy-write() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
': ::' \
|
||||
'::policy:_files' && ret=0
|
||||
}
|
||||
|
||||
_vault_status() {
|
||||
_arguments : \
|
||||
${general_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_rekey() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${rekey_args[@]} \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_rotate() {
|
||||
_arguments : \
|
||||
${general_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_seal() {
|
||||
_arguments : \
|
||||
${general_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_ssh() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${ssh_args[@]} \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_token-create() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
${token_create_args[@]} && ret=0
|
||||
}
|
||||
|
||||
_vault_token-renew() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
'(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
|
||||
': ::' \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_token-revoke() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
'(-mode)-mode=-[The type of revocation to do. See the documentation above for more information.]:mode:( orphan path)' \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_unseal() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
'(-reset)-reset[Reset the unsealing process by throwing away prior keys in process to unseal the vault.]:reset:' \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_version() {
|
||||
# no args
|
||||
}
|
||||
|
||||
_vault_delete() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_path-help() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_revoke() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
'(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
|
||||
': ::' \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_server() {
|
||||
_arguments : \
|
||||
${server_args[@]} && ret=0
|
||||
|
||||
}
|
||||
|
||||
_vault_write() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
'(-f -force)'{-f,-force}'[Force the write to continue without any data values specified. This allows writing to keys that do not need or expect any fields to be specified.]:force:' \
|
||||
': ::' \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_read() {
|
||||
_arguments : \
|
||||
${general_args[@]} \
|
||||
'(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
|
||||
'(-field)-field=-[If included, the raw value of the specified field will be output raw to stdout.]:field:' \
|
||||
': ::' && ret=0
|
||||
}
|
||||
|
||||
_vault_commands() {
|
||||
local -a commands
|
||||
|
||||
commands=(
|
||||
"delete":"Delete operation on secrets in Vault"
|
||||
"path-help":"Look up the help for a path"
|
||||
"read":"Read data or secrets from Vault"
|
||||
"renew":"Renew the lease of a secret"
|
||||
"revoke":"Revoke a secret"
|
||||
"server":"Start a Vault server"
|
||||
"status":"Outputs status of whether Vault is sealed and if HA mode is enabled"
|
||||
"write":"Write secrets or configuration into Vault"
|
||||
"audit-disable":"Disable an audit backend"
|
||||
"audit-enable":"Enable an audit backend"
|
||||
"audit-list":"Lists enabled audit backends in Vault"
|
||||
"auth":"Prints information about how to authenticate with Vault"
|
||||
"auth-disable":"Disable an auth provider"
|
||||
"auth-enable":"Enable a new auth provider"
|
||||
"init":"Initialize a new Vault server"
|
||||
"key-status":"Provides information about the active encryption key"
|
||||
"mount":"Mount a logical backend"
|
||||
"mount-tune":"Tune mount configuration parameters"
|
||||
"mounts":"Lists mounted backends in Vault"
|
||||
"policies":"List the policies on the server"
|
||||
"policy-delete":"Delete a policy from the server"
|
||||
"policy-write":"Write a policy to the server"
|
||||
"rekey":"Rekeys Vault to generate new unseal keys"
|
||||
"remount":"Remount a secret backend to a new path"
|
||||
"rotate":"Rotates the backend encryption key used to persist data"
|
||||
"seal":"Seals the vault server"
|
||||
"ssh":"Initiate a SSH session"
|
||||
"token-create":"Create a new auth token"
|
||||
"token-renew":"Renew an auth token if there is an associated lease"
|
||||
"token-revoke":"Revoke one or more auth tokens"
|
||||
"unmount":"Unmount a secret backend"
|
||||
"unseal":"Unseals the vault server"
|
||||
"version":"Prints the Vault version"
|
||||
)
|
||||
|
||||
_describe -t commands 'vault command' commands && ret=0
|
||||
}
|
||||
|
||||
local curcontext=$curcontext ret=1
|
||||
_arguments : \
|
||||
${main_args[@]} \
|
||||
'*:: :->subcommands' && ret=0
|
||||
if ((CURRENT == 1 )); then
|
||||
_vault_commands && ret=0
|
||||
fi
|
||||
if [[ $state == subcommands ]]; then
|
||||
# (( CURRENT -- ))
|
||||
curcontext="${curcontext%:*:*}:vault-$words[1]:"
|
||||
_call_function ret _vault_$words[1]
|
||||
fi
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
# Hotlist
|
||||
# Try to use $ZSH_VERSION, e.g. /usr/share/zsh/$ZSH_VERSION/functions
|
||||
local hotlist
|
||||
hotlist=(
|
||||
~/.config/znt
|
||||
|
|
@ -7,7 +8,6 @@ hotlist=(
|
|||
/usr/local/share/zsh/site-functions
|
||||
/usr/local/share/zsh
|
||||
/usr/local/bin
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
# Suppress adding (to directory stack) directories visited by n-cd
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned
|
|||
to key combinations (no need for autoload when using Oh My Zsh):
|
||||
|
||||
zle -N znt-cd-widget
|
||||
bindkey "^T" znt-cd-widget
|
||||
bindkey "^A" znt-cd-widget
|
||||
zle -N znt-kill-widget
|
||||
bindkey "^Y" znt-kill-widget
|
||||
|
||||
|
|
@ -105,8 +105,7 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf,
|
|||
it uses this).
|
||||
|
||||
## Performance
|
||||
ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to
|
||||
be released).
|
||||
ZNT are fastest with Zsh before 5.0.6 and starting from 5.2
|
||||
|
||||
|
||||
vim:filetype=conf
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ if [ "$REPLY" -gt 0 ]; then
|
|||
# ZLE?
|
||||
if [ "${(t)CURSOR}" = "integer-local-special" ]; then
|
||||
zle redisplay
|
||||
zle kill-whole-line
|
||||
zle kill-buffer
|
||||
zle -U "$selected"
|
||||
else
|
||||
print -zr "$selected"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# $1, $2, ... - elements of the list
|
||||
# $NLIST_NONSELECTABLE_ELEMENTS - array of indexes (1-based) that cannot be selected
|
||||
# $REPLY is the output variable - contains index (1-based) or -1 when no selection
|
||||
# $reply (array) is the second part of the output - use the index (REPLY) to get selected element
|
||||
#
|
||||
# Copy this file into /usr/share/zsh/site-functions/
|
||||
# and add 'autoload n-list` to .zshrc
|
||||
|
|
@ -116,15 +117,15 @@ _nlist_setup_user_vars() {
|
|||
fi
|
||||
}
|
||||
|
||||
_nlist_coloring_list_into_col_list() {
|
||||
_nlist_colorify_disp_list() {
|
||||
local col=$'\x1b[00;34m' reset=$'\x1b[0m'
|
||||
[ -n "$NLIST_COLORING_COLOR" ] && col="$NLIST_COLORING_COLOR"
|
||||
[ -n "$NLIST_COLORING_END_COLOR" ] && reset="$NLIST_COLORING_END_COLOR"
|
||||
|
||||
if [ "$NLIST_COLORING_MATCH_MULTIPLE" -eq 1 ]; then
|
||||
col_list=( "${(@)list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
disp_list=( "${(@)disp_list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
else
|
||||
col_list=( "${(@)list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
disp_list=( "${(@)disp_list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +155,7 @@ integer inner_width=term_width-3
|
|||
integer page_height=inner_height
|
||||
integer page_width=inner_width
|
||||
|
||||
typeset -a list col_list disp_list
|
||||
typeset -a list disp_list
|
||||
integer last_element=$#
|
||||
local action
|
||||
local final_key
|
||||
|
|
@ -164,6 +165,7 @@ integer current_difference=0
|
|||
local prev_search_buffer=""
|
||||
integer prev_uniq_mode=0
|
||||
integer prev_start_idx=-1
|
||||
local MBEGIN MEND MATCH mbegin mend match
|
||||
|
||||
# Ability to remember the list between calls
|
||||
if [[ -z "$NLIST_REMEMBER_STATE" || "$NLIST_REMEMBER_STATE" -eq 0 || "$NLIST_REMEMBER_STATE" -eq 2 ]]; then
|
||||
|
|
@ -224,19 +226,17 @@ zcurses timeout main -1
|
|||
key=""
|
||||
keypad=""
|
||||
|
||||
list=( "$@" )
|
||||
last_element="$#list"
|
||||
# This loop makes script faster on some Zsh's (e.g. 5.0.8)
|
||||
repeat 1; do
|
||||
list=( "$@" )
|
||||
done
|
||||
|
||||
integer is_colored=0
|
||||
if [[ -z "$NLIST_SEARCH_BUFFER" && -n "$NLIST_COLORING_PATTERN" ]]; then
|
||||
is_colored=1
|
||||
_nlist_coloring_list_into_col_list
|
||||
fi
|
||||
last_element="$#list"
|
||||
|
||||
while (( 1 )); do
|
||||
# Do searching (filtering with string)
|
||||
if [ -n "$NLIST_SEARCH_BUFFER" ]; then
|
||||
# Compute new list, col_list ?
|
||||
# Compute new list?
|
||||
if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then
|
||||
prev_search_buffer="$NLIST_SEARCH_BUFFER"
|
||||
prev_uniq_mode="$NLIST_IS_UNIQ_MODE"
|
||||
|
|
@ -245,7 +245,9 @@ while (( 1 )); do
|
|||
|
||||
# Take all elements, including duplicates and non-selectables
|
||||
typeset +U list
|
||||
list=( "$@" )
|
||||
repeat 1; do
|
||||
list=( "$@" )
|
||||
done
|
||||
|
||||
# Remove non-selectable elements
|
||||
[ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do
|
||||
|
|
@ -264,11 +266,15 @@ while (( 1 )); do
|
|||
local search_pattern=""
|
||||
local colsearch_pattern=""
|
||||
if [ -n "$search_buffer" ]; then
|
||||
# Patterns will be *foo*~^*bar* and foo|bar)
|
||||
# Patterns will be *foo*~^*bar* and (foo|bar)
|
||||
search_pattern="${search_buffer// ##/*~^*}"
|
||||
colsearch_pattern="${search_buffer// ##/|}"
|
||||
|
||||
list=( "${(@M)list:#(#i)*$~search_pattern*}" )
|
||||
# The repeat will make the matching work on a fresh heap
|
||||
repeat 1; do
|
||||
list=( "${(@M)list:#(#i)*$~search_pattern*}" )
|
||||
done
|
||||
|
||||
last_element="$#list"
|
||||
fi
|
||||
|
||||
|
|
@ -287,10 +293,13 @@ while (( 1 )); do
|
|||
|
||||
if [ -n "$colsearch_pattern" ]; then
|
||||
local red=$'\x1b[00;31m' reset=$'\x1b[00;00m'
|
||||
disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" )
|
||||
# The repeat will make the matching work on a fresh heap
|
||||
repeat 1; do
|
||||
disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" )
|
||||
done
|
||||
fi
|
||||
|
||||
# We have display list, lets replace newlines with "\n" when needed (1/3)
|
||||
# We have display list, lets replace newlines with "\n" when needed (1/2)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
|
||||
|
|
@ -302,7 +311,7 @@ while (( 1 )); do
|
|||
# There is no search, but there was in previous loop
|
||||
# OR
|
||||
# Uniq mode was entered or left out
|
||||
# -> compute new list (maybe also col_list)
|
||||
# -> compute new list
|
||||
if [[ -n "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then
|
||||
prev_search_buffer=""
|
||||
prev_uniq_mode="$NLIST_IS_UNIQ_MODE"
|
||||
|
|
@ -311,7 +320,9 @@ while (( 1 )); do
|
|||
|
||||
# Take all elements, including duplicates and non-selectables
|
||||
typeset +U list
|
||||
list=( "$@" )
|
||||
repeat 1; do
|
||||
list=( "$@" )
|
||||
done
|
||||
|
||||
# Remove non-selectable elements only when in uniq mode
|
||||
[ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] &&
|
||||
|
|
@ -322,13 +333,6 @@ while (( 1 )); do
|
|||
# Remove duplicates when in uniq mode
|
||||
[ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list
|
||||
|
||||
# Apply coloring pattern (when not with search query)
|
||||
is_colored=0
|
||||
if [ -n "$NLIST_COLORING_PATTERN" ]; then
|
||||
is_colored=1
|
||||
_nlist_coloring_list_into_col_list
|
||||
fi
|
||||
|
||||
last_element="$#list"
|
||||
# Called after processing list
|
||||
_nlist_verify_vars
|
||||
|
|
@ -340,22 +344,14 @@ while (( 1 )); do
|
|||
integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 ))
|
||||
[ "$end_idx" -gt "$last_element" ] && end_idx=last_element
|
||||
|
||||
if [ "$is_colored" -eq 0 ]; then
|
||||
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
|
||||
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
|
||||
disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
|
||||
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
|
||||
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
|
||||
disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
|
||||
|
||||
# We have display list, lets replace newlines with "\n" when needed (2/3)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
else
|
||||
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
|
||||
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
|
||||
disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
|
||||
[ -n "$NLIST_COLORING_PATTERN" ] && _nlist_colorify_disp_list
|
||||
|
||||
# We have display list, lets replace newlines with "\n" when needed (3/3)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
# We have display list, lets replace newlines with "\n" when needed (2/2)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
|
||||
# Output the list
|
||||
|
|
@ -380,6 +376,11 @@ while (( 1 )); do
|
|||
fi
|
||||
|
||||
zcurses border main
|
||||
|
||||
local top_msg="${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL, $USER"
|
||||
zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 ))
|
||||
zcurses string main $top_msg
|
||||
|
||||
zcurses refresh main inner
|
||||
zcurses move main $(( term_height - 1 - 1 )) $(( status_msg_strlen + 2 ))
|
||||
|
||||
|
|
@ -388,7 +389,7 @@ while (( 1 )); do
|
|||
|
||||
# Get the special (i.e. "keypad") key or regular key
|
||||
if [ -n "$key" ]; then
|
||||
final_key="$key"
|
||||
final_key="$key"
|
||||
elif [ -n "$keypad" ]; then
|
||||
final_key="$keypad"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ shift 7
|
|||
integer max_text_len=page_width-x_offset
|
||||
|
||||
[ "$bold" = "0" ] && bold="" || bold="+bold"
|
||||
[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || active_text="reverse"
|
||||
[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || local active_text="reverse"
|
||||
# With Linux terminal underline won't work properly
|
||||
[ "$TERM" = "linux" ] && active_text="reverse"
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ case "$key" in
|
|||
[ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1;
|
||||
_nlist_compute_first_to_show_idx
|
||||
;;
|
||||
(PPAGE)
|
||||
(PPAGE|$'\b'|$'\C-?'|BACKSPACE)
|
||||
current_idx=current_idx-page_height
|
||||
[ "$current_idx" -lt 1 ] && current_idx=1;
|
||||
_nlist_compute_first_to_show_idx
|
||||
|
|
@ -72,7 +72,7 @@ case "$key" in
|
|||
current_idx=last_element
|
||||
_nlist_compute_first_to_show_idx
|
||||
;;
|
||||
($'\n')
|
||||
($'\n'|ENTER)
|
||||
# Is that element selectable?
|
||||
# Check for this only when there is no search
|
||||
if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 ||
|
||||
|
|
@ -137,7 +137,7 @@ esac
|
|||
else
|
||||
|
||||
case "$key" in
|
||||
($'\n')
|
||||
($'\n'|ENTER)
|
||||
search=0
|
||||
_nlist_cursor_visibility 0
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ if [ -t 0 ]; then
|
|||
return 1
|
||||
fi
|
||||
|
||||
list=( `"$@"` )
|
||||
# This loop makes script faster on some Zsh's (e.g. 5.0.8)
|
||||
repeat 1; do
|
||||
list=( `"$@"` )
|
||||
done
|
||||
|
||||
# TODO: $? doesn't reach user
|
||||
[ "$?" -eq 127 ] && return $?
|
||||
else
|
||||
|
|
@ -42,7 +46,10 @@ else
|
|||
return 1
|
||||
fi
|
||||
|
||||
list=( "${(@f)"$(<&0)"}" )
|
||||
# This loop makes script faster on some Zsh's (e.g. 5.0.8)
|
||||
repeat 1; do
|
||||
list=( "${(@f)"$(<&0)"}" )
|
||||
done
|
||||
|
||||
if [[ ! -c /dev/tty ]]; then
|
||||
exec <&2
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
autoload znt-usetty-wrapper n-history
|
||||
local NLIST_START_IN_SEARCH_MODE=1
|
||||
local NLIST_START_IN_UNIQ_MODE=1
|
||||
local NLIST_SET_SEARCH_TO="$BUFFER"
|
||||
|
||||
# Only if current $BUFFER doesn't come from history
|
||||
if [ "$HISTCMD" = "$HISTNO" ]; then
|
||||
local NLIST_SET_SEARCH_TO="$BUFFER"
|
||||
fi
|
||||
|
||||
znt-usetty-wrapper n-history "$@"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ for i; do
|
|||
fi
|
||||
done
|
||||
|
||||
# Don't leave positional parameters being set
|
||||
set --
|
||||
|
||||
#
|
||||
# Load functions
|
||||
#
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ CURRENT_BG='NONE'
|
|||
# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
|
||||
# what font the user is viewing this source code in. Do not replace the
|
||||
# escape sequence with a single literal character.
|
||||
SEGMENT_SEPARATOR=$'\ue0b0' #
|
||||
# Do not change this! Do not make it '\u2b80'; that is the old, wrong code point.
|
||||
SEGMENT_SEPARATOR=$'\ue0b0'
|
||||
}
|
||||
|
||||
# Begin a segment
|
||||
|
|
|
|||
|
|
@ -2,16 +2,25 @@
|
|||
|
||||
PROMPT='
|
||||
$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
|
||||
▶ '
|
||||
%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} '
|
||||
|
||||
PROMPT2='%{$fg[grey]%}◀%{$reset_color%} '
|
||||
PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} '
|
||||
|
||||
RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
|
||||
|
||||
local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} "
|
||||
local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}"
|
||||
local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} "
|
||||
local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}"
|
||||
local _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
|
||||
|
||||
function _current_dir() {
|
||||
local _max_pwd_length="65"
|
||||
if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then
|
||||
echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} "
|
||||
else
|
||||
echo "%{$fg_bold[blue]%}%~%{$reset_color%} "
|
||||
fi
|
||||
}
|
||||
|
||||
function _user_host() {
|
||||
if [[ -n $SSH_CONNECTION ]]; then
|
||||
me="%n@%m"
|
||||
|
|
@ -85,13 +94,13 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ "
|
|||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ "
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ "
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ "
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}◒ "
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ "
|
||||
|
||||
# Colors vary depending on time lapsed.
|
||||
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
|
||||
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
|
||||
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}"
|
||||
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}"
|
||||
|
||||
# LS colors, made with http://geoff.greer.fm/lscolors/
|
||||
export LSCOLORS="exfxcxdxbxegedabagacad"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
|
||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||
|
||||
if [[ $UID -eq 0 ]]; then
|
||||
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
|
||||
else
|
||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||
fi
|
||||
|
||||
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
||||
local rvm_ruby=''
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
# 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 '^.[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"
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -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 "
|
||||
|
|
@ -101,7 +111,7 @@ _1RIGHT="[%*] "
|
|||
|
||||
bureau_precmd () {
|
||||
_1SPACES=`get_space $_1LEFT $_1RIGHT`
|
||||
print
|
||||
print
|
||||
print -rP "$_1LEFT$_1SPACES$_1RIGHT"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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]%}["
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ ZSH_THEME_GIT_PROMPT_CLEAN=""
|
|||
|
||||
# Customized git status, oh-my-zsh currently does not allow render dirty status before branch
|
||||
git_custom_status() {
|
||||
local cb=$(current_branch)
|
||||
local cb=$(git_current_branch)
|
||||
if [ -n "$cb" ]; then
|
||||
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# ZSH Theme emulating the Fish shell's default prompt.
|
||||
|
||||
_fishy_collapsed_wd() {
|
||||
echo $(pwd | perl -pe "
|
||||
echo $(pwd | perl -pe '
|
||||
BEGIN {
|
||||
binmode STDIN, ':encoding(UTF-8)';
|
||||
binmode STDOUT, ':encoding(UTF-8)';
|
||||
}; s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g
|
||||
")
|
||||
}
|
||||
binmode STDIN, ":encoding(UTF-8)";
|
||||
binmode STDOUT, ":encoding(UTF-8)";
|
||||
}; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
|
||||
')
|
||||
}
|
||||
|
||||
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
|
||||
PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ PROMPT='
|
|||
%{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%}
|
||||
%{$fg[green]%}➞ %{$reset_color%'
|
||||
|
||||
RPROMPT='$(git_prompt_info) $(rvm)'
|
||||
RPROMPT='$(git_prompt_info) ${rvm}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# Depends on the git plugin for work_in_progress()
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
|
||||
|
|
@ -5,9 +7,9 @@ ZSH_THEME_GIT_PROMPT_CLEAN=""
|
|||
|
||||
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
|
||||
git_custom_status() {
|
||||
local cb=$(current_branch)
|
||||
local cb=$(git_current_branch)
|
||||
if [ -n "$cb" ]; then
|
||||
echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function josh_prompt {
|
|||
(( spare_width = ${COLUMNS} ))
|
||||
prompt=" "
|
||||
|
||||
branch=$(current_branch)
|
||||
branch=$(git_current_branch)
|
||||
ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
|
||||
path_size=${#PWD}
|
||||
branch_size=${#branch}
|
||||
|
|
@ -31,7 +31,7 @@ function josh_prompt {
|
|||
prompt=" $prompt"
|
||||
done
|
||||
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)"
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)"
|
||||
|
||||
echo $prompt
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
# Needs Git plugin for current_branch method
|
||||
|
||||
# Color shortcuts
|
||||
RED=$fg[red]
|
||||
YELLOW=$fg[yellow]
|
||||
|
|
@ -40,4 +38,4 @@ ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]"
|
|||
PROMPT='
|
||||
%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}
|
||||
%{$BLUE%}>%{$RESET_COLOR%} '
|
||||
RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}'
|
||||
RPROMPT='%{$GREEN_BOLD%}$(git_current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}'
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
|
||||
PROMPT='%{$fg[green]%}%c \
|
||||
PROMPT='$(virtualenv_prompt_info)%{[03m%}%{$fg[green]%}%c \
|
||||
$(git_prompt_info)\
|
||||
\
|
||||
%{$fg[red]%}%(!.#.»)%{$reset_color%} '
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}("
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[yellow]%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}"
|
||||
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$reset_color%}%{[03m%}%{$fg[blue]%}"
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="!%{$reset_color%} "
|
||||
|
|
@ -5,7 +5,7 @@ function my_git_prompt() {
|
|||
STATUS=""
|
||||
|
||||
# is branch ahead?
|
||||
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ function my_git_prompt() {
|
|||
}
|
||||
|
||||
function my_current_branch() {
|
||||
echo $(current_branch || echo "(no branch)")
|
||||
echo $(git_current_branch || echo "(no branch)")
|
||||
}
|
||||
|
||||
function ssh_connection() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ git_dirty() {
|
|||
}
|
||||
|
||||
git_prompt() {
|
||||
local cb=$(current_branch)
|
||||
local cb=$(git_current_branch)
|
||||
if [ -n "$cb" ]; then
|
||||
local repo_path=$(git_repo_path)
|
||||
echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
||||
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
# Sunrise theme for oh-my-zsh
|
||||
# Intended to be used with Solarized: http://ethanschoonover.com/solarized
|
||||
# (Needs Git plugin for current_branch method)
|
||||
|
||||
# Color shortcuts
|
||||
R=$fg_no_bold[red]
|
||||
|
|
@ -11,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%})"
|
||||
|
|
@ -67,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%}‹"
|
||||
|
|
|
|||
|
|
@ -1,18 +1,9 @@
|
|||
# Clean, simple, compatible and meaningful.
|
||||
# Tested on Linux, Unix and Windows under ANSI colors.
|
||||
# It is recommended to use with a dark background and the font Inconsolata.
|
||||
# It is recommended to use with a dark background.
|
||||
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
|
||||
#
|
||||
# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
|
||||
# Mar 2013 ys
|
||||
|
||||
# Machine name.
|
||||
function box_name {
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || echo $HOST
|
||||
}
|
||||
|
||||
# Directory info.
|
||||
local current_dir='${PWD/#$HOME/~}'
|
||||
#
|
||||
# Mar 2013 Yad Smood
|
||||
|
||||
# VCS
|
||||
YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} "
|
||||
|
|
@ -21,7 +12,7 @@ YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
|
|||
YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
|
||||
YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o"
|
||||
|
||||
# Git info.
|
||||
# Git info
|
||||
local git_info='$(git_prompt_info)'
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX"
|
||||
|
|
@ -44,29 +35,26 @@ ys_hg_prompt_info() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $
|
||||
PROMPT="
|
||||
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
|
||||
%{$fg[cyan]%}%n \
|
||||
%{$fg[white]%}at \
|
||||
%{$fg[green]%}$(box_name) \
|
||||
%{$fg[white]%}in \
|
||||
%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
|
||||
${hg_info}\
|
||||
${git_info} \
|
||||
%{$fg[white]%}[%*]
|
||||
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
|
||||
local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
|
||||
|
||||
if [[ "$USER" == "root" ]]; then
|
||||
# Prompt format:
|
||||
#
|
||||
# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] C:LAST_EXIT_CODE
|
||||
# $ COMMAND
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] C:0
|
||||
# $
|
||||
PROMPT="
|
||||
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
|
||||
%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
|
||||
%{$fg[white]%}at \
|
||||
%{$fg[green]%}$(box_name) \
|
||||
%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \
|
||||
%{$fg[white]%}@ \
|
||||
%{$fg[green]%}%m \
|
||||
%{$fg[white]%}in \
|
||||
%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
|
||||
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
|
||||
${hg_info}\
|
||||
${git_info} \
|
||||
%{$fg[white]%}[%*]
|
||||
${git_info}\
|
||||
\
|
||||
%{$fg[white]%}[%*] $exit_code
|
||||
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ else
|
|||
NORMAL=""
|
||||
fi
|
||||
|
||||
printf "${BLUE}%s${NORMAL}\n" "Upgrading Oh My Zsh"
|
||||
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
|
||||
cd "$ZSH"
|
||||
if git pull --rebase --stat origin master
|
||||
then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue