update zsh

This commit is contained in:
vincent 2020-02-02 16:08:42 +01:00
parent 7b9b0e4510
commit 958d14152d
41 changed files with 448 additions and 390 deletions

View File

@ -1,4 +1,4 @@
SERVICES=("syncthing@vincent" "named" "mariadb" "nginx" "php-fpm" "gitea" "tt-rss" "named" "gunicorn-chainetv.socket" "gunicorn-supysonic" "rsyncd.service" "fail2ban") SERVICES=("syncthing@vincent" "named" "mariadb" "nginx" "php-fpm" "gitea" "tt-rss" "named" "gunicorn-chainetv.socket" "gunicorn-supysonic" "rsyncd.service" "fail2ban" "supysonic-daemon" "home-assistant" "radicale")
HOST=$(hostname) HOST=$(hostname)
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[0;32m' GREEN='\033[0;32m'

View File

@ -44,4 +44,10 @@
# VisualHostKey no # VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com # ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h # RekeyLimit 1G 1h
Host git.ducamps.win
HostName git.ducamps.win
User gitea
IdentityFile ~/.ssh/id_gitea
Host oscar
HostName oscar
User vincent

View File

@ -5,3 +5,4 @@ custom/
cache/ cache/
log/ log/
*.swp *.swp
.DS_Store

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2009-2019 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors) Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -2,9 +2,6 @@
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p> </p>
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/bpXWhnN)
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration. Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
Sounds boring. Let's try again. Sounds boring. Let's try again.
@ -15,7 +12,11 @@ Once installed, your terminal shell will become the talk of the town _or your mo
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬 Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord.
![Check Suite](https://github.com/ohmyzsh/ohmyzsh/workflows/Check%20Suite/badge.svg)
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/bpXWhnN)
## Getting Started ## Getting Started

View File

