Discarded all previous changes to atom plugin for easier review in next commit.master
commit
7576f856b9
63 changed files with 2523 additions and 561 deletions
@ -0,0 +1,60 @@ |
||||
# Handle completions insecurities (i.e., completion-dependent directories with |
||||
# insecure ownership or permissions) by: |
||||
# |
||||
# * Human-readably notifying the user of these insecurities. |
||||
# * Moving away all existing completion caches to a temporary directory. Since |
||||
# any of these caches may have been generated from insecure directories, they |
||||
# are all suspect now. Failing to do so typically causes subsequent compinit() |
||||
# calls to fail with "command not found: compdef" errors. (That's bad.) |
||||
function handle_completion_insecurities() { |
||||
# List of the absolute paths of all unique insecure directories, split on |
||||
# newline from compaudit()'s output resembling: |
||||
# |
||||
# There are insecure directories: |
||||
# /usr/share/zsh/site-functions |
||||
# /usr/share/zsh/5.0.6/functions |
||||
# /usr/share/zsh |
||||
# /usr/share/zsh/5.0.6 |
||||
# |
||||
# Since the ignorable first line is printed to stderr and thus not captured, |
||||
# stderr is squelched to prevent this output from leaking to the user. |
||||
local -aU insecure_dirs |
||||
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) |
||||
|
||||
# If no such directories exist, get us out of here. |
||||
if (( ! ${#insecure_dirs} )); then |
||||
print "[oh-my-zsh] No insecure completion-dependent directories detected." |
||||
return |
||||
fi |
||||
|
||||
# List ownership and permissions of all insecure directories. |
||||
print "[oh-my-zsh] Insecure completion-dependent directories detected:" |
||||
ls -ld "${(@)insecure_dirs}" |
||||
print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all" |
||||
print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh." |
||||
print "[oh-my-zsh] See the above list for directories with group or other writability.\n" |
||||
|
||||
# Locally enable the "NULL_GLOB" option, thus removing unmatched filename |
||||
# globs from argument lists *AND* printing no warning when doing so. Failing |
||||
# to do so prints an unreadable warning if no completion caches exist below. |
||||
setopt local_options null_glob |
||||
|
||||
# List of the absolute paths of all unique existing completion caches. |
||||
local -aU zcompdump_files |
||||
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* ) |
||||
|
||||
# Move such caches to a temporary directory. |
||||
if (( ${#zcompdump_files} )); then |
||||
# Absolute path of the directory to which such files will be moved. |
||||
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad" |
||||
|
||||
# List such files first. |
||||
print "[oh-my-zsh] Insecure completion caches also detected:" |
||||
ls -l "${(@)zcompdump_files}" |
||||
|
||||
# For safety, move rather than permanently remove such files. |
||||
print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n" |
||||
mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}" |
||||
mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/" |
||||
fi |
||||
} |
||||
@ -0,0 +1,335 @@ |
||||
# diagnostics.zsh |
||||
# |
||||
# Diagnostic and debugging support for oh-my-zsh |
||||
|
||||
# omz_diagnostic_dump() |
||||
# |
||||
# Author: Andrew Janke <andrew@apjanke.net> |
||||
# |
||||
# Usage: |
||||
# |
||||
# omz_diagnostic_dump [-v] [-V] [file] |
||||
# |
||||
# NOTE: This is a work in progress. Its interface and behavior are going to change, |
||||
# and probably in non-back-compatible ways. |
||||
# |
||||
# Outputs a bunch of information about the state and configuration of |
||||
# oh-my-zsh, zsh, and the user's system. This is intended to provide a |
||||
# bunch of context for diagnosing your own or a third party's problems, and to |
||||
# be suitable for posting to public bug reports. |
||||
# |
||||
# The output is human-readable and its format may change over time. It is not |
||||
# suitable for parsing. All the output is in one single file so it can be posted |
||||
# as a gist or bug comment on GitHub. GitHub doesn't support attaching tarballs |
||||
# or other files to bugs; otherwise, this would probably have an option to produce |
||||
# tarballs that contain copies of the config and customization files instead of |
||||
# catting them all in to one file. |
||||
# |
||||
# This is intended to be widely portable, and run anywhere that oh-my-zsh does. |
||||
# Feel free to report any portability issues as bugs. |
||||
# |
||||
# This is written in a defensive style so it still works (and can detect) cases when |
||||
# basic functionality like echo and which have been redefined. In particular, almost |
||||
# everything is invoked with "builtin" or "command", to work in the face of user |
||||
# redefinitions. |
||||
# |
||||
# OPTIONS |
||||
# |
||||
# [file] Specifies the output file. If not given, a file in the current directory |
||||
# is selected automatically. |
||||
# |
||||
# -v Increase the verbosity of the dump output. May be specified multiple times. |
||||
# Verbosity levels: |
||||
# 0 - Basic info, shell state, omz configuration, git state |
||||
# 1 - (default) Adds key binding info and configuration file contents |
||||
# 2 - Adds zcompdump file contents |
||||
# |
||||
# -V Reduce the verbosity of the dump output. May be specified multiple times. |
||||
# |
||||
# TODO: |
||||
# * Multi-file capture |
||||
# * Add automatic gist uploading |
||||
# * Consider whether to move default output file location to TMPDIR. More robust |
||||
# but less user friendly. |
||||
# |
||||
function omz_diagnostic_dump() { |
||||
emulate -L zsh |
||||
|
||||
builtin echo "Generating diagnostic dump; please be patient..." |
||||
|
||||
local thisfcn=omz_diagnostic_dump |
||||
local -A opts |
||||
local opt_verbose opt_noverbose opt_outfile |
||||
local timestamp=$(date +%Y%m%d-%H%M%S) |
||||
local outfile=omz_diagdump_$timestamp.txt |
||||
builtin zparseopts -A opts -D -- "v+=opt_verbose" "V+=opt_noverbose" |
||||
local verbose n_verbose=${#opt_verbose} n_noverbose=${#opt_noverbose} |
||||
(( verbose = 1 + n_verbose - n_noverbose )) |
||||
|
||||
if [[ ${#*} > 0 ]]; then |
||||
opt_outfile=$1 |
||||
fi |
||||
if [[ ${#*} > 1 ]]; then |
||||
builtin echo "$thisfcn: error: too many arguments" >&2 |
||||
return 1 |
||||
fi |
||||
if [[ -n "$opt_outfile" ]]; then |
||||
outfile="$opt_outfile" |
||||
fi |
||||
|
||||
# Always write directly to a file so terminal escape sequences are |
||||
# captured cleanly |
||||
_omz_diag_dump_one_big_text &> "$outfile" |
||||
if [[ $? != 0 ]]; then |
||||
builtin echo "$thisfcn: error while creating diagnostic dump; see $outfile for details" |
||||
fi |
||||
|
||||
builtin echo |
||||
builtin echo Diagnostic dump file created at: "$outfile" |
||||
builtin echo |
||||
builtin echo To share this with OMZ developers, post it as a gist on GitHub |
||||
builtin echo at "https://gist.github.com" and share the link to the gist. |
||||
builtin echo |
||||
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files," |
||||
builtin echo "so don't share it publicly if there's sensitive information in them." |
||||
builtin echo |
||||
|
||||
} |
||||
|
||||
function _omz_diag_dump_one_big_text() { |
||||
local program programs progfile md5 |
||||
|
||||
builtin echo oh-my-zsh diagnostic dump |
||||
builtin echo |
||||
builtin echo $outfile |
||||
builtin echo |
||||
|
||||
# Basic system and zsh information |
||||
command date |
||||
command uname -a |
||||
builtin echo OSTYPE=$OSTYPE |
||||
builtin echo ZSH_VERSION=$ZSH_VERSION |
||||
builtin echo User: $USER |
||||
builtin echo umask: $(umask) |
||||
builtin echo |
||||
_omz_diag_dump_os_specific_version |
||||
builtin echo |
||||
|
||||
# Installed programs |
||||
programs=(sh zsh ksh bash sed cat grep ls find git posh) |
||||
local progfile="" extra_str="" sha_str="" |
||||
for program in $programs; do |
||||
extra_str="" sha_str="" |
||||
progfile=$(builtin which $program) |
||||
if [[ $? == 0 ]]; then |
||||
if [[ -e $progfile ]]; then |
||||
if builtin whence shasum &>/dev/null; then |
||||
sha_str=($(command shasum $progfile)) |
||||
sha_str=$sha_str[1] |
||||
extra_str+=" SHA $sha_str" |
||||
fi |
||||
if [[ -h "$progfile" ]]; then |
||||
extra_str+=" ( -> ${progfile:A} )" |
||||
fi |
||||
fi |
||||
builtin printf '%-9s %-20s %s\n' "$program is" "$progfile" "$extra_str" |
||||
else |
||||
builtin echo "$program: not found" |
||||
fi |
||||
done |
||||
builtin echo |
||||
builtin echo Command Versions: |
||||
builtin echo "zsh: $(zsh --version)" |
||||
builtin echo "this zsh session: $ZSH_VERSION" |
||||
builtin echo "bash: $(bash --version | command grep bash)" |
||||
builtin echo "git: $(git --version)" |
||||
builtin echo "grep: $(grep --version)" |
||||
builtin echo |
||||
|
||||
# Core command definitions |
||||
_omz_diag_dump_check_core_commands || return 1 |
||||
builtin echo |
||||
|
||||
# ZSH Process state |
||||
builtin echo Process state: |
||||
builtin echo pwd: $PWD |
||||
if builtin whence pstree &>/dev/null; then |
||||
builtin echo Process tree for this shell: |
||||
pstree -p $$ |
||||
else |
||||
ps -fT |
||||
fi |
||||
builtin set | command grep -a '^\(ZSH\|plugins\|TERM\|LC_\|LANG\|precmd\|chpwd\|preexec\|FPATH\|TTY\|DISPLAY\|PATH\)\|OMZ' |
||||
builtin echo |
||||
#TODO: Should this include `env` instead of or in addition to `export`? |
||||
builtin echo Exported: |
||||
builtin echo $(builtin export | command sed 's/=.*//') |
||||
builtin echo |
||||
builtin echo Locale: |
||||
command locale |
||||
builtin echo |
||||
|
||||
# Zsh installation and configuration |
||||
builtin echo Zsh configuration: |
||||
builtin echo setopt: $(builtin setopt) |
||||
builtin echo |
||||
builtin echo zstyle: |
||||
builtin zstyle |
||||
builtin echo |
||||
builtin echo 'compaudit output:' |
||||
compaudit |
||||
builtin echo |
||||
builtin echo '$fpath directories:' |
||||
command ls -lad $fpath |
||||
builtin echo |
||||
|
||||
# Oh-my-zsh installation |
||||
builtin echo oh-my-zsh installation: |
||||
command ls -ld ~/.z* |
||||
command ls -ld ~/.oh* |
||||
builtin echo |
||||
builtin echo oh-my-zsh git state: |
||||
(cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]") |
||||
if [[ $verbose -ge 1 ]]; then |
||||
(cd $ZSH && git reflog --date=default | command grep pull) |
||||
fi |
||||
builtin echo |
||||
if [[ -e $ZSH_CUSTOM ]]; then |
||||
local custom_dir=$ZSH_CUSTOM |
||||
if [[ -h $custom_dir ]]; then |
||||
custom_dir=$(cd $custom_dir && pwd -P) |
||||
fi |
||||
builtin echo "oh-my-zsh custom dir:" |
||||
builtin echo " $ZSH_CUSTOM ($custom_dir)" |
||||
(cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print) |
||||
builtin echo |
||||
fi |
||||
|
||||
# Key binding and terminal info |
||||
if [[ $verbose -ge 1 ]]; then |
||||
builtin echo "bindkey:" |
||||
builtin bindkey |
||||
builtin echo |
||||
builtin echo "infocmp:" |
||||
command infocmp -L |
||||
builtin echo |
||||
fi |
||||
|
||||
# Configuration file info |
||||
local zdotdir=${ZDOTDIR:-$HOME} |
||||
builtin echo "Zsh configuration files:" |
||||
local cfgfile cfgfiles |
||||
# Some files for bash that zsh does not use are intentionally included |
||||
# to help with diagnosing behavior differences between bash and zsh |
||||
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout |
||||
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout |
||||
~/.zsh.pre-oh-my-zsh |
||||
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout ) |
||||
command ls -lad $cfgfiles 2>&1 |
||||
builtin echo |
||||
if [[ $verbose -ge 1 ]]; then |
||||
for cfgfile in $cfgfiles; do |
||||
_omz_diag_dump_echo_file_w_header $cfgfile |
||||
done |
||||
fi |
||||
builtin echo |
||||
builtin echo "Zsh compdump files:" |
||||
local dumpfile dumpfiles |
||||
command ls -lad $zdotdir/.zcompdump* |
||||
dumpfiles=( $zdotdir/.zcompdump*(N) ) |
||||
if [[ $verbose -ge 2 ]]; then |
||||
for dumpfile in $dumpfiles; do |
||||
_omz_diag_dump_echo_file_w_header $dumpfile |
||||
done |
||||
fi |
||||
|
||||
} |
||||
|
||||
function _omz_diag_dump_check_core_commands() { |
||||
builtin echo "Core command check:" |
||||
local redefined name builtins externals |
||||
redefined=() |
||||
# All the zsh non-module builtin commands |
||||
# These are taken from the zsh reference manual for 5.0.2 |
||||
# Commands from modules should not be included. |
||||
# (For back-compatibility, if any of these are newish, they should be removed, |
||||
# or at least made conditional on the version of the current running zsh.) |
||||
# "history" is also excluded because OMZ is known to redefine that |
||||
builtins=( alias autoload bg bindkey break builtin bye cd chdir command |
||||
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags |
||||
comptry compvalues continue declare dirs disable disown echo echotc echoti emulate |
||||
enable eval exec exit export false fc fg float functions getln getopts hash |
||||
integer jobs kill let limit local log logout noglob popd print printf |
||||
pushd pushln pwd r read readonly rehash return sched set setopt shift |
||||
source suspend test times trap true ttyctl type typeset ulimit umask unalias |
||||
unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile |
||||
zle zmodload zparseopts zregexparse zstyle ) |
||||
builtins_fatal=( builtin command local ) |
||||
externals=( zsh ) |
||||
for name in $builtins; do |
||||
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then |
||||
builtin echo "builtin '$name' has been redefined" |
||||
builtin which $name |
||||
redefined+=$name |
||||
fi |
||||
done |
||||
for name in $externals; do |
||||
if [[ $(builtin whence -w $name) != "$name: command" ]]; then |
||||
builtin echo "command '$name' has been redefined" |
||||
builtin which $name |
||||
redefined+=$name |
||||
fi |
||||
done |
||||
|
||||
if [[ -n "$redefined" ]]; then |
||||
builtin echo "SOME CORE COMMANDS HAVE BEEN REDEFINED: $redefined" |
||||
else |
||||
builtin echo "All core commands are defined normally" |
||||
fi |
||||
|
||||
} |
||||
|
||||
function _omz_diag_dump_echo_file_w_header() { |
||||
local file=$1 |
||||
if [[ ( -f $file || -h $file ) ]]; then |
||||
builtin echo "========== $file ==========" |
||||
if [[ -h $file ]]; then |
||||
builtin echo "========== ( => ${file:A} ) ==========" |
||||
fi |
||||
command cat $file |
||||
builtin echo "========== end $file ==========" |
||||
builtin echo |
||||
elif [[ -d $file ]]; then |
||||
builtin echo "File '$file' is a directory" |
||||
elif [[ ! -e $file ]]; then |
||||
builtin echo "File '$file' does not exist" |
||||
else |
||||
command ls -lad "$file" |
||||
fi |
||||
} |
||||
|
||||
function _omz_diag_dump_os_specific_version() { |
||||
local osname osver version_file version_files |
||||
case "$OSTYPE" in |
||||
darwin*) |
||||
osname=$(command sw_vers -productName) |
||||
osver=$(command sw_vers -productVersion) |
||||
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)" |
||||
;; |
||||
cygwin) |
||||
command systeminfo | command head -4 | command tail -2 |
||||
;; |
||||
esac |
||||
|
||||
if builtin which lsb_release >/dev/null; then |
||||
builtin echo "OS Release: $(command lsb_release -s -d)" |
||||
fi |
||||
|
||||
version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) ) |
||||
for version_file in $version_files; do |
||||
builtin echo "$version_file:" |
||||
command cat "$version_file" |
||||
builtin echo |
||||
done |
||||
} |
||||
|
||||
@ -1,10 +1,49 @@ |
||||
#compdef cap |
||||
#compdef shipit |
||||
#autoload |
||||
|
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then |
||||
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then |
||||
echo "\nGenerating .cap_tasks~..." > /dev/stderr |
||||
cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ |
||||
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. |
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module |
||||
|
||||
local curcontext="$curcontext" state line ret=1 |
||||
local -a _configs |
||||
|
||||
_arguments -C \ |
||||
'1: :->cmds' \ |
||||
'2:: :->args' && ret=0 |
||||
|
||||
_cap_tasks() { |
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then |
||||
if [[ ! -f .cap_tasks~ ]]; then |
||||
shipit -v --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~ |
||||
fi |
||||
|
||||
OLD_IFS=$IFS |
||||
IFS=$'\n' |
||||
_values 'cap commands' $(< .cap_tasks~) |
||||
IFS=$OLD_IFS |
||||
# zmodload zsh/mapfile |
||||
# _values ${(f)mapfile[.cap_tasks~]} |
||||
fi |
||||
compadd `cat .cap_tasks~` |
||||
fi |
||||
} |
||||
|
||||
_cap_stages() { |
||||
compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g) |
||||
} |
||||
|
||||
case $state in |
||||
cmds) |
||||
# check if it uses multistage |
||||
if [[ -d config/deploy ]]; then |
||||
_cap_stages |
||||
else |
||||
_cap_tasks |
||||
fi |
||||
ret=0 |
||||
;; |
||||
args) |
||||
_cap_tasks |
||||
ret=0 |
||||
;; |
||||
esac |
||||
|
||||
return ret |
||||
|
||||
@ -0,0 +1,11 @@ |
||||
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. |
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module |
||||
|
||||
func shipit() { |
||||
if [ -f Gemfile ] |
||||
then |
||||
bundle exec cap $* |
||||
else |
||||
cap $* |
||||
fi |
||||
} |
||||
@ -0,0 +1,82 @@ |
||||
#compdef codeclimate |
||||
|
||||
_codeclimate_all_engines() { |
||||
engines_all=(`codeclimate engines:list | tail -n +2 | gawk '{ print $2 }' | gawk -F: '{ print $1 }'`) |
||||
} |
||||
|
||||
_codeclimate_installed_engines() { |
||||
_codeclimate_all_engines |
||||
|
||||
engines_installed=() |
||||
|
||||
if [ -e .codeclimate.yml ] |
||||
then |
||||
for engine in $engines_all |
||||
do |
||||
if grep -q $engine ".codeclimate.yml" |
||||
then |
||||
engines_installed+=$engine |
||||
fi |
||||
done |
||||
fi |
||||
} |
||||
|
||||
_codeclimate_not_installed_engines() { |
||||
_codeclimate_all_engines |
||||
|
||||
engines_not_installed=() |
||||
|
||||
if [ -e .codeclimate.yml ] |
||||
then |
||||
for engine in $engines_all |
||||
do |
||||
if ! grep -q $engine ".codeclimate.yml" |
||||
then |
||||
engines_not_installed+=$engine |
||||
fi |
||||
done |
||||
fi |
||||
} |
||||
|
||||
local curcontext="$curcontext" state line ret=1 |
||||
local expl |
||||
local -a engines_all engines_installed engines_not_installed |
||||
|
||||
_arguments \ |
||||
'1: :->cmds' \ |
||||
'*:: :->args' && ret=0 |
||||
|
||||
case $state in |
||||
cmds) |
||||
_values "bundle command" \ |
||||
"analyze[Analyze all relevant files in the current working directory]" \ |
||||
"console[Start an interactive session providing access to the classes within the CLI]" \ |
||||
"engines\:disable[Prevents the engine from being used in this project]" \ |
||||
"engines\:enable[This engine will be run the next time your project is analyzed]" \ |
||||
"engines\:install[Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines]" \ |
||||
"engines\:list[Lists all available engines in the Code Climate Docker Hub]" \ |
||||
"engines\:remove[Removes an engine from your .codeclimate.yml file]" \ |
||||
"help[Displays a list of commands that can be passed to the Code Climate CLI]" \ |
||||
"init[Generates a new .codeclimate.yml file in the current working directory]" \ |
||||
"validate-config[Validates the .codeclimate.yml file in the current working directory]" \ |
||||
"version[Displays the current version of the Code Climate CLI]" |
||||
ret=0 |
||||
;; |
||||
args) |
||||
case $line[1] in |
||||
engines:enable) |
||||
_codeclimate_not_installed_engines |
||||
_wanted engines_not_installed expl 'not installed engines' compadd -a engines_not_installed ;; |
||||
engines:disable|engines:remove) |
||||
_codeclimate_installed_engines |
||||
_wanted engines_installed expl 'installed engines' compadd -a engines_installed ;; |
||||
analyze) |
||||
_arguments \ |
||||
'-f:Output Format:(text json)' |
||||
ret=0 |
||||
;; |
||||
esac |
||||
;; |
||||
esac |
||||
|
||||
return ret |
||||
@ -0,0 +1,43 @@ |
||||
# ------------------------------------------------------------------------------ |
||||
# FILE: emotty.plugin.zsh |
||||
# DESCRIPTION: Return an emoji for the current $TTY number. |
||||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) |
||||
# VERSION: 1.0.0 |
||||
# DEPENDS: emoji plugin |
||||
# |
||||
# There are different sets of emoji characters available, to choose a different |
||||
# set export emotty_set to the name of the set you would like to use, e.g.: |
||||
# % export emotty_set=nature |
||||
# ------------------------------------------------------------------------------ |
||||
|
||||
typeset -gAH _emotty_sets |
||||
local _emotty_plugin_dir="${0:h}" |
||||
source "$_emotty_plugin_dir/emotty_stellar_set.zsh" |
||||
source "$_emotty_plugin_dir/emotty_floral_set.zsh" |
||||
source "$_emotty_plugin_dir/emotty_zodiac_set.zsh" |
||||
source "$_emotty_plugin_dir/emotty_nature_set.zsh" |
||||
source "$_emotty_plugin_dir/emotty_emoji_set.zsh" |
||||
source "$_emotty_plugin_dir/emotty_love_set.zsh" |
||||
unset _emotty_plugin_dir |
||||
|
||||
emotty_default_set=emoji |
||||
|
||||
function emotty() { |
||||
# Use emotty set defined by user, fallback to default |
||||
local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]} |
||||
# Parse $TTY number, normalizing it to an emotty set index |
||||
(( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 )) |
||||
local character_name=${${=emotty}[tty]} |
||||
echo "${emoji[${character_name}]}${emoji2[emoji_style]}" |
||||
} |
||||
|
||||
function display_emotty() { |
||||
local name=$1 |
||||
for i in ${=_emotty_sets[$name]}; do |
||||
printf "${emoji[$i]}${emoji2[emoji_style]} " |
||||
done |
||||
print |
||||
for i in ${=_emotty_sets[$name]}; do |
||||
print "${emoji[$i]}${emoji2[emoji_style]} = $i" |
||||
done |
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
#!/usr/bin/env zsh |
||||
# vim:ft=zsh ts=2 sw=2 sts=2 |
||||
|
||||
_emotty_sets[emoji]=" |
||||
crystal_ball |
||||
ghost |
||||
jack_o_lantern |
||||
see_no_evil_monkey |
||||
hear_no_evil_monkey |
||||
speak_no_evil_monkey |
||||
smiling_cat_face_with_open_mouth |
||||
extraterrestrial_alien |
||||
rocket |
||||
billiards |
||||
bomb |
||||
pill |
||||
japanese_symbol_for_beginner |
||||
direct_hit |
||||
cyclone |
||||
diamond_shape_with_a_dot_inside |
||||
sparkle |
||||
eight_spoked_asterisk |
||||
eight_pointed_black_star |
||||
" |
||||
@ -0,0 +1,18 @@ |
||||
#!/usr/bin/env zsh |
||||
# vim:ft=zsh ts=2 sw=2 sts=2 |
||||
|
||||
_emotty_sets[floral]=" |
||||
hibiscus |
||||
cherry_blossom |
||||
blossom |
||||
sunflower |
||||
bouquet |
||||
tulip |
||||
rose |
||||
four_leaf_clover |
||||
seedling |
||||
herb |
||||
palm_tree |
||||
evergreen_tree |
||||
deciduous_tree |
||||
" |
||||
@ -0,0 +1,34 @@ |
||||
#!/usr/bin/env zsh |
||||
# vim:ft=zsh ts=2 sw=2 sts=2 |
||||
|
||||
# Note: The heavy_black_heart emoji requires $emoji2[emoji_style] |
||||
# to be rendered as the emoji red heart. |
||||
_emotty_sets[love]=" |
||||
green_heart |
||||
blue_heart |
||||
purple_heart |
||||
yellow_heart |
||||
heavy_black_heart |
||||
broken_heart |
||||
heart_with_arrow |
||||
heart_with_ribbon |
||||
sparkling_heart |
||||
two_hearts |
||||
revolving_hearts |
||||
growing_heart |
||||
beating_heart |
||||
heart_decoration |
||||
couple_with_heart |
||||
kiss |
||||
man_and_woman_holding_hands |
||||
two_women_holding_hands |
||||
two_men_holding_hands |
||||
kiss_mark |
||||
smiling_face_with_heart_shaped_eyes |
||||
kissing_face |
||||
face_throwing_a_kiss |
||||
kissing_face_with_smiling_eyes |
||||
kissing_face_with_closed_eyes |
||||
smiling_cat_face_with_heart_shaped_eyes |
||||
kissing_cat_face_with_closed_eyes |
||||
" |
||||
@ -0,0 +1,58 @@ |
||||
#!/usr/bin/env zsh |
||||
# vim:ft=zsh ts=2 sw=2 sts=2 |
||||
|
||||
_emotty_sets[nature]=" |
||||
mouse_face |
||||
hamster_face |
||||
rabbit_face |
||||
dog_face |
||||
cat_face |
||||
tiger_face |
||||
bear_face |
||||
monkey_face |
||||
koala |
||||
panda_face |
||||
chicken |
||||
baby_chick |
||||
bird |
||||
penguin |
||||
cow_face |
||||
pig_face |
||||
frog_face |
||||
boar |
||||
wolf_face |
||||
horse_face |
||||
snail |
||||
bug |
||||
ant |
||||
honeybee |
||||
lady_beetle |
||||
spouting_whale |
||||
dolphin |
||||
octopus |
||||
fish |
||||
tropical_fish |
||||
snake |
||||
turtle |
||||
lemon |
||||
tangerine |
||||
peach |
||||
mushroom |
||||
tomato |
||||
strawberry |
||||
red_apple |
||||
cherries |
||||
grapes |
||||
aubergine |
||||
watermelon |
||||
banana |
||||
pineapple |
||||
melon |
||||
pear |
||||
green_apple |
||||
ear_of_maize |
||||
sunflower |
||||
seedling |
||||
herb |
||||
four_leaf_clover |
||||
" |
||||
@ -0,0 +1,25 @@ |
||||
#!/usr/bin/env zsh |
||||
# vim:ft=zsh ts=2 sw=2 sts=2 |
||||
|
||||
# NOTE: The following emoji show as $'character' in the title |
||||
# white_medium_star |
||||
# sparkles |
||||
# dizzy_symbol |
||||
|
||||
_emotty_sets[stellar]=" |
||||
full_moon_symbol |
||||
waning_gibbous_moon_symbol |
||||
waning_crescent_moon_symbol |
||||
last_quarter_moon_symbol |
||||
new_moon_symbol |
||||
new_moon_with_face |
||||
waxing_crescent_moon_symbol |
||||
first_quarter_moon_symbol |
||||
waxing_gibbous_moon_symbol |
||||
full_moon_with_face |
||||
sun_with_face |
||||
glowing_star |
||||
crescent_moon |
||||
first_quarter_moon_with_face |
||||
last_quarter_moon_with_face |
||||
" |
||||
@ -0,0 +1,29 @@ |
||||
#!/usr/bin/env zsh |
||||
# vim:ft=zsh ts=2 sw=2 sts=2 |
||||
|
||||
_emotty_sets[zodiac]=" |
||||
aries |
||||
taurus |
||||
gemini |
||||
cancer |
||||
leo |
||||
virgo |
||||
libra |
||||
scorpius |
||||
sagittarius |
||||
capricorn |
||||
aquarius |
||||
pisces |
||||
rat |
||||
ox |
||||
tiger |
||||
rabbit |
||||
dragon |
||||
snake |
||||
horse |
||||
goat |
||||
monkey |
||||
rooster |
||||
dog |
||||
pig |
||||
" |
||||
@ -0,0 +1,14 @@ |
||||
# Use Ctrl-Z to switch back to Vim |
||||
|
||||
I frequently need to execute random command in my shell. To achieve it I pause |
||||
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim. |
||||
The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back |
||||
to Vim. I could not find a solution, so I developed one on my own that |
||||
works wonderfully with ZSH |
||||
|
||||
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/ |
||||
|
||||
Credits: |
||||
- original idea by @sheerun |
||||
- added to OMZ by @mbologna |
||||
|
||||
@ -0,0 +1,12 @@ |
||||
fancy-ctrl-z () { |
||||
if [[ $#BUFFER -eq 0 ]]; then |
||||
BUFFER="fg" |
||||
zle accept-line |
||||
else |
||||
zle push-input |
||||
zle clear-screen |
||||
fi |
||||
} |
||||
zle -N fancy-ctrl-z |
||||
bindkey '^Z' fancy-ctrl-z |
||||
|
||||
@ -0,0 +1,29 @@ |
||||
{{with .PDoc}}{{/* |
||||
|
||||
Constants |
||||
--------------------------------------- |
||||
|
||||
*/}}{{with .Consts}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/* |
||||
|
||||
Variables |
||||
--------------------------------------- |
||||
|
||||
*/}}{{with .Vars}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/* |
||||
|
||||
Functions |
||||
--------------------------------------- |
||||
|
||||
*/}}{{with .Funcs}}{{range .}}{{ .Name }} {{end}}{{end}}{{/* |
||||
|
||||
Types |
||||
--------------------------------------- |
||||
|
||||
*/}}{{with .Types}}{{range .}}{{ $TypeName := .Name }}{{ $TypeName }} {{/* |
||||
|
||||
*/}}{{range .Methods}}{{ $TypeName }}.{{.Name}} {{end}}{{/* |
||||
|
||||
*/}}{{range .Funcs}}{{.Name}} {{end}}{{/* |
||||
|
||||
*/}}{{range .Consts}}{{range .Names}}{{.}} {{end}}{{end}}{{/* |
||||
|
||||
*/}}{{range .Vars}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{end}}{{end}} |
||||
@ -0,0 +1,29 @@ |
||||
#!/usr/bin/env zsh |
||||
|
||||
# |
||||
# gulp-autocompletion-zsh |
||||
# |
||||
# Autocompletion for your gulp.js tasks |
||||
# |
||||
# Copyright(c) 2014 André König <andre.koenig@posteo.de> |
||||
# MIT Licensed |
||||
# |
||||
|
||||
# |
||||
# André König |
||||
# Github: https://github.com/akoenig |
||||
# Twitter: https://twitter.com/caiifr |
||||
# |
||||
|
||||
# |
||||
# Grabs all available tasks from the `gulpfile.js` |
||||
# 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) |
||||
|
||||
completions=(${=compls}) |
||||
compadd -- $completions |
||||
} |
||||
|
||||
compdef $$gulp_completion gulp |
||||
@ -0,0 +1,64 @@ |
||||
# Jira plugin # |
||||
|
||||
CLI support for JIRA interaction |
||||
|
||||
## Description ## |
||||
|
||||
This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software. |
||||
|
||||
The interaction is all done through the web. No local installation of JIRA is necessary. |
||||
|
||||
In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` refers to the command this plugin supplies. |
||||
|
||||
## Usage ## |
||||
|
||||
This plugin supplies one command, `jira`, through which all its features are exposed. Most forms of this command open a JIRA page in your web browser. |
||||
|
||||
``` |
||||
jira # performs the default action |
||||
|
||||
jira new # opens a new issue |
||||
jira dashboard # opens your JIRA dashboard |
||||
jira reported [username] # queries for issues reported by a user |
||||
jira assigned [username] # queries for issues assigned to a user |
||||
jira ABC-123 # opens an existing issue |
||||
jira ABC-123 m # opens an existing issue for adding a comment |
||||
``` |
||||
|
||||
#### Debugging usage #### |
||||
|
||||
These calling forms are for developers' use, and may change at any time. |
||||
|
||||
``` |
||||
jira dumpconfig # displays the effective configuration |
||||
``` |
||||
|
||||
## Setup ## |
||||
|
||||
The URL for your JIRA instance is set by `$JIRA_URL` or a `.jira_url` file. |
||||
|
||||
Add a `.jira-url` file in the base of your project. You can also set `$JIRA_URL` in your `~/.zshrc` or put a `.jira-url` in your home directory. A `.jira-url` in the current directory takes precedence, so you can make per-project customizations. |
||||
|
||||
The same goes with `.jira-prefix` and `$JIRA_PREFIX`. These control the prefix added to all issue IDs, which differentiates projects within a JIRA instance. |
||||
|
||||
For example: |
||||
|
||||
``` |
||||
cd to/my/project |
||||
echo "https://jira.atlassian.com" >> .jira-url |
||||
``` |
||||
|
||||
(Note: The current implementation only looks in the current directory for `.jira-url` and `.jira-prefix`, not up the path, so if you are in a subdirectory of your project, it will fall back to your default JIRA URL. This will probably change in the future though.) |
||||
|
||||
### Variables ### |
||||
|
||||
* `$JIRA_URL` - Your JIRA instance's URL |
||||
* `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches |
||||
* `$JIRA_PREFIX` - Prefix added to issue ID arguments |
||||
* `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board |
||||
* `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new" |
||||
|
||||
|
||||
### Browser ### |
||||
|
||||
Your default web browser, as determined by how `open_command` handles `http://` URLs, is used for interacting with the JIRA instance. If you change your system's URL handler associations, it will change the browser that `jira` uses. |
||||
@ -0,0 +1,7 @@ |
||||
## Scaleway CLI autocomplete plugin |
||||
|
||||
[scw](https://github.com/scaleway/scaleway-cli): Manage Bare Metal servers from Command Line (as easily as with Docker) |
||||
|
||||
- Adds autocomplete options for all `scw` commands. |
||||
|
||||
Maintainer : Manfred Touron ([@moul](https://github.com/moul)) |
||||
@ -0,0 +1,333 @@ |
||||
#compdef scw |
||||
# |
||||
# zsh completion for scw (http://scaleway.com) |
||||
# |
||||
# Inspired by https://github.com/felixr/docker-zsh-completion |
||||
|
||||
__scw_get_servers() { |
||||
local expl |
||||
declare -a servers |
||||
servers=(${(f)"$(_call_program commands scw _completion servers-names)"}) |
||||
_describe -t servers "servers" servers |
||||
} |
||||
|
||||
__scw_stoppedservers() { |
||||
__scw_get_servers |
||||
} |
||||
|
||||
__scw_runningservers() { |
||||
__scw_get_servers |
||||
} |
||||
|
||||
__scw_servers () { |
||||
__scw_get_servers |
||||
} |
||||
|
||||
__scw_images () { |
||||
local expl |
||||
declare -a images |
||||
images=(${(f)"$(_call_program commands scw _completion images-names)"}) |
||||
_describe -t images "images" images |
||||
} |
||||
|
||||
__scw_images_and_snapshots () { |
||||
__scw_images |
||||
__scw_snapshots |
||||
} |
||||
|
||||
__scw_snapshots () { |
||||
local expl |
||||
declare -a snapshots |
||||
snapshots=(${(f)"$(_call_program commands scw _completion --prefix snapshots-names)"}) |
||||
_describe -t snapshots "snapshots" snapshots |
||||
} |
||||
|
||||
__scw_bootscripts () { |
||||
local expl |
||||
declare -a bootscripts |
||||
bootscripts=(${(f)"$(_call_program commands scw _completion bootscripts-names)"}) |
||||
_describe -t bootscripts "bootscripts" bootscripts |
||||
} |
||||
|
||||
__scw_tags() { |
||||
__scw_images |
||||
} |
||||
|
||||
__scw_repositories_with_tags() { |
||||
__scw_images |
||||
} |
||||
|
||||
__scw_search() { |
||||
# declare -a scwsearch |
||||
local cache_policy |
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy |
||||
if [[ -z "$cache_policy" ]]; then |
||||
zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy |
||||
fi |
||||
|
||||
local searchterm cachename |
||||
searchterm="${words[$CURRENT]%/}" |
||||
cachename=_scw-search-$searchterm |
||||
|
||||
local expl |
||||
local -a result |
||||
if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \ |
||||
&& ! _retrieve_cache ${cachename#_}; then |
||||
_message "Searching for ${searchterm}..." |
||||
result=(${${${(f)"$(_call_program commands scw search ${searchterm})"}%% *}[2,-1]}) |
||||
_store_cache ${cachename#_} result |
||||
fi |
||||
_wanted scwsearch expl 'available images' compadd -a result |
||||
} |
||||
|
||||
__scw_caching_policy() |
||||
{ |
||||
oldp=( "$1"(Nmh+1) ) # 1 hour |
||||
(( $#oldp )) |
||||
} |
||||
|
||||
|
||||
__scw_repositories () { |
||||
__scw_images |
||||
} |
||||
|
||||
__scw_commands () { |
||||
# local -a _scw_subcommands |
||||
local cache_policy |
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy |
||||
if [[ -z "$cache_policy" ]]; then |
||||
zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy |
||||
fi |
||||
|
||||
if ( [[ ${+_scw_subcommands} -eq 0 ]] || _cache_invalid scw_subcommands) \ |
||||
&& ! _retrieve_cache scw_subcommands; |
||||
then |
||||
local -a lines |
||||
lines=(${(f)"$(_call_program commands scw 2>&1)"}) |
||||
_scw_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) |
||||
_scw_subcommands=($_scw_subcommands 'help:Show help for a command') |
||||
_store_cache scw_subcommands _scw_subcommands |
||||
fi |
||||
_describe -t scw-commands "scw command" _scw_subcommands |
||||
} |
||||
|
||||
__scw_subcommand () { |
||||
local -a _command_args |
||||
case "$words[1]" in |
||||
(attach) |
||||
_arguments \ |
||||
'--no-stdin[Do not attach stdin]' \ |
||||
':servers:__scw_runningservers' |
||||
;; |
||||
(commit) |
||||
_arguments \ |
||||
{-v,--volume=0}'[Volume slot]:volume: ' \ |
||||
':server:__scw_servers' \ |
||||
':repository:__scw_repositories_with_tags' |
||||
;; |
||||
(cp) |
||||
_arguments \ |
||||
':server:->server' \ |
||||
':hostpath:_files' |
||||
case $state in |
||||
(server) |
||||
if compset -P '*:'; then |
||||
_files |
||||
else |
||||
__scw_servers -qS ":" |
||||
fi |
||||
;; |
||||
esac |
||||
;; |
||||
(exec) |
||||
local state ret |
||||
_arguments \ |
||||
{-T,--timeout=0}'[Set timeout values to seconds]' \ |
||||
{-w,--wait}'[Wait for SSH to be ready]' \ |
||||
':servers:__scw_runningservers' \ |
||||
'*::command:->anycommand' && ret=0 |
||||
|
||||
case $state in |
||||
(anycommand) |
||||
shift 1 words |
||||
(( CURRENT-- )) |
||||
_normal |
||||
;; |
||||
esac |
||||
|
||||
return ret |
||||
;; |
||||
(history) |
||||
_arguments \ |
||||
'--no-trunc[Do not truncate output]' \ |
||||
{-q,--quiet}'[Only show numeric IDs]' \ |
||||
'*:images:__scw_images' |
||||
;; |
||||
(images) |
||||
_arguments \ |
||||
{-a,--all}'[Show all images]' \ |
||||
'--no-trunc[Do not truncate output]' \ |
||||
{-q,--quiet}'[Only show numeric IDs]' \ |
||||
':repository:__scw_repositories' |
||||
;; |
||||
(info) |
||||
;; |
||||
(inspect) |
||||
_arguments \ |
||||
{-f,--format=-}'[Format the output using the given go template]:template: ' \ |
||||
'*:servers:__scw_servers' |
||||
;; |
||||
(kill) |
||||
_arguments \ |
||||
'*:servers:__scw_runningservers' |
||||
;; |
||||
(login) |
||||
_arguments \ |
||||
{-o,--organization=-}'[Organization]:organization: ' \ |
||||
{-t,--token=-}'[Token]:token: ' \ |
||||
':server: ' |
||||
;; |
||||
(logout) |
||||
_arguments \ |
||||
':server: ' |
||||
;; |
||||
(logs) |
||||
_arguments \ |
||||
'*:servers:__scw_servers' |
||||
;; |
||||
(port) |
||||
_arguments \ |
||||
'1:servers:__scw_runningservers' \ |
||||
'2:port:_ports' |
||||
;; |
||||
(start) |
||||
_arguments \ |
||||
{-T,--timeout=0}'[Set timeout values to seconds]' \ |
||||
{-w,--wait}'[Wait for SSH to be ready]' \ |
||||
'*:servers:__scw_stoppedservers' |
||||
;; |
||||
(rm) |
||||
_arguments \ |
||||
'*:servers:__scw_stoppedservers' |
||||
;; |
||||
(rmi) |
||||
_arguments \ |
||||
'*:images:__scw_images' |
||||
;; |
||||
(restart) |
||||
_arguments \ |
||||
'*:servers:__scw_runningservers' |
||||
;; |
||||
(stop) |
||||
_arguments \ |
||||
{-t,--terminate}'[Stop and trash a server with its volumes]' \ |
||||
{-w,--wait}'[Synchronous stop. Wait for server to be stopped]' \ |
||||
'*:servers:__scw_runningservers' |
||||
;; |
||||
(top) |
||||
_arguments \ |
||||
'1:servers:__scw_runningservers' \ |
||||
'(-)*:: :->ps-arguments' |
||||
case $state in |
||||
(ps-arguments) |
||||
_ps |
||||
;; |
||||
esac |
||||
;; |
||||
(ps) |
||||
_arguments \ |
||||
{-a,--all}'[Show all servers. Only running servers are shown by default]' \ |
||||
{-l,--latest}'[Show only the latest created server]' \ |
||||
'-n[Show n last created servers, include non-running one]:n:(1 5 10 25 50)' \ |
||||
'--no-trunc[Do not truncate output]' \ |
||||
{-q,--quiet}'[Only show numeric IDs]' |
||||
;; |
||||
(tag) |
||||
_arguments \ |
||||
{-f,--force}'[force]'\ |
||||
':image:__scw_images'\ |
||||
':repository:__scw_repositories_with_tags' |
||||
;; |
||||
(create|run) |
||||
_arguments \ |
||||
{-a,--attach}'[Attach to stdin, stdout or stderr]' \ |
||||
'*'{-e,--environment=-}'[Set environment variables]:environment variable: ' \ |
||||
'--name=-[Server name]:name: ' \ |
||||
'--bootscript=-[Assign a bootscript]:bootscript:__scw_bootscripts ' \ |
||||
'*-v[Bind mount a volume]:volume: '\ |
||||
'(-):images:__scw_images_and_snapshots' \ |
||||
'(-):command: _command_names -e' \ |
||||
'*::arguments: _normal' |
||||
|
||||
case $state in |
||||
(link) |
||||
if compset -P '*:'; then |
||||
_wanted alias expl 'Alias' compadd -E "" |
||||
else |
||||
__scw_runningservers -qS ":" |
||||
fi |
||||
;; |
||||
esac |
||||
;; |
||||
(rename) |
||||
_arguments \ |
||||
':old name:__scw_servers' \ |
||||
':new name: ' |
||||
;; |
||||
(search) |
||||
_arguments \ |
||||
'--no-trunc[Do not truncate output]' \ |
||||
':term: ' |
||||
;; |
||||
(wait) |
||||
_arguments '*:servers:__scw_runningservers' |
||||
;; |
||||
(help) |
||||
_arguments ':subcommand:__scw_commands' |
||||
;; |
||||
(*) |
||||
_message 'Unknown sub command' |
||||
esac |
||||
|
||||
} |
||||
|
||||
_scw () { |
||||
# Support for subservices, which allows for `compdef _scw scw-shell=_scw_servers`. |
||||
# Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. |
||||
if [[ $service != scw ]]; then |
||||
_call_function - _$service |
||||
return |
||||
fi |
||||
|
||||
local curcontext="$curcontext" state line |
||||
typeset -A opt_args |
||||
|
||||
_arguments -C \ |
||||
'-H[tcp://host:port to bind/connect to]:socket: ' \ |
||||
'(-): :->command' \ |
||||
'(-)*:: :->option-or-argument' |
||||
|
||||
if (( CURRENT == 1 )); then |
||||
|
||||
fi |
||||
case $state in |
||||
(command) |
||||
__scw_commands |
||||
;; |
||||
(option-or-argument) |
||||
curcontext=${curcontext%:*:*}:scw-$words[1]: |
||||
__scw_subcommand |
||||
;; |
||||
esac |
||||
} |
||||
|
||||
_scw "$@" |
||||
|
||||
# Local Variables: |
||||
# mode: Shell-Script |
||||
# sh-indentation: 4 |
||||
# indent-tabs-mode: nil |
||||
# sh-basic-offset: 4 |
||||
# End: |
||||
# vim: ft=zsh sw=4 ts=4 et |
||||
@ -0,0 +1,37 @@ |
||||
function _stack_commands() { |
||||
local ret=1 state |
||||
_arguments ':subcommand:->subcommand' && ret=0 |
||||
|
||||
case $state in |
||||
subcommand) |
||||
subcommands=( |
||||
"build:Build the project(s) in this directory/configuration" |
||||
"install:Build executables and install to a user path" |
||||
"test:Build and test the project(s) in this directory/configuration" |
||||
"bench:Build and benchmark the project(s) in this directory/configuration" |
||||
"haddock:Generate haddocks for the project(s) in this directory/configuration" |
||||
"new:Create a brand new project" |
||||
"init:Initialize a stack project based on one or more stack packages" |
||||
"solver:Use a dependency solver to try and determine missing extra-deps" |
||||
"setup:Get the appropriate ghc for your project" |
||||
"path:Print out handy path information" |
||||
"unpack:Unpack one or more packages locally" |
||||
"update:Update the package index" |
||||
"upgrade:Upgrade to the latest stack (experimental)" |
||||
"upload:Upload a package to Hackage" |
||||
"dot:Visualize your project's dependency graph using Graphviz dot" |
||||
"exec:Execute a command" |
||||
"ghc:Run ghc" |
||||
"ghci:Run ghci in the context of project(s)" |
||||
"ide:Run ide-backend-client with the correct arguments" |
||||
"runghc:Run runghc" |
||||
"clean:Clean the local packages" |
||||
"docker:Subcommands specific to Docker use" |
||||
) |
||||
_describe -t subcommands 'stack subcommands' subcommands && ret=0 |
||||
esac |
||||
|
||||
return ret |
||||
} |
||||
|
||||
compdef _stack_commands stack |
||||
@ -0,0 +1,13 @@ |
||||
# taskwarrior |
||||
|
||||
This plugin adds smart tab completion for [TaskWarrior](http://taskwarrior.org/). |
||||
It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the |
||||
completion definitions. |
||||
|
||||
The latest version pulled in from the official project is of January 1st, 2015. |
||||
|
||||
|
||||
## Examples |
||||
|
||||
Typing `task [TAB]` will give you a list of commands, `task 66[TAB]` shows a |
||||
list of available modifications for that task, etcetera. |
||||
@ -1,39 +1,6 @@ |
||||
# Set Apple Terminal.app resume directory |
||||
# based on this answer: http://superuser.com/a/315029 |
||||
# 2012-10-26: (javageek) Changed code using the updated answer |
||||
|
||||
# Tell the terminal about the working directory whenever it changes. |
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then |
||||
update_terminal_cwd() { |
||||
# Identify the directory using a "file:" scheme URL, including |
||||
# the host name to disambiguate local vs. remote paths. |
||||
|
||||
# Percent-encode the pathname. |
||||
local URL_PATH='' |
||||
{ |
||||
# Use LANG=C to process text byte-by-byte. |
||||
local i ch hexch LANG=C |
||||
for ((i = 1; i <= ${#PWD}; ++i)); do |
||||
ch="$PWD[i]" |
||||
if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then |
||||
URL_PATH+="$ch" |
||||
else |
||||
hexch=$(printf "%02X" "'$ch") |
||||
URL_PATH+="%$hexch" |
||||
fi |
||||
done |
||||
} |
||||
|
||||
local PWD_URL="file://$HOST$URL_PATH" |
||||
#echo "$PWD_URL" # testing |
||||
printf '\e]7;%s\a' "$PWD_URL" |
||||
} |
||||
|
||||
# Register the function so it is called whenever the working |
||||
# directory changes. |
||||
autoload add-zsh-hook |
||||
add-zsh-hook precmd update_terminal_cwd |
||||
|
||||
# Tell the terminal about the initial directory. |
||||
update_terminal_cwd |
||||
fi |
||||
# This file is intentionally empty. |
||||
# |
||||
# The terminalapp plugin is deprecated and may be removed in a future release. |
||||
# Its functionality has been folded in to the core lib/termsupport.zsh, which |
||||
# is loaded for all users. You can remove terminalapp from your $plugins list |
||||
# once all your systems are updated to the current version of Oh My Zsh. |
||||
|
||||
@ -0,0 +1,84 @@ |
||||
# Xcode |
||||
|
||||
## Description |
||||
|
||||
This plugin provides a few utilities that can help you on your daily use of Xcode and iOS development. |
||||
|
||||
To start using it, add the `xcode` plugin to your `plugins` array in `~/.zshrc`: |
||||
|
||||
```zsh |
||||
plugins=(... xcode) |
||||
``` |
||||
|
||||
|
||||
## Aliases |
||||
|
||||
| Alias | Description | Command | |
||||
|-------|------------------------------------------|------------------------------------------------| |
||||
| xcb | Build Xcode projects and workspaces | xcodebuild | |
||||
| xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
||||
| xcp | Show currently selected Xcode directory | xcode-select --print-path | |
||||
| xcsel | Select different Xcode directory by path | sudo xcode-select --switch | |
||||
|
||||
|
||||
|
||||
## Functions |
||||
|
||||
### `xc` |
||||
|
||||
Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. |
||||
Returns 1 if it didn't find any relevant files. |
||||
|
||||
### `simulator` |
||||
|
||||
Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.) |
||||
|
||||
### `xcselv` |
||||
|
||||
Selects different Xcode installations by version name. This is like `xcsel`, except it takes just a version name as an argument instead of the full path to the Xcode installation. Uses the naming conventions described below. |
||||
|
||||
* `xcselv <version>` selects a version |
||||
* Example: `xcselv 6.2` |
||||
* `xcselv default` selects the default unversioned `Applications/Xcode.app` |
||||
* `xcselv` with no argument lists the available Xcode versions in a human-readable format |
||||
* `xcselv -l` lists the installed Xcode versions |
||||
* `xcselv -L` lists the installed Xcode versions in a short version-name-only format |
||||
* `xcselv -p` prints info about the active Xcode version |
||||
* `xcselv -h` prints a help message |
||||
|
||||
The option parsing for `xcselv` is naive. Options may not be combined, and only the first option is recognized. |
||||
|
||||
## Multiple Xcode Versions |
||||
|
||||
The `xcselv` command provides support for switching between different Xcode installations using just a version number. Different Xcode versions are identified by file naming conventions. |
||||
|
||||
### Versioned Xcode Naming Conventions |
||||
|
||||
Apple does not seem to explicitly define or provide tooling support for a naming convention or other organizational mechanism for managing versioned Xcode installations. Apple seems to have released beta versions with both `Xcode<version>.app` and `Xcode-<version>.app` style names in the past, and both styles show up in forum and blog discussions. |
||||
|
||||
We've adopted the following naming convention: |
||||
|
||||
* Versioned Xcode installations are identified by the name `Xcode-<version>` or `Xcode<version>`. |
||||
* The `-` separating `"Xcode"` and the version name is optional, and may be replaced by a space. |
||||
* The versioned name may be applied to the `Xcode.app` itself, or a subdirectory underneath `Applications/` containing it. |
||||
* You cannot version both the `Xcode.app` filename itself and the containing subfolder. |
||||
* Thus, all of the following are equivalent. |
||||
* `Applications/Xcode-<version>.app` |
||||
* `Applications/Xcode-<version>/Xcode.app` |
||||
* `Applications/Xcode<version>.app` |
||||
* `Applications/Xcode <version>.app` |
||||
* `Applications/Xcode <version>/Xcode.app` |
||||
* Both the system `/Applications/` and user `$HOME/Applications/` directories are searched. |
||||
* The user's `$HOME/Applications/` takes precedence over `/Applications` for a given version. |
||||
* If multiple naming variants within the same `Applications/` folder indicate the same version (for example, `Xcode-3.2.1.app`, `Xcode3.2.1.app`, and `Xcode-3.2.1/Xcode.app`), the precedence order is unspecified and implementation-dependent. |
||||
* The `<version>` may be any string that is valid in a filename. |
||||
* The special version name `"default"` refers to the "default" unversioned Xcode at `Applications/Xcode.app` (in either `/Applications/` or `$HOME/Applications/`). |
||||
* Version names may not start with ``"-"`` or whitespace. |
||||
|
||||
The restrictions on the naming convention may need to be tightened in the future. In particular, if there are other well-known applications whose names begin with the string `"Xcode"`, the strings allowed for `<version>` may need to be restricted to avoid colliding with other applications. If there's evidence that one of these naming techniques is strongly favored either in practice or by Apple, we may tighten the naming convention to favor it. |
||||
|
||||
## Caveats |
||||
|
||||
Using `xcsel` or `xcselv` to select an Xcode that is installed under your `$HOME` may break things for other users, depending on your system setup. We let you do this anyway because some people run OS X as effectively single-user, or have open permissions so this will work. You could also use `$DEVELOPER_DIR` as an alternative to `xcsel` that is scoped to the current user or session, instead of a global setting. |
||||
|
||||
This does not verify that the version name in the Xcode filename matches the actual version of that binary. It is the user's responsibility to get the names right. |
||||
@ -0,0 +1,19 @@ |
||||
#compdef xcselv |
||||
#autoload |
||||
|
||||
function _xcselv_compl_list_versions() { |
||||
_omz_xcode_list_versions short |
||||
} |
||||
|
||||
_arguments \ |
||||
'(-l -L -p)-h[prints a help message]' \ |
||||
'(-L -p -h)-l[lists installed Xcode versions]' \ |
||||
'(-l -p -h)-L[lists installed Xcode versions (long form)]' \ |
||||
'(-h -l -L)-p[prints active Xcode version]' \ |
||||
&& ret=0 |
||||
|
||||
local _xcode_versions |
||||
_xcode_versions=($(_xcselv_compl_list_versions)) |
||||
_describe -t _xcode_versions 'version' _xcode_versions |
||||
|
||||
return 1 |
||||
@ -1,25 +1,185 @@ |
||||
#xc function courtesy of http://gist.github.com/subdigital/5420709 |
||||
alias xcb='xcodebuild' |
||||
alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*' |
||||
alias xcp='xcode-select --print-path' |
||||
alias xcsel='sudo xcode-select --switch' |
||||
|
||||
# original author: @subdigital |
||||
# source: http://gist.github.com/subdigital/5420709 |
||||
function xc { |
||||
xcode_proj=`ls | grep "\.xc" | sort -r | head -1` |
||||
if [[ `echo -n $xcode_proj | wc -m` == 0 ]] |
||||
then |
||||
local xcode_proj |
||||
xcode_proj=(*.{xcworkspace,xcodeproj}(N)) |
||||
|
||||
if [[ ${#xcode_proj} -eq 0 ]]; then |
||||
echo "No xcworkspace/xcodeproj file found in the current directory." |
||||
return 1 |
||||
else |
||||
echo "Found $xcode_proj" |
||||
open "$xcode_proj" |
||||
echo "Found ${xcode_proj[1]}" |
||||
open "${xcode_proj[1]}" |
||||
fi |
||||
} |
||||
|
||||
function xcsel { |
||||
sudo xcode-select --switch "$*" |
||||
# "XCode-SELect by Version" - select Xcode by just version number |
||||
# Uses naming convention: |
||||
# - different versions of Xcode are named Xcode-<version>.app or stored |
||||
# in a folder named Xcode-<version> |
||||
# - the special version name "default" refers to the "default" Xcode.app with no suffix |
||||
function xcselv { |
||||
emulate -L zsh |
||||
if [[ $# == 0 ]]; then |
||||
echo "xcselv: error: no option or argument given" >&2 |
||||
echo "xcselv: see 'xcselv -h' for help" >&2 |
||||
return 1 |
||||
elif [[ $1 == "-p" ]]; then |
||||
_omz_xcode_print_active_version |
||||
return |
||||
elif [[ $1 == "-l" ]]; then |
||||
_omz_xcode_list_versions |
||||
return |
||||
elif [[ $1 == "-L" ]]; then |
||||
_omz_xcode_list_versions short |
||||
return |
||||
elif [[ $1 == "-h" ]]; then |
||||
_omz_xcode_print_xcselv_usage |
||||
return 0 |
||||
elif [[ $1 == -* && $1 != "-" ]]; then |
||||
echo "xcselv: error: unrecognized option: $1" >&2 |
||||
echo "xcselv: see 'xcselv -h' for help" >&2 |
||||
return 1 |
||||
fi |
||||
# Main case: "xcselv <version>" to select a version |
||||
local version=$1 |
||||
local -A xcode_versions |
||||
_omz_xcode_locate_versions |
||||
if [[ -z ${xcode_versions[$version]} ]]; then |
||||
echo "xcselv: error: Xcode version '$version' not found" >&2 |
||||
return 1 |
||||
fi |
||||
app="${xcode_versions[$version]}" |
||||
echo "selecting Xcode $version: $app" |
||||
xcsel "$app" |
||||
} |
||||
|
||||
alias xcb='xcodebuild' |
||||
alias xcp='xcode-select --print-path' |
||||
alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*' |
||||
function _omz_xcode_print_xcselv_usage { |
||||
cat << EOF >&2 |
||||
Usage: |
||||
xcselv <version> |
||||
xcselv [options] |
||||
|
||||
Options: |
||||
<version> set the active Xcode version |
||||
-h print this help message and exit |
||||
-p print the active Xcode version |
||||
-l list installed Xcode versions (long human-readable form) |
||||
-L list installed Xcode versions (short form, version names only) |
||||
EOF |
||||
} |
||||
|
||||
# Parses the Xcode version from a filename based on our conventions |
||||
# Only meaningful when called from other _omz_xcode functions |
||||
function _omz_xcode_parse_versioned_file { |
||||
local file=$1 |
||||
local basename=${app:t} |
||||
local dir=${app:h} |
||||
local parent=${dir:t} |
||||
#echo "parent=$parent basename=$basename verstr=$verstr ver=$ver" >&2 |
||||
local verstr |
||||
if [[ $parent == Xcode* ]]; then |
||||
if [[ $basename == "Xcode.app" ]]; then |
||||
# "Xcode-<version>/Xcode.app" format |
||||
verstr=$parent |
||||
else |
||||
# Both file and parent dir are versioned. Reject. |
||||
return 1; |
||||
fi |
||||
elif [[ $basename == Xcode*.app ]]; then |
||||
# "Xcode-<version>.app" format |
||||
verstr=${basename:r} |
||||
else |
||||
# Invalid naming pattern |
||||
return 1; |
||||
fi |
||||
|
||||
if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then |
||||
alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app' |
||||
else |
||||
alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app' |
||||
fi |
||||
local ver=${verstr#Xcode} |
||||
ver=${ver#[- ]} |
||||
if [[ -z $ver ]]; then |
||||
# Unversioned "default" installation location |
||||
ver="default" |
||||
fi |
||||
print -- "$ver" |
||||
} |
||||
|
||||
# Print the active version, using xcselv's notion of versions |
||||
function _omz_xcode_print_active_version { |
||||
emulate -L zsh |
||||
local -A xcode_versions |
||||
local versions version active_path |
||||
_omz_xcode_locate_versions |
||||
active_path=$(xcode-select -p) |
||||
active_path=${active_path%%/Contents/Developer*} |
||||
versions=(${(kni)xcode_versions}) |
||||
for version ($versions); do |
||||
if [[ "${xcode_versions[$version]}" == $active_path ]]; then |
||||
printf "%s (%s)\n" $version $active_path |
||||
return |
||||
fi |
||||
done |
||||
printf "%s (%s)\n" "<unknown>" $active_path |
||||
} |
||||
|
||||
# Locates all the installed versions of Xcode on this system, for this |
||||
# plugin's internal use. |
||||
# Populates the $xcode_versions associative array variable |
||||
# Caller should local-ize $xcode_versions with `local -A xcode_versions` |
||||
function _omz_xcode_locate_versions { |
||||
emulate -L zsh |
||||
local -a app_dirs |
||||
local app_dir apps app xcode_ver |
||||
# In increasing precedence order: |
||||
app_dirs=(/Applications $HOME/Applications) |
||||
for app_dir ($app_dirs); do |
||||
apps=( $app_dir/Xcode*.app(N) $app_dir/Xcode*/Xcode.app(N) ) |
||||
for app ($apps); do |
||||
xcode_ver=$(_omz_xcode_parse_versioned_file $app) |
||||
if [[ $? != 0 ]]; then |
||||
continue |
||||
fi |
||||
xcode_versions[$xcode_ver]=$app |
||||
done |
||||
done |
||||
} |
||||
|
||||
function _omz_xcode_list_versions { |
||||
emulate -L zsh |
||||
local -A xcode_versions |
||||
_omz_xcode_locate_versions |
||||
local width=1 width_i versions do_short=0 |
||||
if [[ $1 == "short" ]]; then |
||||
do_short=1 |
||||
fi |
||||
versions=(${(kni)xcode_versions}) |
||||
for version ($versions); do |
||||
if [[ $#version > $width ]]; then |
||||
width=$#version; |
||||
fi |
||||
done |
||||
for version ($versions); do |
||||
if [[ $do_short == 1 ]]; then |
||||
printf "%s\n" $version |
||||
else |
||||
printf "%-${width}s -> %s\n" "$version" "${xcode_versions[$version]}" |
||||
fi |
||||
done |
||||
} |
||||
|
||||
function simulator { |
||||
local devfolder |
||||
devfolder="$(xcode-select -p)" |
||||
|
||||
# Xcode ≤ 5.x |
||||
if [[ -d "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" ]]; then |
||||
open "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" |
||||
# Xcode ≥ 6.x |
||||
else |
||||
open "${devfolder}/Applications/iOS Simulator.app" |
||||
fi |
||||
} |
||||
|
||||
@ -1,4 +1,4 @@ |
||||
# Based on evan's prompt |
||||
# Shows the exit status of the last command if non-zero |
||||
# Uses "#" instead of "»" when running with elevated privileges |
||||
PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . ${fg[red]}%? )%{${fg[blue]}%}»%{${reset_color}%} " |
||||
PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . %{${fg[red]}%}%? )%{${fg[blue]}%}»%{${reset_color}%} " |
||||
|
||||
@ -1,53 +1,50 @@ |
||||
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png |
||||
# Based on bira theme |
||||
|
||||
# load some modules |
||||
autoload -U zsh/terminfo # Used in the colour alias below |
||||
setopt prompt_subst |
||||
|
||||
# make some aliases for the colours: (could use normal escape sequences too) |
||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do |
||||
eval PR_$color='%{$fg[${(L)color}]%}' |
||||
done |
||||
eval PR_NO_COLOR="%{$terminfo[sgr0]%}" |
||||
eval PR_BOLD="%{$terminfo[bold]%}" |
||||
() { |
||||
|
||||
local PR_USER PR_USER_OP PR_PROMPT PR_HOST |
||||
|
||||
# Check the UID |
||||
if [[ $UID -ne 0 ]]; then # normal user |
||||
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}' |
||||
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}' |
||||
local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR' |
||||
PR_USER='%F{green}%n%f' |
||||
PR_USER_OP='%F{green}%#%f' |
||||
PR_PROMPT='%f➤ %f' |
||||
else # root |
||||
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}' |
||||
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}' |
||||
local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR' |
||||
PR_USER='%F{red}%n%f' |
||||
PR_USER_OP='%F{red}%#%f' |
||||
PR_PROMPT='%F{red}➤ %f' |
||||
fi |
||||
|
||||
# Check if we are on SSH or not |
||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then |
||||
eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH |
||||
PR_HOST='%F{red}%M%f' # SSH |
||||
else |
||||
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH |
||||
PR_HOST='%F{green}%M%f' # no SSH |
||||
fi |
||||
|
||||
local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})" |
||||
|
||||
local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}' |
||||
local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}' |
||||
local return_code="%(?..%F{red}%? ↵%f)" |
||||
|
||||
local user_host="${PR_USER}%F{cyan}@${PR_HOST}" |
||||
local current_dir="%B%F{blue}%~%f%b" |
||||
local rvm_ruby='' |
||||
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect local user rvm installation |
||||
rvm_ruby='%{$PR_RED%}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%{$PR_NO_COLOR%}' |
||||
elif which rvm-prompt &> /dev/null; then # detect sysem-wide rvm installation |
||||
rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}' |
||||
elif which rbenv &> /dev/null; then # detect Simple Ruby Version management |
||||
rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}' |
||||
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation |
||||
rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f' |
||||
elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation |
||||
rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f' |
||||
elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management |
||||
rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f' |
||||
fi |
||||
local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}' |
||||
local git_branch='$(git_prompt_info)' |
||||
|
||||
#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT " |
||||
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} |
||||
╰─$PR_PROMPT " |
||||
RPS1="${return_code}" |
||||
RPROMPT="${return_code}" |
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f" |
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}" |
||||
} |
||||
|
||||
@ -1,16 +1,37 @@ |
||||
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" |
||||
|
||||
# Use colors, but only if connected to a terminal, and that terminal |
||||
# supports them. |
||||
ncolors=$(tput colors) |
||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then |
||||
RED="$(tput setaf 1)" |
||||
GREEN="$(tput setaf 2)" |
||||
YELLOW="$(tput setaf 3)" |
||||
BLUE="$(tput setaf 4)" |
||||
BOLD="$(tput bold)" |
||||
NORMAL="$(tput sgr0)" |
||||
else |
||||
RED="" |
||||
GREEN="" |
||||
YELLOW="" |
||||
BLUE="" |
||||
BOLD="" |
||||
NORMAL="" |
||||
fi |
||||
|
||||
printf "${BLUE}%s${NORMAL}\n" "Upgrading Oh My Zsh" |
||||
cd "$ZSH" |
||||
if git pull --rebase --stat origin master |
||||
then |
||||
printf '\033[0;32m%s\033[0m\n' ' __ __ ' |
||||
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' |
||||
printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' |
||||
printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' |
||||
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' |
||||
printf '\033[0;32m%s\033[0m\n' ' /____/ ' |
||||
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' |
||||
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest news and updates, follow us on twitter: ' 'https://twitter.com/ohmyzsh' |
||||
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'Get your Oh My Zsh swag at: ' 'http://shop.planetargon.com/' |
||||
printf '%s' "$GREEN" |
||||
printf '%s\n' ' __ __ ' |
||||
printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' |
||||
printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' |
||||
printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' |
||||
printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' |
||||
printf '%s\n' ' /____/ ' |
||||
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." |
||||
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" |
||||
printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: http://shop.planetargon.com/" |
||||
else |
||||
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' |
||||
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' |
||||
fi |
||||
|
||||
Loading…
Reference in new issue