@ -0,0 +1,3 @@ | |||||
.gitsecret/keys/random_seed | |||||
!*.secret | |||||
zsh/secret |
@ -0,0 +1 @@ | |||||
zsh/secret:63d3fba77f570fbb9e9f999303a2828c4a2d88990836e80ea08a48c48619da22 |
@ -0,0 +1,11 @@ | |||||
## tmate | |||||
# Reassign prefix to not conflict with tmux | |||||
set -g prefix C-] | |||||
bind-key ] send-prefix | |||||
# turn off status bar so tmate is invisible | |||||
set -g status off | |||||
# Fix timeout for escape key | |||||
set -s escape-time 0 |
@ -0,0 +1,18 @@ | |||||
#!/usr/bin/zsh | |||||
alias feh="feh --scale-down --auto-zoom" | |||||
alias idea="/home/yigit/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.7223.91/bin/idea.sh" | |||||
alias lights_off="curl 'http://yeetclock/setcolor?R=2000&G=10&B=000&O=0'" | |||||
alias open=xdg-open | |||||
alias rm="rm -i" | |||||
alias clip="xclip -selection clipboard" | |||||
alias g="git " | |||||
alias t="TERM=screen-256color-bce tmux" | |||||
alias tn="TERM=screen-256color-bce tmux new -s " | |||||
alias tat="TERM=screen-256color-bce tmux a -t " | |||||
alias yain="yay -Syu " | |||||
alias ls="ls --color" | |||||
# Suffix aliases | |||||
alias -g G=" | rg" | |||||
alias gshh="gcloud cloud-shell ssh --authorize-session" |
@ -0,0 +1,439 @@ | |||||
#compdef gcloud | |||||
#------------------------------------------------------------ | |||||
# Description: | |||||
# | |||||
# Completion script for Google Cloud SDK | |||||
# | |||||
# Author: | |||||
# | |||||
# * Colin Su (https://github.com/littleq0903) | |||||
# | |||||
# Source Code: | |||||
# | |||||
# https://github.com/littleq0903/gcloud-zsh-completion | |||||
# | |||||
#------------------------------------------------------------ | |||||
## Util functions | |||||
# get authorized account list | |||||
__account_list () | |||||
{ | |||||
_wanted application expl 'Authorized Google Accounts' compadd $(command gcloud auth list 2> /dev/null | grep - | sed -e "s/^ - //g" | sed -e "s/(active)//g") | |||||
} | |||||
# get config variable names | |||||
__variable_list () | |||||
{ | |||||
_wanted application expl 'gcloud :: config :: Configuration Variables' compadd $(command gcloud config list 2> /dev/null | grep "=" | sed -e "s/ = .*//g") | |||||
} | |||||
## Common stuffs | |||||
local -a _first_arguments | |||||
_first_arguments=( | |||||
# these are command groups | |||||
'auth:Manage oauth2 credentials for the Google Cloud SDK' | |||||
'components:Install, update, or remove the tools in the Google Cloud SDK' | |||||
'compute:Read and manipulate Google Compute Engine resources' | |||||
'config:View and edit Google Cloud SDK properties' | |||||
'sql:Manage Cloud SQL databases' | |||||
# these are just commands | |||||
'init:Initialize a gcloud workspace in the current directory' | |||||
'interactive:Use this tool in an interactive python shell' | |||||
'version:Print version information for Cloud SDK components' | |||||
) | |||||
# common options | |||||
common_ops=( | |||||
{--project+,-p+}":Google Cloud Platform project to use for this invocation:( )" | |||||
{--quiet,-q}"[Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised.]" | |||||
"--user-output-enabled+:Control whether user intended output is printed to the console.:(true false)" | |||||
"--verbosity+:Override the default verbosity for this command. This must be a standard logging verbosity level:(debug info warning error critical none)" | |||||
) | |||||
## for 'auth' command group | |||||
# Commands | |||||
local -a _auth_arguments | |||||
_auth_arguments=( | |||||
"activate-refresh-token:Get credentials via an existing refresh token" | |||||
"list:List the accounts for known credentials" | |||||
"login:Get credentials via Google's oauth2 web flow" | |||||
"revoke:Revoke authorization for credentials" | |||||
) | |||||
__gcloud-auth () | |||||
{ | |||||
local curcontext="$curcontext" state line | |||||
local -A opt_args | |||||
_arguments \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t subcommand "gcloud :: auth Commands" _auth_arguments | |||||
return | |||||
;; | |||||
(options) | |||||
case $line[1] in | |||||
(list) | |||||
_arguments \ | |||||
"--account+::List only credentials for one account:( )" | |||||
;; | |||||
(login) | |||||
# TODO: make options repeatable | |||||
local args | |||||
args=( | |||||
"--account+:Override the account acquired from the web flow:( )" | |||||
"--do-not-activate[Do not set the new credentials as active]" | |||||
"--no-launch-browser[Print a URL to be copied instead of launching a web browser]" | |||||
) | |||||
_arguments -C $args | |||||
;; | |||||
(revoke) | |||||
_arguments \ | |||||
"--all[Revoke all known credentials]" | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
} | |||||
## for 'components' command groups | |||||
local -a _components_arguments | |||||
_components_arguments=( | |||||
'list:Command to list the current state of installed components' | |||||
'remove:Command to remove installed components' | |||||
'restore:Command to restore a backup of a Cloud SDK installation' | |||||
'update:Command to update existing or install new components' | |||||
) | |||||
__gcloud-components () | |||||
{ | |||||
local curcontext="$curcontext" state line | |||||
local -A opt_args | |||||
_arguments -C \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: components Commands" _components_arguments | |||||
return | |||||
;; | |||||
(options) | |||||
case $line[1] in | |||||
(list) | |||||
_arguments \ | |||||
"--show-versions[Show version information for all components]" | |||||
;; | |||||
(remove) | |||||
;; | |||||
(restore) | |||||
;; | |||||
(update) | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
} | |||||
## for 'compute' command groups | |||||
local -a _compute_arguments | |||||
_compute_arguments=( | |||||
"addresses:Read and manipulate Google Compute Engine addresses." | |||||
"backend-services:List, create, and delete backend services." | |||||
"disk-types:Read Google Compute Engine virtual disk types." | |||||
"disks:Read and manipulate Google Compute Engine disks." | |||||
"firewall-rules:List, create, and delete Google Compute Engine firewall rules." | |||||
"forwarding-rules:Read and manipulate forwarding rules to send traffic to load balancers." | |||||
"http-health-checks:Read and manipulate HTTP health checks for load balanced instances." | |||||
"images:List, create, and delete Google Compute Engine images." | |||||
"instances:Read and manipulate Google Compute Engine virtual machine instances." | |||||
"machine-types:Read Google Compute Engine virtual machine types." | |||||
"networks:List, create, and delete Google Compute Engine networks." | |||||
"operations:Read and manipulate Google Compute Engine operations." | |||||
"project-info:Read and manipulate project-level data like quotas and metadata." | |||||
"regions:List Google Compute Engine regions." | |||||
"routes:Read and manipulate routes." | |||||
"snapshots:List, describe, and delete Google Compute Engine snapshots." | |||||
"target-http-proxies:List, create, and delete target HTTP proxies." | |||||
"target-instances:Read and manipulate Google Compute Engine virtual target instances." | |||||
"target-pools:Read and manipulate Google Compute Engine target pools." | |||||
"url-maps:List, create, and delete URL maps." | |||||
"zones:List Google Compute Engine zones." | |||||
"config-ssh:Populate SSH config files with Host entries from each instance" | |||||
"copy-files:Copy files to and from Google Compute Engine virtual machines." | |||||
"ssh:SSH into a virtual machine instance." | |||||
) | |||||
__gcloud-compute () | |||||
{ | |||||
local curcontext="$curcontext" state line | |||||
local -A opt_args | |||||
_arguments -C \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: compute commands" _compute_arguments | |||||
return | |||||
;; | |||||
esac | |||||
} | |||||
## for 'config' command groups | |||||
local -a _config_arguments | |||||
_config_arguments=( | |||||
'list:View Google Cloud SDK properties' | |||||
'set:Edit Google Cloud SDK properties' | |||||
'unset:Erase Google Cloud SDK properties' | |||||
) | |||||
__gcloud-config () | |||||
{ | |||||
local curcontext="$curcontext" state line | |||||
local -A opt_args | |||||
_arguments -C \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: config Commands" _config_arguments | |||||
return | |||||
;; | |||||
(options) | |||||
case $line[1] in | |||||
(list) | |||||
_arguments \ | |||||
"--all[List all set and unset properties that match the arguments]" \ | |||||
{--section+,-s+}":The section whose properties shall be listed:( )" | |||||
;; | |||||
(set) | |||||
# FEATURE: gcloud config set <property>, will complete the property names | |||||
local -a _config_set_arguments | |||||
_config_set_arguments=( | |||||
"--global-only[Set the option in the global properties file]" | |||||
{--section+,-s+}":The section containing the option to be set:( )" | |||||
) | |||||
_arguments -C \ | |||||
$_config_set_arguments \ | |||||
'1:feature:__variable_list' \ | |||||
'*:value:->value' | |||||
case $state in | |||||
(value) | |||||
case $line[1] in | |||||
(account) | |||||
# FEATURE: gcloud config set account <authed_account> | |||||
# when `config set account <cursor>`, completing by authroized accounts | |||||
_arguments -C \ | |||||
'2:feature:__account_list' | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
;; | |||||
(unset) | |||||
# FEATURE: gcloud config unset <property>, will complete the property names | |||||
local -a _config_unset_arguments | |||||
_config_unset_arguments=( | |||||
"--global-only[Unset the option in the global properties file]" | |||||
{--section+,-s+}":The section containing the option to be unset:( )" | |||||
) | |||||
_arguments \ | |||||
$_config_unset_arguments \ | |||||
'1:feature:__variable_list' | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
} | |||||
## for 'sql' command groups | |||||
local -a _sql_arguments | |||||
_sql_arguments=( | |||||
'backups:Provide commands for working with backups of Cloud SQL instances' | |||||
'instances:Provide commands for managing Cloud SQL instances' | |||||
'operations:Provide commands for working with Cloud SQL instance operations' | |||||
'ssl-certs:Provide commands for managing SSL certificates of Cloud SQL instances' | |||||
'tiers:Provide a command to list tiers' | |||||
) | |||||
__gcloud-sql () | |||||
{ | |||||
local curcontext="$curcontext" state line | |||||
local -A opt_args | |||||
_arguments -C \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: sql Commands" _sql_arguments | |||||
return | |||||
;; | |||||
(options) | |||||
case $line[1] in | |||||
(backups) | |||||
_sql_backups_arguments=( | |||||
"get:Retrieves information about a backup" | |||||
"list:Lists all backups associated with a given instance" | |||||
) | |||||
_arguments \ | |||||
':command:->command' \ | |||||
{--instance+,-i+}":Cloud SQL instance ID:( )" \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
local -a _sql_backups_arguments | |||||
_describe -t commands "gcloud :: sql :: backup Commands" _sql_backups_arguments | |||||
;; | |||||
esac | |||||
;; | |||||
(instances) | |||||
# too many optional options in here, cry ;( | |||||
_sql_instances_arguments=( | |||||
'create:Creates a new Cloud SQL instance' | |||||
'delete:Deletes a Cloud SQL instance' | |||||
'export:Exports data from a Cloud SQL instance' | |||||
'get:Retrieves information about a Cloud SQL instance' | |||||
'import:Imports data into a Cloud SQL instance from Google Cloud Storage' | |||||
'list:Lists Cloud SQL instances in a given project' | |||||
'patch:Updates the settings of a Cloud SQL instance' | |||||
'reset-ssl-config:Deletes all client certificates and generates a new server certificate' | |||||
'restart:Restarts a Cloud SQL instance' | |||||
'restore-backup:Restores a backup of a Cloud SQL instance' | |||||
'set-root-password:Sets the password of the MySQL root user' | |||||
) | |||||
_arguments \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: sql :: instances Commands" _sql_instances_arguments | |||||
;; | |||||
esac | |||||
;; | |||||
(operations) | |||||
local -a _sql_operations_arguments | |||||
_sql_operations_arguments=( | |||||
"get:Retrieves information about a Cloud SQL instance operation." | |||||
"list:Lists all instance operations for the given Cloud SQL instance" | |||||
) | |||||
_arguments \ | |||||
':command:->command' \ | |||||
{--instance+,-i+}":Cloud SQL instance ID:( )" \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: sql :: operations Commands" _sql_backups_arguments | |||||
;; | |||||
esac | |||||
;; | |||||
(ssl-certs) | |||||
local -a _sql_sslcerts_arguments | |||||
_sql_sslcerts_arguments=( | |||||
'create:Creates an SSL certificate for a Cloud SQL instance' | |||||
'delete:Deletes an SSL certificate for a Cloud SQL instance' | |||||
'get:Retrieves information about an SSL cert for a Cloud SQL instance' | |||||
'list:Lists all SSL certs for a Cloud SQL instance' | |||||
) | |||||
_arguments \ | |||||
':command:->command' \ | |||||
{--instance+,-i+}":Cloud SQL instance ID:( )" \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: sql :: ssl-certs Commands" _sql_sslcerts_arguments | |||||
;; | |||||
esac | |||||
;; | |||||
(tiers) | |||||
local -a _sql_tiers_arguments | |||||
_sql_tiers_arguments=( | |||||
"list:Lists all available service tiers for Google Cloud SQL" | |||||
) | |||||
_arguments \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "gcloud :: sql :: tiers Commands" _sql_tiers_arguments | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
} | |||||
## Top-level completion function | |||||
local expl | |||||
local curcontext="$curcontext" state line | |||||
local -A opt_args | |||||
_arguments -C \ | |||||
$common_ops \ | |||||
':command:->command' \ | |||||
'*::options:->options' | |||||
case $state in | |||||
(command) | |||||
_describe -t commands "Google Cloud SDK Commands" _first_arguments | |||||
;; | |||||
(options) | |||||
# subcommands | |||||
case $line[1] in | |||||
(auth) | |||||
__gcloud-auth | |||||
;; | |||||
(compute) | |||||
__gcloud-compute | |||||
;; | |||||
(components) | |||||
__gcloud-components | |||||
;; | |||||
(config) | |||||
__gcloud-config | |||||
;; | |||||
(sql) | |||||
__gcloud-sql | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
return 0 | |||||
# Local Variables: | |||||
# mode: Shell-Script | |||||
# sh-indentation: 2 | |||||
# indent-tabs-mode: nil | |||||
# sh-basic-offset: 2 | |||||
# End: | |||||
# vim: ft=zsh sw=2 ts=2 et |
@ -0,0 +1,294 @@ | |||||
#compdef git gitk | |||||
# zsh completion wrapper for git | |||||
# | |||||
# Copyright (c) 2012-2020 Felipe Contreras <felipe.contreras@gmail.com> | |||||
# | |||||
# The recommended way to install this script is to make a copy of it as a | |||||
# file named '_git' inside any directory in your fpath. | |||||
# | |||||
# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git', | |||||
# and then add the following to your ~/.zshrc file: | |||||
# | |||||
# fpath=(~/.zsh $fpath) | |||||
# | |||||
# You need git's bash completion script installed. By default bash-completion's | |||||
# location will be used (e.g. pkg-config --variable=completionsdir bash-completion). | |||||
# | |||||
# If your bash completion script is somewhere else, you can specify the | |||||
# location in your ~/.zshrc: | |||||
# | |||||
# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash | |||||
# | |||||
zstyle -T ':completion:*:*:git:*' tag-order && \ | |||||
zstyle ':completion:*:*:git:*' tag-order 'common-commands' | |||||
zstyle -s ":completion:*:*:git:*" script script | |||||
if [ -z "$script" ]; then | |||||
local -a locations | |||||
local e bash_completion | |||||
bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) || | |||||
bash_completion='/usr/share/bash-completion/completions/' | |||||
locations=( | |||||
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash | |||||
"$HOME/.local/share/bash-completion/completions/git" | |||||
"$bash_completion/git" | |||||
'/etc/bash_completion.d/git' # old debian | |||||
) | |||||
for e in $locations; do | |||||
test -f $e && script="$e" && break | |||||
done | |||||
fi | |||||
local old_complete="$functions[complete]" | |||||
functions[complete]=: | |||||
GIT_SOURCING_ZSH_COMPLETION=y . "$script" | |||||
functions[complete]="$old_complete" | |||||
__gitcomp () | |||||
{ | |||||
emulate -L zsh | |||||
local cur_="${3-$cur}" | |||||
case "$cur_" in | |||||
--*=) | |||||
;; | |||||
--no-*) | |||||
local c IFS=$' \t\n' | |||||
local -a array | |||||
for c in ${=1}; do | |||||
if [[ $c == "--" ]]; then | |||||
continue | |||||
fi | |||||
c="$c${4-}" | |||||
case $c in | |||||
--*=|*.) ;; | |||||
*) c="$c " ;; | |||||
esac | |||||
array+=("$c") | |||||
done | |||||
compset -P '*[=:]' | |||||
compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 | |||||
;; | |||||
*) | |||||
local c IFS=$' \t\n' | |||||
local -a array | |||||
for c in ${=1}; do | |||||
if [[ $c == "--" ]]; then | |||||
c="--no-...${4-}" | |||||
array+=("$c ") | |||||
break | |||||
fi | |||||
c="$c${4-}" | |||||
case $c in | |||||
--*=|*.) ;; | |||||
*) c="$c " ;; | |||||
esac | |||||
array+=("$c") | |||||
done | |||||
compset -P '*[=:]' | |||||
compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 | |||||
;; | |||||
esac | |||||
} | |||||
__gitcomp_direct () | |||||
{ | |||||
emulate -L zsh | |||||
compset -P '*[=:]' | |||||
compadd -Q -S '' -- ${(f)1} && _ret=0 | |||||
} | |||||
__gitcomp_nl () | |||||
{ | |||||
emulate -L zsh | |||||
compset -P '*[=:]' | |||||
compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0 | |||||
} | |||||
__gitcomp_file () | |||||
{ | |||||
emulate -L zsh | |||||
compset -P '*[=:]' | |||||
compadd -f -p "${2-}" -- ${(f)1} && _ret=0 | |||||
} | |||||
__gitcomp_direct_append () | |||||
{ | |||||
__gitcomp_direct "$@" | |||||
} | |||||
__gitcomp_nl_append () | |||||
{ | |||||
__gitcomp_nl "$@" | |||||
} | |||||
__gitcomp_file_direct () | |||||
{ | |||||
__gitcomp_file "$1" "" | |||||
} | |||||
_git_zsh () | |||||
{ | |||||
__gitcomp "v1.1" | |||||
} | |||||
__git_complete_command () | |||||
{ | |||||
emulate -L zsh | |||||
local command="$1" | |||||
local completion_func="_git_${command//-/_}" | |||||
if (( $+functions[$completion_func] )); then | |||||
emulate ksh -c $completion_func | |||||
return 0 | |||||
else | |||||
return 1 | |||||
fi | |||||
} | |||||
__git_zsh_bash_func () | |||||
{ | |||||
emulate -L ksh | |||||
local command=$1 | |||||
__git_complete_command "$command" && return | |||||
local expansion=$(__git_aliased_command "$command") | |||||
if [ -n "$expansion" ]; then | |||||
words[1]=$expansion | |||||
__git_complete_command "$expansion" | |||||
fi | |||||
} | |||||
__git_zsh_cmd_common () | |||||
{ | |||||
local -a list | |||||
list=( | |||||
add:'add file contents to the index' | |||||
bisect:'find by binary search the change that introduced a bug' | |||||
branch:'list, create, or delete branches' | |||||
checkout:'checkout a branch or paths to the working tree' | |||||
clone:'clone a repository into a new directory' | |||||
commit:'record changes to the repository' | |||||
diff:'show changes between commits, commit and working tree, etc' | |||||
fetch:'download objects and refs from another repository' | |||||
grep:'print lines matching a pattern' | |||||
init:'create an empty Git repository or reinitialize an existing one' | |||||
log:'show commit logs' | |||||
merge:'join two or more development histories together' | |||||
mv:'move or rename a file, a directory, or a symlink' | |||||
pull:'fetch from and merge with another repository or a local branch' | |||||
push:'update remote refs along with associated objects' | |||||
rebase:'forward-port local commits to the updated upstream head' | |||||
reset:'reset current HEAD to the specified state' | |||||
restore:'restore working tree files' | |||||
rm:'remove files from the working tree and from the index' | |||||
show:'show various types of objects' | |||||
status:'show the working tree status' | |||||
switch:'switch branches' | |||||
tag:'create, list, delete or verify a tag object signed with GPG') | |||||
_describe -t common-commands 'common commands' list && _ret=0 | |||||
} | |||||
__git_zsh_cmd_alias () | |||||
{ | |||||
local -a list | |||||
list=(${${(0)"$(git config -z --get-regexp '^alias\.*')"}#alias.}) | |||||
list=(${(f)"$(printf "%s:alias for '%s'\n" ${(f@)list})"}) | |||||
_describe -t alias-commands 'aliases' list && _ret=0 | |||||
} | |||||
__git_zsh_cmd_all () | |||||
{ | |||||
local -a list | |||||
emulate ksh -c __git_compute_all_commands | |||||
list=( ${=__git_all_commands} ) | |||||
_describe -t all-commands 'all commands' list && _ret=0 | |||||
} | |||||
__git_zsh_main () | |||||
{ | |||||
local curcontext="$curcontext" state state_descr line | |||||
typeset -A opt_args | |||||
local -a orig_words | |||||
orig_words=( ${words[@]} ) | |||||
_arguments -C \ | |||||
'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \ | |||||
'(-p --paginate)--no-pager[do not pipe git output into a pager]' \ | |||||
'--git-dir=-[set the path to the repository]: :_directories' \ | |||||
'--bare[treat the repository as a bare repository]' \ | |||||
'(- :)--version[prints the git suite version]' \ | |||||
'--exec-path=-[path to where your core git programs are installed]:: :_directories' \ | |||||
'--html-path[print the path where git''s HTML documentation is installed]' \ | |||||
'--info-path[print the path where the Info files are installed]' \ | |||||
'--man-path[print the manpath (see `man(1)`) for the man pages]' \ | |||||
'--work-tree=-[set the path to the working tree]: :_directories' \ | |||||
'--namespace=-[set the git namespace]' \ | |||||
'--no-replace-objects[do not use replacement refs to replace git objects]' \ | |||||
'(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \ | |||||
'(-): :->command' \ | |||||
'(-)*:: :->arg' && return | |||||
case $state in | |||||
(command) | |||||
_tags common-commands alias-commands all-commands | |||||
while _tags; do | |||||
_requested common-commands && __git_zsh_cmd_common | |||||
_requested alias-commands && __git_zsh_cmd_alias | |||||
_requested all-commands && __git_zsh_cmd_all | |||||
let _ret || break | |||||
done | |||||
;; | |||||
(arg) | |||||
local command="${words[1]}" __git_dir | |||||
if (( $+opt_args[--bare] )); then | |||||
__git_dir='.' | |||||
else | |||||
__git_dir=${opt_args[--git-dir]} | |||||
fi | |||||
(( $+opt_args[--help] )) && command='help' | |||||
words=( ${orig_words[@]} ) | |||||
__git_zsh_bash_func $command | |||||
;; | |||||
esac | |||||
} | |||||
_git () | |||||
{ | |||||
local _ret=1 | |||||
local cur cword prev | |||||
cur=${words[CURRENT]} | |||||
prev=${words[CURRENT-1]} | |||||
let cword=CURRENT-1 | |||||
if (( $+functions[__${service}_zsh_main] )); then | |||||
__${service}_zsh_main | |||||
elif (( $+functions[__${service}_main] )); then | |||||
emulate ksh -c __${service}_main | |||||
elif (( $+functions[_${service}] )); then | |||||
emulate ksh -c _${service} | |||||
elif (( $+functions[_${service//-/_}] )); then | |||||
emulate ksh -c _${service//-/_} | |||||
fi | |||||
let _ret && _default && _ret=0 | |||||
return _ret | |||||
} | |||||
_git |
@ -0,0 +1,348 @@ | |||||
#compdef spt | |||||
autoload -U is-at-least | |||||
_spt() { | |||||
typeset -A opt_args | |||||
typeset -a _arguments_options | |||||
local ret=1 | |||||
if is-at-least 5.2; then | |||||
_arguments_options=(-s -S -C) | |||||
else | |||||
_arguments_options=(-s -C) | |||||
fi | |||||
local context curcontext="$curcontext" state line | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-t+[Set the tick rate (milliseconds): the lower the number the higher the FPS.]' \ | |||||
'--tick-rate=[Set the tick rate (milliseconds): the lower the number the higher the FPS.]' \ | |||||
'-c+[Specify configuration file path.]' \ | |||||
'--config=[Specify configuration file path.]' \ | |||||
'--completions=[Generates completions for your preferred shell]: :(bash zsh fish power-shell elvish)' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
":: :_spt_commands" \ | |||||
"*::: :->spotify-tui" \ | |||||
&& ret=0 | |||||
case $state in | |||||
(spotify-tui) | |||||
words=($line[1] "${words[@]}") | |||||
(( CURRENT += 1 )) | |||||
curcontext="${curcontext%:*:*}:spt-command-$line[1]:" | |||||
case $line[1] in | |||||
(pb) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-d+[Specifies the spotify device to use]' \ | |||||
'--device=[Specifies the spotify device to use]' \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'--transfer=[Transfers the playback to new DEVICE]' \ | |||||
'-v+[Sets the volume of a device to VOLUME (1 - 100)]' \ | |||||
'--volume=[Sets the volume of a device to VOLUME (1 - 100)]' \ | |||||
'-t[Pauses/resumes the playback of a device]' \ | |||||
'--toggle[Pauses/resumes the playback of a device]' \ | |||||
'-s[Prints out the current status of a device (default)]' \ | |||||
'--status[Prints out the current status of a device (default)]' \ | |||||
'--share-track[Returns the url to the current track]' \ | |||||
'--share-album[Returns the url to the album of the current track]' \ | |||||
'--like[Likes the current song]' \ | |||||
'--shuffle[Toggles shuffle mode]' \ | |||||
'--repeat[Switches between repeat modes]' \ | |||||
'*-n[Jumps to the next song]' \ | |||||
'*--next[Jumps to the next song]' \ | |||||
'*-p[Jumps to the previous song]' \ | |||||
'*--previous[Jumps to the previous song]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
(playback) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-d+[Specifies the spotify device to use]' \ | |||||
'--device=[Specifies the spotify device to use]' \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'--transfer=[Transfers the playback to new DEVICE]' \ | |||||
'-v+[Sets the volume of a device to VOLUME (1 - 100)]' \ | |||||
'--volume=[Sets the volume of a device to VOLUME (1 - 100)]' \ | |||||
'-t[Pauses/resumes the playback of a device]' \ | |||||
'--toggle[Pauses/resumes the playback of a device]' \ | |||||
'-s[Prints out the current status of a device (default)]' \ | |||||
'--status[Prints out the current status of a device (default)]' \ | |||||
'--share-track[Returns the url to the current track]' \ | |||||
'--share-album[Returns the url to the album of the current track]' \ | |||||
'--like[Likes the current song]' \ | |||||
'--shuffle[Toggles shuffle mode]' \ | |||||
'--repeat[Switches between repeat modes]' \ | |||||
'*-n[Jumps to the next song]' \ | |||||
'*--next[Jumps to the next song]' \ | |||||
'*-p[Jumps to the previous song]' \ | |||||
'*--previous[Jumps to the previous song]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
(p) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-d+[Specifies the spotify device to use]' \ | |||||
'--device=[Specifies the spotify device to use]' \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'-u+[Plays the URI]' \ | |||||
'--uri=[Plays the URI]' \ | |||||
'-n+[Plays the first match with NAME from the specified category]' \ | |||||
'--name=[Plays the first match with NAME from the specified category]' \ | |||||
'(-b --album -a --artist -p --playlist -w --show)-q[Adds track to queue instead of playing it directly]' \ | |||||
'(-b --album -a --artist -p --playlist -w --show)--queue[Adds track to queue instead of playing it directly]' \ | |||||
'(-t --track -b --album -a --artist -w --show)-r[Plays a random track (only works with playlists)]' \ | |||||
'(-t --track -b --album -a --artist -w --show)--random[Plays a random track (only works with playlists)]' \ | |||||
'-b[Looks for an album]' \ | |||||
'--album[Looks for an album]' \ | |||||
'-a[Looks for an artist]' \ | |||||
'--artist[Looks for an artist]' \ | |||||
'-t[Looks for a track]' \ | |||||
'--track[Looks for a track]' \ | |||||
'-w[Looks for a show]' \ | |||||
'--show[Looks for a show]' \ | |||||
'-p[Looks for a playlist]' \ | |||||
'--playlist[Looks for a playlist]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
(play) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-d+[Specifies the spotify device to use]' \ | |||||
'--device=[Specifies the spotify device to use]' \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'-u+[Plays the URI]' \ | |||||
'--uri=[Plays the URI]' \ | |||||
'-n+[Plays the first match with NAME from the specified category]' \ | |||||
'--name=[Plays the first match with NAME from the specified category]' \ | |||||
'(-b --album -a --artist -p --playlist -w --show)-q[Adds track to queue instead of playing it directly]' \ | |||||
'(-b --album -a --artist -p --playlist -w --show)--queue[Adds track to queue instead of playing it directly]' \ | |||||
'(-t --track -b --album -a --artist -w --show)-r[Plays a random track (only works with playlists)]' \ | |||||
'(-t --track -b --album -a --artist -w --show)--random[Plays a random track (only works with playlists)]' \ | |||||
'-b[Looks for an album]' \ | |||||
'--album[Looks for an album]' \ | |||||
'-a[Looks for an artist]' \ | |||||
'--artist[Looks for an artist]' \ | |||||
'-t[Looks for a track]' \ | |||||
'--track[Looks for a track]' \ | |||||
'-w[Looks for a show]' \ | |||||
'--show[Looks for a show]' \ | |||||
'-p[Looks for a playlist]' \ | |||||
'--playlist[Looks for a playlist]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
(l) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'--limit=[Specifies the maximum number of results (1 - 50)]' \ | |||||
'-d[Lists devices]' \ | |||||
'--devices[Lists devices]' \ | |||||
'-p[Lists playlists]' \ | |||||
'--playlists[Lists playlists]' \ | |||||
'--liked[Lists liked songs]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
(list) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'--limit=[Specifies the maximum number of results (1 - 50)]' \ | |||||
'-d[Lists devices]' \ | |||||
'--devices[Lists devices]' \ | |||||
'-p[Lists playlists]' \ | |||||
'--playlists[Lists playlists]' \ | |||||
'--liked[Lists liked songs]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
(s) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'--limit=[Specifies the maximum number of results (1 - 50)]' \ | |||||
'-b[Looks for albums]' \ | |||||
'--albums[Looks for albums]' \ | |||||
'-a[Looks for artists]' \ | |||||
'--artists[Looks for artists]' \ | |||||
'-p[Looks for playlists]' \ | |||||
'--playlists[Looks for playlists]' \ | |||||
'-t[Looks for tracks]' \ | |||||
'--tracks[Looks for tracks]' \ | |||||
'-w[Looks for shows]' \ | |||||
'--shows[Looks for shows]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
':search -- Specifies the search query:_files' \ | |||||
&& ret=0 | |||||
;; | |||||
(search) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-f+[Specifies the output format]' \ | |||||
'--format=[Specifies the output format]' \ | |||||
'--limit=[Specifies the maximum number of results (1 - 50)]' \ | |||||
'-b[Looks for albums]' \ | |||||
'--albums[Looks for albums]' \ | |||||
'-a[Looks for artists]' \ | |||||
'--artists[Looks for artists]' \ | |||||
'-p[Looks for playlists]' \ | |||||
'--playlists[Looks for playlists]' \ | |||||
'-t[Looks for tracks]' \ | |||||
'--tracks[Looks for tracks]' \ | |||||
'-w[Looks for shows]' \ | |||||
'--shows[Looks for shows]' \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
':search -- Specifies the search query:_files' \ | |||||
&& ret=0 | |||||
;; | |||||
(help) | |||||
_arguments "${_arguments_options[@]}" \ | |||||
'-h[Prints help information]' \ | |||||
'--help[Prints help information]' \ | |||||
'-V[Prints version information]' \ | |||||
'--version[Prints version information]' \ | |||||
&& ret=0 | |||||
;; | |||||
esac | |||||
;; | |||||
esac | |||||
} | |||||
(( $+functions[_spt_commands] )) || | |||||
_spt_commands() { | |||||
local commands; commands=( | |||||
"playback:Interacts with the playback of a device" \ | |||||
"pb:Interacts with the playback of a device" \ | |||||
"play:Plays a uri or another spotify item by name" \ | |||||
"p:Plays a uri or another spotify item by name" \ | |||||
"list:Lists devices, liked songs and playlists" \ | |||||
"l:Lists devices, liked songs and playlists" \ | |||||
"search:Searches for tracks, albums and more" \ | |||||
"s:Searches for tracks, albums and more" \ | |||||
"help:Prints this message or the help of the given subcommand(s)" \ | |||||
) | |||||
_describe -t commands 'spt commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__help_commands] )) || | |||||
_spt__help_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt help commands' commands "$@" | |||||
} | |||||
(( $+functions[_l_commands] )) || | |||||
_l_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'l commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__l_commands] )) || | |||||
_spt__l_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt l commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__list_commands] )) || | |||||
_spt__list_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt list commands' commands "$@" | |||||
} | |||||
(( $+functions[_p_commands] )) || | |||||
_p_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'p commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__p_commands] )) || | |||||
_spt__p_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt p commands' commands "$@" | |||||
} | |||||
(( $+functions[_pb_commands] )) || | |||||
_pb_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'pb commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__pb_commands] )) || | |||||
_spt__pb_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt pb commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__play_commands] )) || | |||||
_spt__play_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt play commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__playback_commands] )) || | |||||
_spt__playback_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt playback commands' commands "$@" | |||||
} | |||||
(( $+functions[_s_commands] )) || | |||||
_s_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 's commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__s_commands] )) || | |||||
_spt__s_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt s commands' commands "$@" | |||||
} | |||||
(( $+functions[_spt__search_commands] )) || | |||||
_spt__search_commands() { | |||||
local commands; commands=( | |||||
) | |||||
_describe -t commands 'spt search commands' commands "$@" | |||||
} | |||||
_spt "$@" |
@ -0,0 +1,30 @@ | |||||
#compdef _tmuxinator tmuxinator | |||||
_tmuxinator() { | |||||
local commands projects | |||||
commands=(${(f)"$(tmuxinator commands zsh)"}) | |||||
projects=(${(f)"$(tmuxinator completions start)"}) | |||||
if (( CURRENT == 2 )); then | |||||
_alternative \ | |||||
'commands:: _describe -t commands "tmuxinator subcommands" commands' \ | |||||
'projects:: _describe -t projects "tmuxinator projects" projects' | |||||
elif (( CURRENT == 3)); then | |||||
case $words[2] in | |||||
copy|cp|c|debug|delete|rm|open|o|start|s|edit|e) | |||||
_arguments '*:projects:($projects)' | |||||
;; | |||||
esac | |||||
fi | |||||
return | |||||
} | |||||
# Local Variables: | |||||
# mode: Shell-Script | |||||
# sh-indentation: 2 | |||||
# indent-tabs-mode: nil | |||||
# sh-basic-offset: 2 | |||||
# End: | |||||
# vim: ft=zsh sw=2 ts=2 et |
@ -0,0 +1 @@ | |||||
/home/yigit/.dotfiles/zsh/completions |