@ -24,7 +24,7 @@ function clipcopy() {
else else
cat $file | pbcopy cat $file | pbcopy
fi fi
elif [[ $OSTYPE == cygwin* ]]; then elif [[ $OSTYPE == (cygwin|msys)* ]]; then
if [[ -z $file ]]; then if [[ -z $file ]]; then
cat > /dev/clipboard cat > /dev/clipboard
else else
@ -71,7 +71,7 @@ function clippaste() {
emulate -L zsh emulate -L zsh
if [[ $OSTYPE == darwin* ]]; then if [[ $OSTYPE == darwin* ]]; then
pbpaste pbpaste
elif [[ $OSTYPE == cygwin* ]]; then elif [[ $OSTYPE == (cygwin|msys)* ]]; then
cat /dev/clipboard cat /dev/clipboard
else else
if (( $+commands[xclip] )); then if (( $+commands[xclip] )); then

View File

@ -32,8 +32,8 @@ fi
is_plugin() { is_plugin() {
local base_dir=$1 local base_dir=$1
local name=$2 local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \ builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name || builtin test -f $base_dir/plugins/$name/_$name
} }
# Add all defined plugins to fpath. This must be done # Add all defined plugins to fpath. This must be done

View File

@ -10,7 +10,8 @@ function asp() {
return return
fi fi
local available_profiles=($(aws_profiles)) local -a available_profiles
available_profiles=($(aws_profiles))
if [[ -z "${available_profiles[(r)$1]}" ]]; then if [[ -z "${available_profiles[(r)$1]}" ]]; then
echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2 echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2 echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2

View File

@ -17,7 +17,7 @@ EOF
fi fi
function colored() { function colored() {
env \ command env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \ LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \ LESS_TERMCAP_me=$(printf "\e[0m") \

View File

@ -17,10 +17,10 @@ plugins=(... colorize)
### Requirements ### Requirements
This plugin requires that either of the following tools be installed: This plugin requires that at least one of the following tools is installed:
* Chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) * [Chroma](https://github.com/alecthomas/chroma)
* Pygments be installed: [pygments.org](https://pygments.org/) * [Pygments](https://pygments.org/download/)
### Colorize tool ### Colorize tool
@ -41,12 +41,8 @@ ZSH_COLORIZE_STYLE="colorful"
## Usage ## Usage
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided). * `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
If no arguments are passed it will colorize the standard input or stdin. If no files are passed it will colorize the standard input.
* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and * `cless [less-options] <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
open less. If no arguments are passed it will colorize the standard input or stdin. If no files are passed it will colorize the standard input.
The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope.
Note that `cless` will behave as less when provided more than one file: you have to navigate files with
the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
In the latter form, the file contents will be concatenated and presented by less as a single file.

View File

@ -1,8 +1,11 @@
# easier alias to use the plugin # Easier alias to use the plugin
alias ccat='colorize_via_pygmentize' alias ccat="colorize_cat"
alias cless='colorize_via_pygmentize_less' alias cless="colorize_less"
colorize_via_pygmentize() { # '$0:A' gets the absolute path of this file
ZSH_COLORIZE_PLUGIN_PATH=$0:A
colorize_check_requirements() {
local available_tools=("chroma" "pygmentize") local available_tools=("chroma" "pygmentize")
if [ -z "$ZSH_COLORIZE_TOOL" ]; then if [ -z "$ZSH_COLORIZE_TOOL" ]; then
@ -23,6 +26,12 @@ colorize_via_pygmentize() {
echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2 echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
return 1 return 1
fi fi
}
colorize_cat() {
if ! colorize_check_requirements; then
return 1
fi
# If the environment variable ZSH_COLORIZE_STYLE # If the environment variable ZSH_COLORIZE_STYLE
# is set, use that theme instead. Otherwise, # is set, use that theme instead. Otherwise,
@ -32,7 +41,7 @@ colorize_via_pygmentize() {
ZSH_COLORIZE_STYLE="emacs" ZSH_COLORIZE_STYLE="emacs"
fi fi
# pygmentize stdin if no arguments passed # Use stdin if no arguments have been passed.
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
@ -42,12 +51,9 @@ colorize_via_pygmentize() {
return $? return $?
fi fi
# guess lexer from file extension, or # Guess lexer from file extension, or guess it from file contents if unsuccessful.
# guess it from file contents if unsuccessful
local FNAME lexer local FNAME lexer
for FNAME in "$@" for FNAME in "$@"; do
do
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
lexer=$(pygmentize -N "$FNAME") lexer=$(pygmentize -N "$FNAME")
if [[ $lexer != text ]]; then if [[ $lexer != text ]]; then
@ -61,22 +67,47 @@ colorize_via_pygmentize() {
done done
} }
colorize_via_pygmentize_less() ( # The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
# this function is a subshell so tmp_files can be shared to cleanup function # caused by the lack of the ability to follow the file within pygmentize.
declare -a tmp_files colorize_less() {
if ! colorize_check_requirements; then
return 1
fi
cleanup () { _cless() {
[[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}" # LESS="-R $LESS" enables raw ANSI colors, while maintain already set options.
exit local LESS="-R $LESS"
# This variable tells less to pipe every file through the specified command
# (see the man page of less INPUT PREPROCESSOR).
# 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like
# the ~/.zsh_history. For such files the tty of the preprocessor will be supended.
# Therefore we must source this file to make colorize_cat available in the
# preprocessor without the interactive mode.
# `2>/dev/null` will suppress the error for large files 'broken pipe' of the python
# script pygmentize, which will show up if less has not fully "loaded the file"
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
colorize_cat %s 2> /dev/null'"
# LESSCLOSE will be set to prevent any errors by executing a user script
# which assumes that his LESSOPEN has been executed.
local LESSCLOSE=""
LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" less "$@"
} }
trap 'cleanup' EXIT HUP TERM INT
while (( $# != 0 )); do #TODO: filter out less opts if [ -t 0 ]; then
tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")" _cless "$@"
tmp_files+=("$tmp_file") else
colorize_via_pygmentize "$1" > "$tmp_file" # The input is not associated with a terminal, therefore colorize_cat will
shift 1 # colorize this input and pass it to less.
done # Less has now to decide what to use. If any files have been provided, less
# will ignore the input by default, otherwise the colorized input will be used.
less -f "${tmp_files[@]}" # If files have been supplied and the input has been redirected, this will
) # lead to unnecessary overhead, but retains the ability to use the less options
# without checking for them inside this script.
colorize_cat | _cless "$@"
fi
}

View File

@ -25,6 +25,8 @@ plugins=(... extract)
| `gz` | Gzip file | | `gz` | Gzip file |
| `ipsw` | iOS firmware file | | `ipsw` | iOS firmware file |
| `jar` | Java Archive | | `jar` | Java Archive |
| `lrz` | LRZ archive |
| `lz4` | LZ4 archive |
| `lzma` | LZMA archive | | `lzma` | LZMA archive |
| `rar` | WinRAR archive | | `rar` | WinRAR archive |
| `rpm` | RPM package | | `rpm` | RPM package |
@ -32,7 +34,9 @@ plugins=(... extract)
| `tar` | Tarball | | `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression | | `tar.bz2` | Tarball with bzip2 compression |
| `tar.gz` | Tarball with gzip compression | | `tar.gz` | Tarball with gzip compression |
| `tar.lrz` | Tarball with lrzip compression |
| `tar.lz` | Tarball with lzip compression | | `tar.lz` | Tarball with lzip compression |
| `tar.lz4` | Tarball with lz4 compression |
| `tar.xz` | Tarball with lzma2 compression | | `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression | | `tar.zma` | Tarball with lzma compression |
| `tar.zst` | Tarball with zstd compression | | `tar.zst` | Tarball with zstd compression |

View File

@ -3,5 +3,5 @@
_arguments \ _arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lz|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0 && return 0

View File

@ -46,9 +46,13 @@ extract() {
|| zstdcat "$1" | tar xvf - ;; || zstdcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;; (*.tar) tar xvf "$1" ;;
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;; (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
(*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;; (*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;; (*.xz) unxz "$1" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
(*.lz4) lz4 -d "$1" ;;
(*.lzma) unlzma "$1" ;; (*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;; (*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;

View File

@ -1,13 +1,3 @@
################################################################################
# FILE: fastfile.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Michael Varner (musikmichael@web.de)
# VERSION: 1.0.0
#
# This plugin adds the ability to on the fly generate and access file shortcuts.
#
################################################################################
########################### ###########################
# Settings # Settings
@ -51,7 +41,7 @@ function fastfile() {
# Arguments: # Arguments:
# 1. name - The name of the shortcut # 1. name - The name of the shortcut
# STDOUT: # STDOUT:
# The path # The path to the shortcut file
# #
function fastfile_resolv() { function fastfile_resolv() {
echo "${fastfile_dir}${1}" echo "${fastfile_dir}${1}"
@ -102,7 +92,6 @@ function fastfile_ls() {
# #
# Arguments: # Arguments:
# 1. name - The name of the shortcut (default: name of the file) # 1. name - The name of the shortcut (default: name of the file)
# 2. file - The file or directory to make the shortcut for
# STDOUT: # STDOUT:
# => fastfle_print # => fastfle_print
# #

View File

@ -1,22 +0,0 @@
# FirewallD Plugin
This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
```zsh
plugins=(... firewalld)
```
## Aliases
| Alias | Command | Description |
| :---- | :----------------------------------------- | :--------------------------- |
| fw | `sudo firewall-cmd` | Shorthand |
| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
## Functions
| Function | Description |
| :------- | :--------------------------------------------------------- |
| fwl | Lists configuration from all active zones and direct rules |

View File

@ -1,3 +0,0 @@
# if there is a user named 'glassfish' on the system, we'll assume
# that is the user asadmin should be run as
# grep -e '^glassfish' /etc/passwd > /dev/null && alias asadmin='sudo -u glassfish asadmin'

View File

@ -5,8 +5,11 @@
# VERSION: 1.0.0 # VERSION: 1.0.0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Detect if GNU coreutils are installed by looking for gwhoami
if [[ ! -x "${commands[gwhoami]}" ]]; then
return
fi
if [[ -x "${commands[gwhoami]}" ]]; then
__gnu_utils() { __gnu_utils() {
emulate -L zsh emulate -L zsh
local gcmds local gcmds
@ -36,31 +39,29 @@ if [[ -x "${commands[gwhoami]}" ]]; then
gcmds+=('gsed' 'gtar' 'gtime') gcmds+=('gsed' 'gtar' 'gtime')
for gcmd in "${gcmds[@]}"; do for gcmd in "${gcmds[@]}"; do
# # Do nothing if the command isn't found
(( ${+commands[$gcmd]} )) || continue
# This method allows for builtin commands to be primary but it's # This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash -f is executed. Thus, those two # lost if hash -r or rehash -f is executed. Thus, those two
# functions have to be wrapped. # functions have to be wrapped.
# #
(( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]} hash ${gcmd[2,-1]}=${commands[$gcmd]}
#
# This method generates wrapper functions. # This method generates wrapper functions.
# It will override shell builtins. # It will override shell builtins.
# #
# (( ${+commands[$gcmd]} )) && \
# eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }" # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
#
# This method is inflexible since the aliases are at risk of being # This method is inflexible since the aliases are at risk of being
# overridden resulting in the BSD coreutils being called. # overridden resulting in the BSD coreutils being called.
# #
# (( ${+commands[$gcmd]} )) && \
# alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}" # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
done done
return 0 return 0
} }
__gnu_utils; __gnu_utils
function hash() { function hash() {
if [[ "$*" =~ "-(r|f)" ]]; then if [[ "$*" =~ "-(r|f)" ]]; then
@ -79,5 +80,4 @@ if [[ -x "${commands[gwhoami]}" ]]; then
builtin rehash "$@" builtin rehash "$@"
fi fi
} }
fi

View File

@ -38,7 +38,7 @@ _knife() {
;; ;;
knifesubcmd) knifesubcmd)
case $words[2] in case $words[2] in
(bluebox|ec2|rackspace|slicehost|terremark) bluebox|ec2|rackspace|slicehost|terremark)
compadd "$@" server images compadd "$@" server images
;; ;;
client) client)
@ -76,6 +76,7 @@ _knife() {
;; ;;
*) *)
_arguments '2:Subsubcommands:($(_knife_options1))' _arguments '2:Subsubcommands:($(_knife_options1))'
;;
esac esac
;; ;;
knifesubcmd2) knifesubcmd2)
@ -89,10 +90,10 @@ _knife() {
site) site)
compadd "$@" vendor show share search download list unshare compadd "$@" vendor show share search download list unshare
;; ;;
(show|delete|edit) show|delete|edit)
_arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
;; ;;
(upload|test) upload|test)
_arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
;; ;;
list) list)
@ -103,6 +104,7 @@ _knife() {
;; ;;
*) *)
_arguments '3:Subsubcommands:($(_knife_options2))' _arguments '3:Subsubcommands:($(_knife_options2))'
;;
esac esac
;; ;;
knifesubcmd3) knifesubcmd3)
@ -113,12 +115,14 @@ _knife() {
versioncomp=1 versioncomp=1
_arguments '4:Cookbookversions:($(_cookbook_versions) latest)' _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
;; ;;
(node|client|role) node|client|role)
compadd "$@" --attribute compadd "$@" --attribute
;;
esac esac
;;
esac esac
case $words[4] in case $words[4] in
(show|edit) show|edit)
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
;; ;;
file) file)
@ -134,6 +138,7 @@ _knife() {
;; ;;
*) *)
_arguments '*:Subsubcommands:($(_knife_options3))' _arguments '*:Subsubcommands:($(_knife_options3))'
;;
esac esac
;; ;;
list) list)
@ -141,6 +146,7 @@ _knife() {
;; ;;
*) *)
_arguments '*:Subsubcommands:($(_knife_options3))' _arguments '*:Subsubcommands:($(_knife_options3))'
;;
esac esac
;; ;;
knifesubcmd4) knifesubcmd4)
@ -151,7 +157,7 @@ _knife() {
file) file)
_arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ ' _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
;; ;;
*) _arguments '*:Subsubcommands:($(_knife_options2))' *) _arguments '*:Subsubcommands:($(_knife_options2))' ;;
esac esac
fi fi
;; ;;
@ -162,7 +168,9 @@ _knife() {
;; ;;
*) *)
_arguments '*:Subsubcommands:($(_knife_options3))' _arguments '*:Subsubcommands:($(_knife_options3))'
;;
esac esac
;;
esac esac
} }
@ -231,8 +239,7 @@ _cookbook_versions() {
# Useful for the knife upload/from file commands # Useful for the knife upload/from file commands
_chef_root() { _chef_root() {
directory="$PWD" directory="$PWD"
while [ $directory != '/' ] while [ $directory != '/' ]; do
do
test -e "$directory/.chef" && echo "$directory" && return test -e "$directory/.chef" && echo "$directory" && return
directory="${directory:h}" directory="${directory:h}"
done done

View File

@ -1,17 +1,17 @@
function knife_ssh() { function knife_ssh() {
grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~; grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
ssh $(knife node show $1 | awk '/IP:/{print $2}') ssh $(knife node show $1 | awk '/IP:/{print $2}')
} }
_knife_ssh() { _knife_ssh() {
if hash knife 2>/dev/null; then if hash knife 2>/dev/null; then
if [[ ! -f ~/.knife_comp~ ]]; then if [[ ! -f ~/.knife_comp~ ]]; then
echo "\nGenerating ~/.knife_comp~..." >/dev/stderr echo "\nGenerating ~/.knife_comp~..." >&2
knife node list > ~/.knife_comp~ knife node list > ~/.knife_comp~
fi fi
compadd $(< ~/.knife_comp~) compadd $(< ~/.knife_comp~)
else else
echo "Could not find knife" > /dev/stderr; echo "Could not find knife" >&2
fi fi
} }

View File

@ -37,6 +37,7 @@ alias kdelf='kubectl delete -f'
# Pod management. # Pod management.
alias kgp='kubectl get pods' alias kgp='kubectl get pods'
alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch' alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide' alias kgpwide='kgp -o wide'
alias kep='kubectl edit pods' alias kep='kubectl edit pods'
@ -48,6 +49,7 @@ alias kgpl='kgp -l'
# Service management. # Service management.
alias kgs='kubectl get svc' alias kgs='kubectl get svc'
alias kgsa='kubectl get svc --all-namespaces'
alias kgsw='kgs --watch' alias kgsw='kgs --watch'
alias kgswide='kgs -o wide' alias kgswide='kgs -o wide'
alias kes='kubectl edit svc' alias kes='kubectl edit svc'
@ -56,6 +58,7 @@ alias kdels='kubectl delete svc'
# Ingress management # Ingress management
alias kgi='kubectl get ingress' alias kgi='kubectl get ingress'
alias kgia='kubectl get ingress --all-namespaces'
alias kei='kubectl edit ingress' alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress' alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress' alias kdeli='kubectl delete ingress'
@ -69,17 +72,20 @@ alias kcn='kubectl config set-context $(kubectl config current-context) --namesp
# ConfigMap management # ConfigMap management
alias kgcm='kubectl get configmaps' alias kgcm='kubectl get configmaps'
alias kgcma='kubectl get configmaps --all-namespaces'
alias kecm='kubectl edit configmap' alias kecm='kubectl edit configmap'
alias kdcm='kubectl describe configmap' alias kdcm='kubectl describe configmap'
alias kdelcm='kubectl delete configmap' alias kdelcm='kubectl delete configmap'
# Secret management # Secret management
alias kgsec='kubectl get secret' alias kgsec='kubectl get secret'
alias kgseca='kubectl get secret --all-namespaces'
alias kdsec='kubectl describe secret' alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret' alias kdelsec='kubectl delete secret'
# Deployment management. # Deployment management.
alias kgd='kubectl get deployment' alias kgd='kubectl get deployment'
alias kgda='kubectl get deployment --all-namespaces'
alias kgdw='kgd --watch' alias kgdw='kgd --watch'
alias kgdwide='kgd -o wide' alias kgdwide='kgd -o wide'
alias ked='kubectl edit deployment' alias ked='kubectl edit deployment'
@ -98,6 +104,7 @@ alias kru='kubectl rollout undo'
# Statefulset management. # Statefulset management.
alias kgss='kubectl get statefulset' alias kgss='kubectl get statefulset'
alias kgssa='kubectl get statefulset --all-namespaces'
alias kgssw='kgss --watch' alias kgssw='kgss --watch'
alias kgsswide='kgss -o wide' alias kgsswide='kgss -o wide'
alias kess='kubectl edit statefulset' alias kess='kubectl edit statefulset'
@ -115,7 +122,13 @@ alias kgaa='kubectl get all --all-namespaces'
# Logs # Logs
alias kl='kubectl logs' alias kl='kubectl logs'
alias kl1h='kubectl logs --since 1h'
alias kl1m='kubectl logs --since 1m'
alias kl1s='kubectl logs --since 1s'
alias klf='kubectl logs -f' alias klf='kubectl logs -f'
alias klf1h='kubectl logs --since 1h -f'
alias klf1m='kubectl logs --since 1m -f'
alias klf1s='kubectl logs --since 1s -f'
# File copy # File copy
alias kcp='kubectl cp' alias kcp='kubectl cp'
@ -128,6 +141,7 @@ alias kdelno='kubectl delete node'
# PVC management. # PVC management.
alias kgpvc='kubectl get pvc' alias kgpvc='kubectl get pvc'
alias kgpvca='kubectl get pvc --all-namespaces'
alias kgpvcw='kgpvc --watch' alias kgpvcw='kgpvc --watch'
alias kepvc='kubectl edit pvc' alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc' alias kdpvc='kubectl describe pvc'

View File

@ -29,6 +29,12 @@ plugins=(... laravel)
| `pamc` | `php artisan make:controller` | | `pamc` | `php artisan make:controller` |
| `pams` | `php artisan make:seeder` | | `pams` | `php artisan make:seeder` |
| `pamt` | `php artisan make:test` | | `pamt` | `php artisan make:test` |
| `pamfa` | `php artisan make:factory` |
| `pamp` | `php artisan make:policy` |
| `pame` | `php artisan make:event` |
| `pamj` | `php artisan make:job` |
| `paml` | `php artisan make:listener` |
| `pamn` | `php artisan make:notification` |
## Clears ## Clears
@ -38,3 +44,14 @@ plugins=(... laravel)
| `pacoc` | `php artisan config:clear` | | `pacoc` | `php artisan config:clear` |
| `pavic` | `php artisan view:clear` | | `pavic` | `php artisan view:clear` |
| `paroc` | `php artisan route:clear` | | `paroc` | `php artisan route:clear` |
## Queues
| Alias | Description |
|:-:|:-:|
| `paqf` | `php artisan queue:failed` |
| `paqft` | `php artisan queue:failed-table` |
| `paql` | `php artisan queue:listen` |
| `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` |

View File

@ -17,6 +17,13 @@ alias pamm='php artisan make:model'
alias pamc='php artisan make:controller' alias pamc='php artisan make:controller'
alias pams='php artisan make:seeder' alias pams='php artisan make:seeder'
alias pamt='php artisan make:test' alias pamt='php artisan make:test'
alias pamfa='php artisan make:factory'
alias pamp='php artisan make:policy'
alias pame='php artisan make:event'
alias pamj='php artisan make:job'
alias paml='php artisan make:listener'
alias pamn='php artisan make:notification'
alias pampp='php artisan make:provider'
# Clears # Clears
@ -24,3 +31,11 @@ alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear' alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear' alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear' alias paroc='php artisan route:clear'
# queues
alias paqf='php artisan queue:failed'
alias paqft='php artisan queue:failed-table'
alias paql='php artisan queue:listen'
alias paqr='php artisan queue:retry'
alias paqt='php artisan queue:table'
alias paqw='php artisan queue:work'

View File

@ -61,7 +61,7 @@ Plugin for adding catspeak aliases, because why not
| `violenz` | `git rebase` | | `violenz` | `git rebase` |
| `visible` | `echo` | | `visible` | `echo` |
| `wtf` | `dmesg` | | `wtf` | `dmesg` |
| `yolo` | `git commit -m "$(curl -s https://whatthecommit.com/index.txt)"` | | `yolo` | `git commit -m "$(curl -s http://whatthecommit.com/index.txt)"` |
## Usage Examples ## Usage Examples
@ -78,6 +78,6 @@ nowai u=r,go= some.file
# ssh root@catserver.org # ssh root@catserver.org
pwned root@catserver.org pwned root@catserver.org
# git commit -m "$(curl -s https://whatthecommit.com/index.txt)" # git commit -m "$(curl -s http://whatthecommit.com/index.txt)"
yolo yolo
``` ```

View File

@ -1,17 +0,0 @@
## Magic Enter plugin
This plugin makes your enter key magical, by binding commonly used commands to it.
To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the
commands to be run in your .zshrc, before the line containing plugins. If no command
is specified in a git directory, `git status` is executed; in other directories, `ls`.
```zsh
# defaults
MAGIC_ENTER_GIT_COMMAND='git status -u .'
MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
plugins=(... magic-enter)
```
**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)

View File

@ -148,11 +148,11 @@ if [ $# = 0 ]; then
else else
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
echo "The Spotify application must be installed." echo "The Spotify application must be installed."
exit 1 return 1
fi fi
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
osascript -e 'tell application "Spotify" to activate' || exit 1 osascript -e 'tell application "Spotify" to activate' || return 1
sleep 2 sleep 2
fi fi
fi fi
@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
if [ -z "${CLIENT_ID}" ]; then if [ -z "${CLIENT_ID}" ]; then
cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}"; cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
showAPIHelp; showAPIHelp;
exit 1; return 1
fi fi
if [ -z "${CLIENT_SECRET}" ]; then if [ -z "${CLIENT_SECRET}" ]; then
cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}"; cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
showAPIHelp; showAPIHelp;
exit 1; return 1
fi fi
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r'); SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI=""; SPOTIFY_PLAY_URI="";
@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
cecho "Autorization failed, please check ${USER_CONFG_FILE}" cecho "Autorization failed, please check ${USER_CONFG_FILE}"
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
showAPIHelp showAPIHelp
exit 1 return 1
fi fi
SPOTIFY_ACCESS_TOKEN=$( \ SPOTIFY_ACCESS_TOKEN=$( \
printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \ printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do
"quit" ) cecho "Quitting Spotify."; "quit" ) cecho "Quitting Spotify.";
osascript -e 'tell application "Spotify" to quit'; osascript -e 'tell application "Spotify" to quit';
exit 0 ;; break ;;
"next" ) cecho "Going to next track." ; "next" ) cecho "Going to next track." ;
osascript -e 'tell application "Spotify" to next track'; osascript -e 'tell application "Spotify" to next track';
@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
echo " vol down # Decreases the volume by 10%."; echo " vol down # Decreases the volume by 10%.";
echo " vol [amount] # Sets the volume to an amount between 0 and 100."; echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
echo " vol # Shows the current Spotify volume."; echo " vol # Shows the current Spotify volume.";
exit 1; return 1
fi fi
osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
"help" ) "help" )
showHelp; showHelp;
break ;; break ;;
* ) * )
showHelp; showHelp;
break; return 1 ;;
esac esac
done done

