diff options
-rw-r--r-- | plugins/aws/aws.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/debian/README.md | 75 | ||||
-rw-r--r-- | plugins/docker/_docker | 8 | ||||
-rw-r--r-- | plugins/fabric/_fab (renamed from plugins/fabric/_fabric) | 0 | ||||
-rw-r--r-- | plugins/fabric/fabric.plugin.zsh | 0 | ||||
-rw-r--r-- | plugins/golang/golang.plugin.zsh | 1 | ||||
-rw-r--r-- | plugins/jump/jump.plugin.zsh | 11 | ||||
-rw-r--r-- | plugins/keychain/README.md | 45 | ||||
-rw-r--r-- | plugins/keychain/keychain.plugin.zsh | 32 | ||||
-rw-r--r-- | plugins/osx/osx.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/svcat/README.md | 9 | ||||
-rw-r--r-- | plugins/svcat/svcat.plugin.zsh | 6 | ||||
-rw-r--r-- | plugins/tmux/tmux.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/transfer/README.md | 4 | ||||
-rw-r--r-- | plugins/transfer/transfer.plugin.zsh | 10 | ||||
-rw-r--r-- | plugins/vagrant/_vagrant | 7 | ||||
-rw-r--r-- | themes/maran.zsh-theme | 2 |
17 files changed, 193 insertions, 23 deletions
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index f78e96ce3..af27e669a 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -35,7 +35,7 @@ function asp { } function aws_profiles { - reply=($(grep profile "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) + reply=($(grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) } compctl -K aws_profiles asp diff --git a/plugins/debian/README.md b/plugins/debian/README.md new file mode 100644 index 000000000..a676674dc --- /dev/null +++ b/plugins/debian/README.md @@ -0,0 +1,75 @@ +# debian + +This plugin provides debian related zsh aliases. +To use it add `debian` to the plugins array in your zshrc file. + +```zsh +plugins=(... debian) +``` + +## Common Aliases + +| Alias | Command | Description | +| -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- | +| `age` | apt-get | Command line tool for handling packages | +| `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation | +| `acs` | apt-cache search | Command line tool for searching apt software package cache | +| `aps` | aptitude search | Searches installed packages using aptitude | +| `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - | +| `afs` | apt-file search --regexp | Search file in packages | +| `asrc` | apt-get source | Fetch source packages through `apt-get` | +| `app` | apt-cache policy | Displays priority of package sources | + +## Superuser Operations Aliases + +| Alias | Command | Description | +| -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- | +| `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files | +| `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages | +| `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files | +| `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages | +| `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages | +| `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies | +| `afu` | sudo apt-file update | Update the files in packages | +| `au` | sudo $apt_pref $apt_upgr | - | +| `ai` | sudo $apt_pref install | Command-line tool to install package | +| `ail` | sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install | Install all packages given on the command line while using only the first word of each line | +| `ap` | sudo $apt_pref purge | Removes packages along with configuration files | +| `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files | +| `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list | +| `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory | +| `di` | sudo dpkg -i | Install all .deb files in the current directory | +| `kclean` | sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`)) | Remove ALL kernel images and headers EXCEPT the one in use | + +- `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get. +- `$apt_upgr` - Use upgrade. + +## Aliases - Commands using `su` + +| Alias | Command | +| -------- | ------------------------------------------------------------------------------| +| `aac` | su -ls \'$apt_pref autoclean\' root | +| `ac` | su -ls \'$apt_pref clean\' root | +| `ad` | su -lc \'$apt_pref update\' root | +| `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root | +| `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root | +| `afu` | su -lc "apt-file update | +| `ag` | su -lc \'$apt_pref $apt_upgr\' root | +| `dia` | su -lc "dpkg -i ./*.deb" root | + +## Miscellaneous Aliases + +| Alias | Command | Description | +| -------- | -------------------------------------------------|---------------------------------------- | +| `allpkgs`| aptitude search -F "%p" --disable-columns ~i | Display all installed packages | +| `mydeb` | time dpkg-buildpackage -rfakeroot -us -uc | Create a basic .deb package | + +## Functions + +| Fucntion | Description | +|-----------------------|-------------------------------------------------------------------------------| +| `apt-copy` | Create a simple script that can be used to 'duplicate' a system | +| `apt-history` | Displays apt history for a command | +| `kerndeb` | Builds kernel packages | +| `apt-list-packages` | List packages by size | + diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 31b83c777..54b5e59c5 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -1,6 +1,6 @@ #compdef docker dockerd # -# zsh completion for docker (https://docker.com) +# zsh completion for docker (http://docker.com) # # version: 0.3.0 # github: https://github.com/felixr/docker-zsh-completion @@ -617,6 +617,7 @@ __docker_container_subcommand() { "($help)*--dns=[Custom DNS servers]:DNS server: " "($help)*--dns-option=[Custom DNS options]:DNS option: " "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " + "($help)*--domainname=[Container NIS domain name]:domainname:_hosts" "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " "($help)*--env-file=[Read environment variables from a file]:environment file:_files" @@ -2214,7 +2215,7 @@ __docker_stack_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ - "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \ + "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help -):stack:__docker_complete_stacks" && ret=0 ;; @@ -2285,6 +2286,9 @@ __docker_swarm_subcommand() { $opts_help \ "($help)--advertise-addr=[Advertised address]:ip\:port: " \ "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--data-path-port=[Data Path Port]:port " \ + "($help)--default-addr-pool=[Default address pool]" \ + "($help)--default-addr-pool-mask-length=[Default address pool subnet mask length]" \ "($help)--autolock[Enable manager autolocking]" \ "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ diff --git a/plugins/fabric/_fabric b/plugins/fabric/_fab index 9628e1224..9628e1224 100644 --- a/plugins/fabric/_fabric +++ b/plugins/fabric/_fab diff --git a/plugins/fabric/fabric.plugin.zsh b/plugins/fabric/fabric.plugin.zsh new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/plugins/fabric/fabric.plugin.zsh diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index 919c98629..8284ab83c 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -126,6 +126,7 @@ __go_tool_complete() { ;; help) _values "${commands[@]}" \ + 'environment[show Go environment variables available]' \ 'gopath[GOPATH environment variable]' \ 'packages[description of package lists]' \ 'remote[remote import path syntax]' \ diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index a19a86022..d161a6da0 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -28,11 +28,18 @@ unmark() { } marks() { + local max=0 + for link in $MARKPATH/*(@); do + if [[ ${#link:t} -gt $max ]]; then + max=${#link:t} + fi + done + local printf_markname_template="$(printf -- "%%%us " "$max")" for link in $MARKPATH/*(@); do local markname="$fg[cyan]${link:t}$reset_color" local markpath="$fg[blue]$(readlink $link)$reset_color" - printf "%s\t" $markname - printf -- "-> %s \t\n" $markpath + printf -- "$printf_markname_template" "$markname" + printf -- "-> %s\n" "$markpath" done } diff --git a/plugins/keychain/README.md b/plugins/keychain/README.md new file mode 100644 index 000000000..c603f6790 --- /dev/null +++ b/plugins/keychain/README.md @@ -0,0 +1,45 @@ +# keychain plugin + +This plugin starts automatically [`keychain`](https://www.funtoo.org/Keychain) +to set up and load whichever credentials you want for both gpg and ssh +connections. + +To enable it, add `keychain` to your plugins: + +```zsh +plugins=(... keychain) +``` + +**NOTE**: It is HIGHLY recommended to also enable the `gpg-agent` plugin. + +## Instructions + +**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh** + +**To adjust the agents** that keychain manages, use the `agents` style as +shown below. By default, only the `gpg` agent is managed. + +```zsh +zstyle :omz:plugins:keychain agents gpg,ssh +``` + +To **load multiple identities** use the `identities` style, For example: + +```zsh +zstyle :omz:plugins:keychain identities id_ed25519 id_github 2C5879C2 +``` + +**To pass additional options** to the `keychain` program, use the +`options` style; for example: + +```zsh +zstyle :omz:plugins:keychain options --quiet +``` + +## Credits + +Based on code from the `ssh-agent` plugin. + +## References + +- [Keychain](https://www.funtoo.org/Keychain) diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh new file mode 100644 index 000000000..af34793e7 --- /dev/null +++ b/plugins/keychain/keychain.plugin.zsh @@ -0,0 +1,32 @@ +function _start_agent() { + local agents + local -a identities + local -a options + local _keychain_env_sh + local _keychain_env_sh_gpg + + # load agents to start. + zstyle -s :omz:plugins:keychain agents agents + + # load identities to manage. + zstyle -a :omz:plugins:keychain identities identities + + # load additional options + zstyle -a :omz:plugins:keychain options options + + # start keychain... + keychain ${^options:-} --agents ${agents:-gpg} ${^identities} + + # Get the filenames to store/lookup the environment from + _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh" + _keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg" + + # Source environment settings. + [ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh" + [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg" +} + +_start_agent + +# tidy up after ourselves +unfunction _start_agent diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 6a4b6eec4..a1c73a184 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -284,6 +284,6 @@ alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" # Remove .DS_Store files recursively in a directory, default . -rmdsstore() { +function rmdsstore() { find "${@:-.}" -type f -name .DS_Store -delete } diff --git a/plugins/svcat/README.md b/plugins/svcat/README.md new file mode 100644 index 000000000..0bc60b117 --- /dev/null +++ b/plugins/svcat/README.md @@ -0,0 +1,9 @@ +# svcat + +This plugin provides completion for the [Kubernetes service catalog cli](https://github.com/kubernetes-incubator/service-catalog). + +To use it, add `svcat` to the plugins array in your zshrc file. + +``` +plugins=(... svcat) +``` diff --git a/plugins/svcat/svcat.plugin.zsh b/plugins/svcat/svcat.plugin.zsh new file mode 100644 index 000000000..f90e7d8d6 --- /dev/null +++ b/plugins/svcat/svcat.plugin.zsh @@ -0,0 +1,6 @@ +# Autocompletion for svcat. +# + +if [ $commands[svcat] ]; then + source <(svcat completion zsh) +fi diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 7ddf42099..2f3c3e79d 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -36,7 +36,7 @@ alias tkss='tmux kill-session -t' : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color} # Determine if the terminal supports 256 colors -if [[ $(tput colors) == 256 ]]; then +if [[ $terminfo[colors] == 256 ]]; then export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR else export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md index 37c7ca2f7..5fa064445 100644 --- a/plugins/transfer/README.md +++ b/plugins/transfer/README.md @@ -1,9 +1,5 @@ # `transfer` plugin -**NOTICE: The `transfer` plugin is deprecated and will be removed soon, since the [transfer.sh](https://transfer.sh) service will be shutdown on 30th November 30th, 2018. Please move your files to an alternative file sharing service provider.** - ----- - [`transfer.sh`](https://transfer.sh) is an easy to use file sharing service from the command line ## Usage diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh index 8fd09ef04..7a7cd85ec 100644 --- a/plugins/transfer/transfer.plugin.zsh +++ b/plugins/transfer/transfer.plugin.zsh @@ -12,14 +12,6 @@ # Modified to use tar command instead of zip # -echo -ne '\e[1;33m' -cat <<-EOF - [oh-my-zsh] WARNING: The 'transfer' plugin is deprecated and will be removed after - [oh-my-zsh] transfer.sh shuts down on November 30th. We suggest you stop using the - [oh-my-zsh] plugin and find an alternative file hosting service. -EOF -echo -ne '\e[0m' - curl --version 2>&1 > /dev/null if [ $? -ne 0 ]; then echo "Could not find curl." @@ -72,4 +64,4 @@ transfer() { # cleanup rm -f $tmpfile -} +}
\ No newline at end of file diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index a99a8f0e7..2efb4473d 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -6,6 +6,7 @@ local -a _1st_arguments _1st_arguments=( 'box:Box commands' + 'cloud:Manages everything related to Vagrant Cloud' 'connect:Connects to a remotely shared Vagrant environment' 'destroy:Destroys the vagrant environment' 'docker-logs:Outputs the logs from the Docker container' @@ -18,6 +19,7 @@ _1st_arguments=( 'login:Authenticates against a Vagrant Cloud server to access protected boxes' 'package:Packages a vagrant environment for distribution' 'plugin:Plugin commands' + 'port:Displays information about guest port mappings' 'provision:Run the provisioner' 'push:Deploys code in this environment to a configured destination' 'rdp:Connects to machine via RDP' @@ -33,6 +35,7 @@ _1st_arguments=( 'suspend:Suspends the currently running vagrant environment' 'snapshot:Used to manage snapshots with the guest machine' 'up:Creates the vagrant environment' + 'validate:Validates the Vagrantfile' 'version:Prints current and latest Vagrant version' '--help:[TASK] Describe available tasks or one specific task' '--version:Prints the Vagrant version information' @@ -54,7 +57,7 @@ __task_list () local expl declare -a tasks - tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) + tasks=(box destroy halt init package port provision reload resume ssh ssh_config status suspend up version) _wanted tasks expl 'help' compadd $tasks } @@ -123,7 +126,7 @@ case $state in (box) __vagrant-box ;; - (up|provision|package|destroy|reload|ssh|ssh-config|halt|resume|status) + (up|provision|port|package|destroy|reload|ssh|ssh-config|halt|resume|status) _arguments ':feature:__vm_list' esac ;; diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 6fba04688..fddb7bc30 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,6 +1,6 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%}$(git_prompt_info) %(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" |