View File

@ -12,32 +12,23 @@ function ot () {
return 1 return 1
fi fi
if [[ `uname` == 'Darwin' ]] then # MacOS X
export COPY_CMD='pbcopy'
elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
export COPY_CMD='xsel --clipboard --input'
else
COPY_CMD='true' COPY_CMD='true'
fi
if [[ "x$1" == "x" ]]; then if [[ -z "$1" ]]; then
echo "usage: otpw <profile.name>" echo "usage: $0 <profile.name>"
return 1 return 1
elif [ ! -f $OTP_HOME/$1.otp.asc ]; then elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
echo "missing profile $1, you might need to create it first using otp_add_device" echo "missing profile $1, you might need to create it first using otp_add_device"
return 1 return 1
else else
totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc) totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD` oathtool --totp --b $totpkey | tee /dev/stderr | clipcopy
if [[ $COPY_CMD == 'true' ]] then
echo "Note: you might consider installing xsel for clipboard integration"
fi
fi fi
} }
function otp_add_device () { function otp_add_device () {
if [[ "x$1" == "x" ]] then if [[ "x$1" == "x" ]] then
echo "usage: otp_add <profile.name>" echo "usage: $0 <profile.name>"
return 1 return 1
else else
echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D" echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"

View File

@ -1,7 +1,7 @@
_paver_does_target_list_need_generating () { _paver_does_target_list_need_generating () {
[ ! -f .paver_targets ] && return 0; [ ! -f .paver_targets ] && return 0
[ pavement.py -nt .paver_targets ] && return 0; [ pavement.py -nt .paver_targets ] && return 0
return 1; return 1
} }
_paver () { _paver () {

View File

@ -1,7 +1,8 @@
# This plugin loads pyenv into the current shell and provides prompt info via # This plugin loads pyenv into the current shell and provides prompt info via
# the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available. # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
FOUND_PYENV=$+commands[pyenv] # Load pyenv only if command not already available
command -v pyenv &> /dev/null && FOUND_PYENV=1 || FOUND_PYENV=0
if [[ $FOUND_PYENV -ne 1 ]]; then if [[ $FOUND_PYENV -ne 1 ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv") pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv")

View File

@ -16,3 +16,15 @@ compdef _repo ru='repo upload'
alias rst='repo status' alias rst='repo status'
compdef _repo rst='repo status' compdef _repo rst='repo status'
alias rsto='repo status -o'
compdef _repo rsto='repo status -o'
alias rfa='repo forall -c'
compdef _repo rfa='repo forall -c'
alias rfap='repo forall -p -c'
compdef _repo rfap='repo forall -p -c'
alias rinf='repo info'
compdef _repo rinf='repo info'

View File

@ -1,10 +0,0 @@
# Roswell Plugin
This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/).
To use it, add `ros` to the plugins array in your zshrc file:
```zsh
plugins=(... ros)
```

View File

@ -1,17 +1,6 @@
# vim:ft=zsh ts=2 sw=2 sts=2 et
#
# Faster alternative to the current SVN plugin implementation.
#
# Works with svn 1.6, 1.7, 1.8.
# Use `svn_prompt_info` method to enquire the svn data.
# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
# It displays the current status of the local files (added, deleted, modified, replaced, or else...)
#
# Use as a drop-in replacement of the svn plugin not as complementary plugin
function svn_prompt_info() { function svn_prompt_info() {
local info local info
info=$(svn info 2>&1) || return 1; # capture stdout and stderr info=$(svn info 2>&1) || return 1 # capture stdout and stderr
local repo_need_upgrade=$(svn_repo_need_upgrade $info) local repo_need_upgrade=$(svn_repo_need_upgrade $info)
if [[ -n $repo_need_upgrade ]]; then if [[ -n $repo_need_upgrade ]]; then
@ -27,7 +16,6 @@ function svn_prompt_info() {
printf '%s%s%s%s %s%s%s:%s%s%s%s' \ printf '%s%s%s%s %s%s%s:%s%s%s%s' \
"$ZSH_PROMPT_BASE_COLOR" \ "$ZSH_PROMPT_BASE_COLOR" \
"$ZSH_THEME_SVN_PROMPT_PREFIX" \ "$ZSH_THEME_SVN_PROMPT_PREFIX" \
\
"$(svn_status_info $info)" \ "$(svn_status_info $info)" \
"$ZSH_PROMPT_BASE_COLOR" \ "$ZSH_PROMPT_BASE_COLOR" \
\ \
@ -37,14 +25,13 @@ function svn_prompt_info() {
\ \
"$(svn_current_revision $info)" \ "$(svn_current_revision $info)" \
"$ZSH_PROMPT_BASE_COLOR" \ "$ZSH_PROMPT_BASE_COLOR" \
\
"$ZSH_THEME_SVN_PROMPT_SUFFIX" \ "$ZSH_THEME_SVN_PROMPT_SUFFIX" \
"$ZSH_PROMPT_BASE_COLOR" "$ZSH_PROMPT_BASE_COLOR"
fi fi
} }
function svn_repo_need_upgrade() { function svn_repo_need_upgrade() {
grep -q "E155036" <<< ${1:-$(svn info 2> /dev/null)} && \ grep -q "E155036" <<< "${1:-$(svn info 2> /dev/null)}" && \
echo "E155036: upgrade repo with svn upgrade" echo "E155036: upgrade repo with svn upgrade"
} }
@ -63,12 +50,23 @@ function svn_current_revision() {
function svn_status_info() { function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN" local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)"; local svn_status="$(svn status 2> /dev/null)";
if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then
if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-}"; fi svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"
if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-}"; fi fi
if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-}"; fi if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then
if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-}"
if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"; fi fi
if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then
svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-}"
fi
if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then
svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-}"
fi
if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then
svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"
fi
if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then
svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"
fi
echo $svn_status_string echo $svn_status_string
} }

View File

@ -35,7 +35,7 @@ The plugin also supports the following -
| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) | | `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support | | `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) | | `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) | | `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux`) |
| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` | | `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `tmux-256color` |
| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) | | `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) |
| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode | | `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |

View File

@ -22,18 +22,18 @@ alias tkss='tmux kill-session -t'
: ${ZSH_TMUX_AUTOCONNECT:=true} : ${ZSH_TMUX_AUTOCONNECT:=true}
# Automatically close the terminal when tmux exits # Automatically close the terminal when tmux exits
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART} : ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
# Set term to screen or screen-256color based on current terminal support # Set term to tmux or tmux-256color based on current terminal support
: ${ZSH_TMUX_FIXTERM:=true} : ${ZSH_TMUX_FIXTERM:=true}
# Set '-CC' option for iTerm2 tmux integration # Set '-CC' option for iTerm2 tmux integration
: ${ZSH_TMUX_ITERM2:=false} : ${ZSH_TMUX_ITERM2:=false}
# The TERM to use for non-256 color terminals. # The TERM to use for non-256 color terminals.
# Tmux states this should be screen, but you may need to change it on # Tmux states this should be tmux, but you may need to change it on
# systems without the proper terminfo # systems without the proper terminfo
: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen} : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=tmux}
# The TERM to use for 256 color terminals. # The TERM to use for 256 color terminals.
# Tmux states this should be screen-256color, but you may need to change it on # Tmux states this should be tmux-256color, but you may need to change it on
# systems without the proper terminfo # systems without the proper terminfo
: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color} : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=tmux-256color}
# Set the configuration path # Set the configuration path
: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf} : ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
# Set -u option to support unicode # Set -u option to support unicode

View File

@ -22,6 +22,13 @@ elif [[ -f "/usr/local/bin/virtualenvwrapper.sh" ]]; then
virtualenvwrapper="/usr/local/bin/virtualenvwrapper.sh" virtualenvwrapper="/usr/local/bin/virtualenvwrapper.sh"
source "/usr/local/bin/virtualenvwrapper.sh" source "/usr/local/bin/virtualenvwrapper.sh"
} }
elif [[ -f "/usr/share/virtualenvwrapper/virtualenvwrapper.sh" ]]; then
function {
setopt local_options
unsetopt equals
virtualenvwrapper="/usr/share/virtualenvwrapper/virtualenvwrapper.sh"
source "/usr/share/virtualenvwrapper/virtualenvwrapper.sh"
}
elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
function { function {
setopt local_options setopt local_options

View File

@ -1,6 +1,6 @@
# VS code # VS Code
This plugin makes interaction between the command line and the code editor easier. This plugin makes interaction between the command line and the VS Code editor easier.
To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`: To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`:
@ -8,9 +8,11 @@ To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`
plugins=(... vscode) plugins=(... vscode)
``` ```
If you are using [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/), ## VS Code Insiders
add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and
the `plugins=()` line). This will make the plugin use the Insiders version instead. 🍏 **If you are only using [VS Code Insiders](https://code.visualstudio.com/insiders/), the plugin will automatically bind to your Insiders installation.**
But, if you have both Stable and Insiders versions and want to configure the plugin to just use the Insiders version, add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and the `plugins=()` line). This will make the plugin use the Insiders version instead.
```zsh ```zsh
ZSH_THEME=... ZSH_THEME=...

View File

@ -1,9 +1,17 @@
# VScode zsh plugin # VScode zsh plugin
# author: https://github.com/MarsiBarsi # Authors:
# https://github.com/MarsiBarsi (original author)
# https://github.com/babakks
# Use main Visual Studio Code version by default # Use the stable VS Code release, unless the Insiders version is the only
# available installation
if ! which code > /dev/null && which code-insiders > /dev/null; then
: ${VSCODE:=code-insiders}
else
: ${VSCODE:=code} : ${VSCODE:=code}
fi
# Define aliases
alias vsc="$VSCODE ." alias vsc="$VSCODE ."
alias vsca="$VSCODE --add" alias vsca="$VSCODE --add"
alias vscd="$VSCODE --diff" alias vscd="$VSCODE --diff"

View File

@ -86,9 +86,11 @@ _yarn_scripts() {
local i runJSON local i runJSON
runJSON=$(yarn run --json 2>/dev/null) runJSON=$(yarn run --json 2>/dev/null)
binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) # Some sed utilities (e.g. Mac OS / BSD) don't interpret `\n` in a replacement
scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) # pattern as a newline. See https://superuser.com/q/307165
scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{([^}]+)\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}") binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g' <<< "$runJSON"))
scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g' <<< "$runJSON"))
scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{(.+")\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\'$'\n/g;s/(^"|"$)//g' <<< "$runJSON")}")
for (( i=1; i <= $#scriptNames; i++ )); do for (( i=1; i <= $#scriptNames; i++ )); do
scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}") scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")

View File

@ -24,6 +24,7 @@
* `zcu` aliases `zeus cucumber` * `zcu` aliases `zeus cucumber`
* `zucumber` aliases `zeus cucumber` * `zucumber` aliases `zeus cucumber`
* `zwip` aliases `zeus cucumber --profile wip`
* `zspec` aliases `zeus rspec` * `zspec` aliases `zeus rspec`

View File

@ -33,6 +33,7 @@ alias zunner='zeus runner'
# Cucumber # Cucumber
alias zcu='zeus cucumber' alias zcu='zeus cucumber'
alias zucumber='zeus cucumber' alias zucumber='zeus cucumber'
alias zwip='zeus cucumber --profile wip'
# Rspec # Rspec
alias zspec='zeus rspec' alias zspec='zeus rspec'