mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Merge branch 'ohmyzsh:master' into conda
This commit is contained in:
commit
88097374c3
37 changed files with 978 additions and 1177 deletions
|
|
@ -4,8 +4,8 @@ if (( ${+commands[op]} )); then
|
|||
fi
|
||||
|
||||
# opswd puts the password of the named service into the clipboard. If there's a
|
||||
# one time password, it will be copied into the clipboard after 5 seconds. The
|
||||
# clipboard is cleared after another 10 seconds.
|
||||
# one time password, it will be copied into the clipboard after 10 seconds. The
|
||||
# clipboard is cleared after another 20 seconds.
|
||||
function opswd() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Usage: opswd <service>"
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
# Django plugin
|
||||
|
||||
This plugin adds completion for the [Django Project](https://www.djangoproject.com/) commands
|
||||
(`manage.py`, `django-admin`, ...).
|
||||
|
||||
## Deprecation (2021-09-22)
|
||||
|
||||
The plugin used to provide completion for `./manage.py` and `django-admin`, but Zsh already provides
|
||||
a better, more extensive completion for those, so this plugin is no longer needed.
|
||||
|
||||
Right now a warning message is shown, but in the near future the plugin will stop working altogether.
|
||||
So you can remove it from your plugins and you'll automatically start using Zsh's django completion.
|
||||
|
|
@ -1,407 +0,0 @@
|
|||
#compdef manage.py
|
||||
|
||||
typeset -ga nul_args
|
||||
nul_args=(
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))'
|
||||
'--settings=-[the Python path to a settings module.]:file:_files'
|
||||
'--pythonpath=-[a directory to add to the Python path.]:directory:_directories'
|
||||
'--traceback[print traceback on exception.]'
|
||||
"--no-color[Don't colorize the command output.]"
|
||||
"--version[show program's version number and exit.]"
|
||||
{-h,--help}'[show this help message and exit.]'
|
||||
)
|
||||
|
||||
typeset -ga start_args
|
||||
start_args=(
|
||||
'--template=-[The path or URL to load the template from.]:directory:_directories'
|
||||
'--extension=-[The file extension(s) to render (default: "py").]'
|
||||
'--name=-[The file name(s) to render.]:file:_files'
|
||||
)
|
||||
|
||||
typeset -ga db_args
|
||||
db_args=(
|
||||
'--database=-[Nominates a database. Defaults to the "default" database.]'
|
||||
)
|
||||
|
||||
typeset -ga noinput_args
|
||||
noinput_args=(
|
||||
'--noinput[tells Django to NOT prompt the user for input of any kind.]'
|
||||
)
|
||||
|
||||
typeset -ga no_init_data_args
|
||||
no_init_data_args=(
|
||||
'--no-initial-data[Tells Django not to load any initial data after database synchronization.]'
|
||||
)
|
||||
|
||||
typeset -ga tag_args
|
||||
tag_args=(
|
||||
'--tag=-[Run only checks labeled with given tag.]'
|
||||
'--list-tags[List available tags.]'
|
||||
)
|
||||
|
||||
_managepy-check(){
|
||||
_arguments -s : \
|
||||
$tag_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-changepassword(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-createcachetable(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-createsuperuser(){
|
||||
_arguments -s : \
|
||||
'--username=-[Specifies the login for the superuser.]' \
|
||||
'--email=-[Specifies the email for the superuser.]' \
|
||||
$noinput_args \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-collectstatic(){
|
||||
_arguments -s : \
|
||||
'--link[Create a symbolic link to each file instead of copying.]' \
|
||||
'--no-post-process[Do NOT post process collected files.]' \
|
||||
'--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]' \
|
||||
'--dry-run[Do everything except modify the filesystem.]' \
|
||||
'--clear[Clear the existing files using the storage before trying to copy or link the original file.]' \
|
||||
'--link[Create a symbolic link to each file instead of copying.]' \
|
||||
'--no-default-ignore[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]' \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-dbshell(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-diffsettings(){
|
||||
_arguments -s : \
|
||||
"--all[Display all settings, regardless of their value.]"
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-dumpdata(){
|
||||
_arguments -s : \
|
||||
'--format=-[Specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
|
||||
'--indent=-[Specifies the indent level to use when pretty-printing output.]' \
|
||||
'--exclude=-[An app_label or app_label.ModelName to exclude (use multiple --exclude to exclude multiple apps/models).]' \
|
||||
'--natural-foreign[Use natural foreign keys if they are available.]' \
|
||||
'--natural-primary[Use natural primary keys if they are available.]' \
|
||||
"--all[Use Django's base manager to dump all models stored in the database.]" \
|
||||
'--pks=-[Only dump objects with given primary keys.]' \
|
||||
$db_args \
|
||||
$nul_args \
|
||||
'*::appname:_applist' && ret=0
|
||||
}
|
||||
|
||||
_managepy-flush(){
|
||||
_arguments -s : \
|
||||
$no_init_data_args \
|
||||
$db_args \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-help(){
|
||||
_arguments -s : \
|
||||
'*:command:_managepy_cmds' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy_cmds(){
|
||||
local line
|
||||
local -a cmd
|
||||
_call_program help-command ./manage.py help \
|
||||
|& sed -n '/^ /s/[(), ]/ /gp' \
|
||||
| while read -A line; do cmd=($line $cmd) done
|
||||
_describe -t managepy-command 'manage.py command' cmd
|
||||
}
|
||||
|
||||
_managepy-inspectdb(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-loaddata(){
|
||||
_arguments -s : \
|
||||
'--ignorenonexistent[Ignores entries in the serialized data for fields that do not currently exist on the model.]' \
|
||||
'--app=-[Only look for fixtures in the specified app.]:appname:_applist' \
|
||||
'*::file:_files' \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-makemessages(){
|
||||
_arguments -s : \
|
||||
'--locale=-[Creates or updates the message files for the given locale(s) (e.g. pt_BR).]' \
|
||||
'--domain=-[The domain of the message files (default: "django").]' \
|
||||
'--all[Updates the message files for all existing locales.]' \
|
||||
'--extension=-[The file extension(s) to examine (default: "html,txt", or "js" if the domain is "djangojs").]' \
|
||||
'--symlinks[Follows symlinks to directories when examining source code and templates for translation strings.]' \
|
||||
'--ignore=-[Ignore files or directories matching this glob-style pattern.]' \
|
||||
"--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \
|
||||
"--no-wrap[Don't break long message lines into several lines.]" \
|
||||
"--no-location[Don't write '#: filename:line' lines.]" \
|
||||
'--no-obsolete[Remove obsolete message strings.]' \
|
||||
'--keep-pot[Keep .pot file after making messages.]' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
_managepy-makemigrations(){
|
||||
_arguments -s : \
|
||||
'--dry-run[Just show what migrations would be made]' \
|
||||
'--merge[Enable fixing of migration conflicts.]' \
|
||||
'--empty[Create an empty migration.]' \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
_managepy-migrate(){
|
||||
_arguments -s : \
|
||||
'--fake[Mark migrations as run without actually running them]' \
|
||||
'--list[Show a list of all known migrations and which are applied]' \
|
||||
$no_init_data_args \
|
||||
$noinput_args \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-runfcgi(){
|
||||
local state
|
||||
|
||||
local fcgi_opts
|
||||
fcgi_opts=(
|
||||
'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
|
||||
'host[hostname to listen on..]:'
|
||||
'port[port to listen on.]:'
|
||||
'socket[UNIX socket to listen on.]:file:_files'
|
||||
'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
|
||||
'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
|
||||
'maxspare[max number of spare processes / threads.]:'
|
||||
'minspare[min number of spare processes / threads.]:'
|
||||
'maxchildren[hard limit number of processes / threads.]:'
|
||||
'daemonize[whether to detach from terminal.]:boolean:(False True)'
|
||||
'pidfile[write the spawned process-id to this file.]:file:_files'
|
||||
'workdir[change to this directory when daemonizing.]:directory:_files'
|
||||
'outlog[write stdout to this file.]:file:_files'
|
||||
'errlog[write stderr to this file.]:file:_files'
|
||||
)
|
||||
|
||||
_arguments -s : \
|
||||
$nul_args \
|
||||
'*: :_values "FCGI Setting" $fcgi_opts' && ret=0
|
||||
}
|
||||
|
||||
_managepy-runserver(){
|
||||
_arguments -s : \
|
||||
'--ipv6[Tells Django to use an IPv6 address.]' \
|
||||
'--nothreading[Tells Django to NOT use threading.]' \
|
||||
'--noreload[Tells Django to NOT use the auto-reloader.]' \
|
||||
'--nostatic[Tells Django to NOT automatically serve static files at STATIC_URL.]' \
|
||||
'--insecure[Allows serving static files even if DEBUG is False.]' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-shell(){
|
||||
_arguments -s : \
|
||||
'--plain[Tells Django to use plain Python, not IPython.]' \
|
||||
'--no-startup[When using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.]' \
|
||||
'--interface=-[Specify an interactive interpreter interface.]:INTERFACE:((ipython bpython))' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sql(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlall(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlclear(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlcustom(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-dropindexes(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlflush(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlindexes(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlinitialdata(){
|
||||
_arguments -s : \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlsequencereset(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-squashmigrations(){
|
||||
_arguments -s : \
|
||||
'--no-optimize[Do not try to optimize the squashed operations.]' \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-startapp(){
|
||||
_arguments -s : \
|
||||
$start_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
_managepy-startproject(){
|
||||
_arguments -s : \
|
||||
$start_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-syncdb() {
|
||||
_arguments -s : \
|
||||
$noinput_args \
|
||||
$no_init_data_args \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-test() {
|
||||
_arguments -s : \
|
||||
'--failfast[Tells Django to stop running the test suite after first failed test.]' \
|
||||
'--testrunner=-[Tells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.]' \
|
||||
'--liveserver=-[Overrides the default address where the live server (used with LiveServerTestCase) is expected to run from. The default value is localhost:8081.]' \
|
||||
'--top-level-directory=-[Top level of project for unittest discovery.]' \
|
||||
'--pattern=-[The test matching pattern. Defaults to test*.py.]:' \
|
||||
$noinput_args \
|
||||
'*::appname:_applist' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-testserver() {
|
||||
_arguments -s : \
|
||||
'--addrport=-[port number or ipaddr:port to run the server on.]' \
|
||||
'--ipv6[Tells Django to use an IPv6 address.]' \
|
||||
$noinput_args \
|
||||
'*::fixture:_files' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-validate() {
|
||||
_arguments -s : \
|
||||
$tag_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-commands() {
|
||||
local -a commands
|
||||
|
||||
commands=(
|
||||
"changepassword:Change a user's password for django.contrib.auth."
|
||||
'check:Checks the entire Django project for potential problems.'
|
||||
'compilemessages:Compiles .po files to .mo files for use with builtin gettext support.'
|
||||
'createcachetable:Creates the table needed to use the SQL cache backend.'
|
||||
'createsuperuser:Used to create a superuser.'
|
||||
'collectstatic:Collect static files in a single location.'
|
||||
'dbshell:Runs the command-line client for the current DATABASE_ENGINE.'
|
||||
"diffsettings:Displays differences between the current settings.py and Django's default settings."
|
||||
'dumpdata:Output the contents of the database as a fixture of the given format.'
|
||||
'flush:Executes ``sqlflush`` on the current database.'
|
||||
'help:manage.py help.'
|
||||
'inspectdb:Introspects the database tables in the given database and outputs a Django model module.'
|
||||
'loaddata:Installs the named fixture(s) in the database.'
|
||||
'makemessages:Runs over the entire source tree of the current directory and pulls out all strings marked for translation.'
|
||||
'makemigrations:Creates new migration(s) for apps.'
|
||||
'migrate:Updates database schema. Manages both apps with migrations and those without.'
|
||||
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
|
||||
'runserver:Starts a lightweight Web server for development.'
|
||||
'shell:Runs a Python interactive interpreter.'
|
||||
'showmigrations:Shows all available migrations for the current project.'
|
||||
'sql:Prints the CREATE TABLE SQL statements for the given app name(s).'
|
||||
'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).'
|
||||
'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
|
||||
'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).'
|
||||
'sqldropindexes:Prints the DROP INDEX SQL statements for the given model module name(s).'
|
||||
'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.'
|
||||
'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).'
|
||||
"sqlinitialdata:RENAMED: see 'sqlcustom'"
|
||||
'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).'
|
||||
'squashmigrations:Squashes an existing set of migrations (from first until specified) into a single new one.'
|
||||
"startapp:Creates a Django app directory structure for the given app name in this project's directory."
|
||||
"startproject:Creates a Django project directory structure for the given project name in this current directory."
|
||||
"syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
|
||||
'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.'
|
||||
'testserver:Runs a development server with data from the given fixture(s).'
|
||||
'validate:Validates all installed models.'
|
||||
)
|
||||
|
||||
_describe -t commands 'manage.py command' commands && ret=0
|
||||
}
|
||||
|
||||
_applist() {
|
||||
local line
|
||||
local -a apps
|
||||
_call_program help-command "python -c \"import sys; del sys.path[0];\\
|
||||
import os.path as op, re, django.conf;\\
|
||||
bn=op.basename(op.abspath(op.curdir));[sys\\
|
||||
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
|
||||
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
|
||||
INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \
|
||||
| while read -A line; do apps=($line $apps) done
|
||||
_values 'Application' $apps && ret=0
|
||||
}
|
||||
|
||||
_managepy() {
|
||||
local curcontext=$curcontext ret=1
|
||||
|
||||
if ((CURRENT == 2)); then
|
||||
_managepy-commands
|
||||
else
|
||||
shift words
|
||||
(( CURRENT -- ))
|
||||
curcontext="${curcontext%:*:*}:managepy-$words[1]:"
|
||||
_call_function ret _managepy-$words[1]
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _managepy manage.py
|
||||
compdef _managepy django
|
||||
compdef _managepy django-admin
|
||||
compdef _managepy django-admin.py
|
||||
compdef _managepy django-manage
|
||||
|
||||
print -P "%F{yellow}The django plugin is deprecated in favor of Zsh's Django completion.
|
||||
%BPlease remove it from your plugins to stop using it.%b%f"
|
||||
|
|
@ -33,8 +33,9 @@ if [ -z "$script" ]; then
|
|||
bash_completion='/usr/share/bash-completion/completions/'
|
||||
|
||||
locations=(
|
||||
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
||||
"${${funcsourcetrace[1]%:*}:A:h}"/git-completion.bash
|
||||
"$HOME/.local/share/bash-completion/completions/git"
|
||||
'/usr/local/share/bash-completion/completions/git'
|
||||
"$bash_completion/git"
|
||||
'/etc/bash_completion.d/git' # old debian
|
||||
)
|
||||
|
|
@ -51,13 +52,20 @@ functions[complete]="$old_complete"
|
|||
|
||||
__gitcompadd ()
|
||||
{
|
||||
compadd -Q -p "${2-}" -S "${3- }" ${@[4,-1]} -- ${=1} && _ret=0
|
||||
compadd -p "${2-}" -S "${3- }" -q -- ${=1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
IFS=$' \t\n' __gitcompadd "$1" "${2-}" "${4- }"
|
||||
}
|
||||
|
||||
__gitcomp_opts ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
local cur_="${3-$cur}"
|
||||
|
||||
[[ "$cur_" == *= ]] && return
|
||||
|
|
@ -70,7 +78,7 @@ __gitcomp ()
|
|||
break
|
||||
fi
|
||||
|
||||
if [[ -z "${4-}" ]]; then
|
||||
if [[ -z "${4+set}" ]]; then
|
||||
case $c in
|
||||
*=) c="${c%=}"; sfx="=" ;;
|
||||
*.) sfx="" ;;
|
||||
|
|
@ -79,7 +87,7 @@ __gitcomp ()
|
|||
else
|
||||
sfx="$4"
|
||||
fi
|
||||
__gitcompadd "$c" "${2-}" "$sfx" -q
|
||||
__gitcompadd "$c" "${2-}" "$sfx"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +95,10 @@ __gitcomp_nl ()
|
|||
{
|
||||
emulate -L zsh
|
||||
|
||||
IFS=$'\n' __gitcompadd "$1" "${2-}" "${4- }"
|
||||
# words that don't end up in space
|
||||
compadd -p "${2-}" -S "${4- }" -q -- ${${(f)1}:#*\ } && _ret=0
|
||||
# words that end in space
|
||||
compadd -p "${2-}" -S " ${4- }" -q -- ${${(M)${(f)1}:#*\ }% } && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_file ()
|
||||
|
|
@ -107,21 +118,6 @@ __gitcomp_file_direct ()
|
|||
__gitcomp_file "$1" ""
|
||||
}
|
||||
|
||||
__gitcomp_nl_append ()
|
||||
{
|
||||
__gitcomp_nl "$@"
|
||||
}
|
||||
|
||||
__gitcomp_direct_append ()
|
||||
{
|
||||
__gitcomp_direct "$@"
|
||||
}
|
||||
|
||||
_git_zsh ()
|
||||
{
|
||||
__gitcomp "v1.2"
|
||||
}
|
||||
|
||||
__git_complete_command ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
|
@ -206,9 +202,7 @@ __git_zsh_main ()
|
|||
{
|
||||
local curcontext="$curcontext" state state_descr line
|
||||
typeset -A opt_args
|
||||
local -a orig_words __git_C_args
|
||||
|
||||
orig_words=( ${words[@]} )
|
||||
local -a __git_C_args
|
||||
|
||||
_arguments -C \
|
||||
'(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
|
||||
|
|
@ -245,7 +239,7 @@ __git_zsh_main ()
|
|||
emulate ksh -c __git_complete_config_variable_name_and_value
|
||||
;;
|
||||
(arg)
|
||||
local command="${words[1]}" __git_dir
|
||||
local command="${words[1]}" __git_dir __git_cmd_idx=1
|
||||
|
||||
if (( $+opt_args[--bare] )); then
|
||||
__git_dir='.'
|
||||
|
|
@ -259,7 +253,7 @@ __git_zsh_main ()
|
|||
|
||||
(( $+opt_args[--help] )) && command='help'
|
||||
|
||||
words=( ${orig_words[@]} )
|
||||
words=( git ${words[@]} )
|
||||
|
||||
__git_zsh_bash_func $command
|
||||
;;
|
||||
|
|
@ -269,7 +263,7 @@ __git_zsh_main ()
|
|||
_git ()
|
||||
{
|
||||
local _ret=1
|
||||
local cur cword prev
|
||||
local cur cword prev __git_cmd_idx=0
|
||||
|
||||
cur=${words[CURRENT]}
|
||||
prev=${words[CURRENT-1]}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -138,6 +138,7 @@ __git_ps1_show_upstream ()
|
|||
done <<< "$output"
|
||||
|
||||
# parse configuration values
|
||||
local option
|
||||
for option in ${GIT_PS1_SHOWUPSTREAM}; do
|
||||
case "$option" in
|
||||
git|svn) upstream="$option" ;;
|
||||
|
|
@ -432,8 +433,8 @@ __git_ps1 ()
|
|||
fi
|
||||
|
||||
local sparse=""
|
||||
if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
|
||||
[ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&
|
||||
if [ -z "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
|
||||
[ -z "${GIT_PS1_OMITSPARSESTATE-}" ] &&
|
||||
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
|
||||
sparse="|SPARSE"
|
||||
fi
|
||||
|
|
@ -542,7 +543,7 @@ __git_ps1 ()
|
|||
u="%${ZSH_VERSION+%}"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
|
||||
if [ -n "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
|
||||
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
|
||||
h="?"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
url="https://raw.githubusercontent.com/felipec/git-completion"
|
||||
version="1.2"
|
||||
version="1.3.6"
|
||||
|
||||
curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
|
||||
curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
|
||||
|
|
|
|||
|
|
@ -15,34 +15,46 @@ Naming convention:
|
|||
|
||||
- `!` suffix: `--force --no-wait -y`.
|
||||
- `ds` suffix: `--destroy-storage`.
|
||||
- `jsh` prefix means `juju show-*`.
|
||||
|
||||
### General
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------|---------------------------------------------|--------------------------------------------------------|
|
||||
| `jdl` | `juju debug-log --ms` | Display log, with millisecond resolution |
|
||||
| `jdlr` | `juju debug-log --ms --replay` | Replay entire log |
|
||||
| `jh` | `juju help` | Show help on a command or other topic |
|
||||
| `jssl` | `juju juju show-status-log` | Output past statuses for the specified entity |
|
||||
| `jstj` | `juju status --format=json` | Show status in json format (more detailed) |
|
||||
| `jst` | `juju status --relations --storage --color` | Show status, including relations and storage, in color |
|
||||
| Alias | Command | Description |
|
||||
|---------|---------------------------------------------|--------------------------------------------------------|
|
||||
| `j` | `juju` | The juju command |
|
||||
| `jcld` | `juju clouds` | Lists all clouds with registered credentials |
|
||||
| `jclda` | `juju clouds --all` | Lists all clouds available to Juju |
|
||||
| `jdl` | `juju debug-log --ms` | Display log, with millisecond resolution |
|
||||
| `jdlr` | `juju debug-log --ms --replay` | Replay entire log |
|
||||
| `jh` | `juju help` | Show help on a command or other topic |
|
||||
| `jshsl` | `juju show-status-log` | Output past statuses for the specified entity |
|
||||
| `jstj` | `juju status --format=json` | Show status in json format (more detailed) |
|
||||
| `jst` | `juju status --relations --color` | Show status, including relations, in color |
|
||||
| `jsts` | `juju status --relations --storage --color` | Show status, including relations and storage, in color |
|
||||
|
||||
### Bootstrap
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|---------------------------|-------------------------------------------|
|
||||
| `jb` | `juju bootstrap` | Initializing a Juju cloud environment |
|
||||
| `jbm` | `juju bootstrap microk8s` | Initializing a MicroK8s cloud environment |
|
||||
| Alias | Command | Description |
|
||||
|---------|-------------------------------------|-------------------------------------------------------|
|
||||
| `jb` | `juju bootstrap` | Initializing a Juju cloud environment |
|
||||
| `jbng` | `juju bootstrap --no-gui` | Initializing a Juju cloud environment without GUI |
|
||||
| `jbl` | `juju bootstrap localhost` | Initializing an lxd cloud environment |
|
||||
| `jblng` | `juju bootstrap --no-gui localhost` | Initializing an lxd cloud environment without GUI |
|
||||
| `jbm` | `juju bootstrap microk8s` | Initializing a MicroK8s cloud environment |
|
||||
| `jbmng` | `juju bootstrap --no-gui microk8s` | Initializing a MicroK8s cloud environment without GUI |
|
||||
|
||||
### Controller
|
||||
|
||||
| Alias | Command | Description |
|
||||
|----------|---------------------------------------------------------------------------------------|-------------------------------------------------------------------|
|
||||
| `jctl` | `juju controllers` | List all controllers |
|
||||
| `jctlr` | `juju controllers --refresh` | List all controllers (download latest details) |
|
||||
| `jdc` | `juju destroy-controller --destroy-all-models` | Destroy a controller |
|
||||
| `jdc!` | `juju destroy-controller --destroy-all-models --force --no-wait -y` | Destroy a controller |
|
||||
| `jdcds` | `juju destroy-controller --destroy-all-models --destroy-storage` | Destroy a controller and associated storage |
|
||||
| `jdcds!` | `juju destroy-controller --destroy-all-models --destroy-storage --force --no-wait -y` | Destroy a controller and associated storage |
|
||||
| `jkc` | `juju kill-controller -y -t 0` | Forcibly terminate all associated resources for a Juju controller |
|
||||
| `jshc` | `juju show-controller` | Shows detailed information of a controller |
|
||||
| `jsw` | `juju switch` | Select or identify the current controller and model |
|
||||
|
||||
### Model
|
||||
|
|
@ -74,9 +86,9 @@ Naming convention:
|
|||
| `jrmds!` | `juju remove-application --destroy-storage --force --no-wait` | Remove application forcefully, destroying attached storage |
|
||||
| `jrp` | `juju refresh --path` | Upgrade charm from local charm file |
|
||||
| `jsa` | `juju scale-application` | Set the desired number of application units |
|
||||
| `jsh` | `juju ssh` | Initiate an SSH session or execute a command on a Juju target |
|
||||
| `jshc` | `juju ssh --container` | Initiate an SSH session or execute a command on a given container |
|
||||
| `jsu` | `juju show-unit` | Displays information about a unit |
|
||||
| `jssh` | `juju ssh` | Initiate an SSH session or execute a command on a Juju target |
|
||||
| `jsshc` | `juju ssh --container` | Initiate an SSH session or execute a command on a given container |
|
||||
| `jshu` | `juju show-unit` | Displays information about a unit |
|
||||
|
||||
### Storage
|
||||
|
||||
|
|
@ -113,5 +125,6 @@ Naming convention:
|
|||
|
||||
- `jaddr <app_name> [unit_num]`: display app or unit IP address.
|
||||
- `jreld <relation_name> <app_name> <unit_num>`: display app and unit relation data.
|
||||
- `jclean`: destroy all controllers
|
||||
- `wjst [interval_secs] [args_for_watch]`: watch juju status, with optional interval
|
||||
(default: 5s); you may pass additional arguments to `watch`.
|
||||
|
|
|
|||
|
|
@ -16,12 +16,22 @@ unset completion_file
|
|||
# Generally, #
|
||||
# - `!` means --force --no-wait -y #
|
||||
# - `ds` suffix means --destroy-storage #
|
||||
# - `jsh` prefix means juju show-* #
|
||||
# ---------------------------------------------------------- #
|
||||
alias j="juju"
|
||||
alias jam="juju add-model --config logging-config=\"<root>=WARNING; unit=DEBUG\"\
|
||||
--config update-status-hook-interval=\"60m\""
|
||||
alias jb='juju bootstrap'
|
||||
alias jbng='juju bootstrap --no-gui'
|
||||
alias jbl='juju bootstrap localhost'
|
||||
alias jblng='juju bootstrap --no-gui localhost'
|
||||
alias jbm='juju bootstrap microk8s'
|
||||
alias jbmng='juju bootstrap --no-gui microk8s'
|
||||
alias jc='juju config'
|
||||
alias jcld='juju clouds'
|
||||
alias jclda='juju clouds --all'
|
||||
alias jctl='juju controllers'
|
||||
alias jctlr='juju controllers --refresh'
|
||||
alias jdc='juju destroy-controller --destroy-all-models'
|
||||
alias 'jdc!'='juju destroy-controller --destroy-all-models --force --no-wait -y'
|
||||
alias jdcds='juju destroy-controller --destroy-all-models --destroy-storage'
|
||||
|
|
@ -56,13 +66,16 @@ alias jrp='juju refresh --path'
|
|||
alias jrs='juju remove-storage'
|
||||
alias 'jrs!'='juju remove-storage --force'
|
||||
alias jsa='juju scale-application'
|
||||
alias jsh='juju ssh'
|
||||
alias jshc='juju ssh --container'
|
||||
alias jsha='juju show-application'
|
||||
alias jshc='juju show-controller'
|
||||
alias jshm='juju show-model'
|
||||
alias jssl='juju show-status-log'
|
||||
alias jshsl='juju show-status-log'
|
||||
alias jshu='juju show-unit'
|
||||
alias jssh='juju ssh'
|
||||
alias jsshc='juju ssh --container'
|
||||
alias jstj='juju status --format=json'
|
||||
alias jst='juju status --relations --storage --color'
|
||||
alias jsu='juju show-unit'
|
||||
alias jst='juju status --relations --color'
|
||||
alias jsts='juju status --relations --storage --color'
|
||||
alias jsw='juju switch'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
|
|
@ -95,6 +108,37 @@ jaddr() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Destroy all controllers
|
||||
jclean() {
|
||||
if (( ! ${+commands[jq]} )); then
|
||||
echo "jq is required but could not be found." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local controllers=$(juju controllers --format=json | jq -r '.controllers | keys[]' 2>/dev/null)
|
||||
if [[ -z "$controllers" ]]; then
|
||||
echo "No controllers registered"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "This will forcefully destroy all storages, models and controllers."
|
||||
echo "Controllers to be destroyed:"
|
||||
echo "$controllers"
|
||||
|
||||
if ! read -q '?Are you sure (y/n)? '; then
|
||||
echo
|
||||
echo "Aborted."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo
|
||||
for controller in ${=controllers}; do
|
||||
timeout 2m juju destroy-controller --destroy-all-models --destroy-storage --force --no-wait -y $controller
|
||||
timeout 2m juju kill-controller -y -t 0 $controller 2>/dev/null
|
||||
timeout 10s juju unregister $controller 2>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
# Display app and unit relation data
|
||||
jreld() {
|
||||
# $1 = relation name
|
||||
|
|
@ -123,5 +167,6 @@ jreld() {
|
|||
wjst() {
|
||||
local interval="${1:-5}"
|
||||
shift $(( $# > 0 ))
|
||||
watch -n "$interval" --color juju status --relations --storage --color "$@"
|
||||
watch -n "$interval" --color juju status --relations --color "$@"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
|
|||
alias kaf='kubectl apply -f'
|
||||
|
||||
# Drop into an interactive terminal on a container
|
||||
alias keti='kubectl exec -ti'
|
||||
alias keti='kubectl exec -t -i'
|
||||
|
||||
# Manage configuration quickly to switch contexts between local, dev ad staging.
|
||||
alias kcuc='kubectl config use-context'
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ typeset -g -A kubectx_mapping
|
|||
function kubectx_prompt_info() {
|
||||
(( $+commands[kubectl] )) || return
|
||||
|
||||
local current_ctx=$(kubectl config current-context)
|
||||
local current_ctx=$(kubectl config current-context 2> /dev/null)
|
||||
|
||||
[[ -n "$current_ctx" ]] || return
|
||||
|
||||
# use value in associative array if it exists
|
||||
# otherwise fall back to the context name
|
||||
|
|
|
|||
22
plugins/multipass/README.md
Normal file
22
plugins/multipass/README.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# multipass
|
||||
|
||||
This plugin provides completion for [multipass](https://multipass.run), as well as aliases
|
||||
for multipass commands.
|
||||
|
||||
To use it, add `multipass` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... multipass)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
| ------ | ------------------------------------------------------------------- |
|
||||
| `mp` | `multipass` |
|
||||
| `mpl` | `multipass list` |
|
||||
| `mpla` | `multipass launch` |
|
||||
| `mpln` | `multipass launch --network en0 --network name=bridge0,mode=manual` |
|
||||
| `mps` | `multipass shell` |
|
||||
| `mpsp` | `multipass stop` |
|
||||
| `mpst` | `multipass start` |
|
||||
73
plugins/multipass/_multipass
Normal file
73
plugins/multipass/_multipass
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#compdef multipass
|
||||
|
||||
_multipass_get_command_list () {
|
||||
# Sample output:
|
||||
# $ multipass --help
|
||||
# ...
|
||||
# Options:
|
||||
# -h, --help Display this help
|
||||
# -v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
|
||||
# for more detail. Maximum verbosity is obtained with 4 (or more)
|
||||
# v's, i.e. -vvvv.
|
||||
# ...
|
||||
# Available commands:
|
||||
# alias Create an alias
|
||||
# aliases List available aliases
|
||||
# ...
|
||||
#
|
||||
$_comp_command1 --help | sed '1,/Available commands/d' | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_multipass_get_args_list () {
|
||||
# Sample output:
|
||||
# $ multpass help stop
|
||||
# ...
|
||||
# Options:
|
||||
# -h, --help Display this help
|
||||
# -v, --verbose Increase logging verbosity. Repeat the 'v' in the short
|
||||
# option for more detail. Maximum verbosity is obtained with
|
||||
# 4 (or more) v's, i.e. -vvvv.
|
||||
# --all Stop all instances
|
||||
# -t, --time <time> Time from now, in minutes, to delay shutdown of the
|
||||
# instance
|
||||
# -c, --cancel Cancel a pending delayed shutdown
|
||||
#
|
||||
# Arguments:
|
||||
# name Names of instances to stop. If omitted, and without the
|
||||
# --all option, 'primary' will be assumed.
|
||||
#
|
||||
local arg_name=$($_comp_command1 help ${words[2]} | sed '1,/Arguments/d' | awk '/^[ \t]*[a-z]+/ { print $1; exit }')
|
||||
|
||||
case $arg_name in
|
||||
name)
|
||||
# Sample output:
|
||||
# $ multipass list
|
||||
# Name State IPv4 Image
|
||||
# workable-poacher Running 10.2.0.28 Ubuntu openHAB Home Appliance
|
||||
#
|
||||
$_comp_command1 list | sed '1d' | awk '/^[ \t]*[^ ]+/ { print $1 }'
|
||||
;;
|
||||
command)
|
||||
_multipass_get_command_list
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_multipass () {
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'*: :->args'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
compadd $(_multipass_get_command_list)
|
||||
;;
|
||||
*)
|
||||
compadd $(_multipass_get_args_list)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_multipass "$@"
|
||||
7
plugins/multipass/multipass.plugin.zsh
Normal file
7
plugins/multipass/multipass.plugin.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
alias mp="multipass"
|
||||
alias mpl="multipass list"
|
||||
alias mpla="multipass launch"
|
||||
alias mpln="multipass launch --network en0 --network name=bridge0,mode=manual"
|
||||
alias mps="multipass shell"
|
||||
alias mpsp="multipass stop"
|
||||
alias mpst="multipass start"
|
||||
|
|
@ -1,27 +1,4 @@
|
|||
# NPX Plugin
|
||||
|
||||
> npx(1) -- execute npm package binaries. ([more info](https://github.com/npm/npx))
|
||||
|
||||
This plugin automatically registers npx command-not-found handler if `npx` exists in your `$PATH`.
|
||||
|
||||
To use it, add `npx` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(.... npx)
|
||||
```
|
||||
|
||||
## Note
|
||||
|
||||
The shell auto-fallback doesn't auto-install plain packages. In order to get it to install something, you need to add `@`:
|
||||
|
||||
```
|
||||
➜ jasmine@latest # or just `jasmine@`
|
||||
npx: installed 13 in 1.896s
|
||||
Randomized with seed 54385
|
||||
Started
|
||||
```
|
||||
|
||||
It does it this way so folks using the fallback don't accidentally try to install regular typoes.
|
||||
# npx plugin
|
||||
|
||||
## Deprecation
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
# NPX Plugin
|
||||
# https://www.npmjs.com/package/npx
|
||||
# Maintainer: Pooya Parsa <pooya@pi0.ir>
|
||||
if (( ! $+commands[npx] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
(( $+commands[npx] )) && {
|
||||
source <(npx --shell-auto-fallback zsh)
|
||||
}
|
||||
if ! npx_fallback_script="$(npx --shell-auto-fallback zsh 2>/dev/null)"; then
|
||||
print -u2 ${(%):-"%F{yellow}This \`npx\` version ($(npx --version)) is not supported.%f"}
|
||||
else
|
||||
source <(<<< "$npx_fallback_script")
|
||||
fi
|
||||
|
||||
print -u2 ${(%):-"%F{yellow}The \`npx\` plugin is deprecated and will be removed soon. %BPlease disable it%b.%f"}
|
||||
unset npx_fallback_script
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
print ${(%):-'%F{yellow}The `osx` plugin is deprecated and has been renamed to `macos`.'}
|
||||
print ${(%):-'Please update your .zshrc to use the `%Bmacos%b` plugin instead.%f'}
|
||||
print -u2 ${(%):-'%F{yellow}The `osx` plugin is deprecated and has been renamed to `macos`.'}
|
||||
print -u2 ${(%):-'Please update your .zshrc to use the `%Bmacos%b` plugin instead.%f'}
|
||||
|
||||
(( ${fpath[(Ie)$ZSH/plugins/macos]} )) || fpath=("$ZSH/plugins/macos" $fpath)
|
||||
source "$ZSH/plugins/macos/macos.plugin.zsh"
|
||||
|
|
|
|||
|
|
@ -9,4 +9,14 @@ To use it, add `rbw` to the plugins array in your zshrc file:
|
|||
plugins=(... rbw)
|
||||
```
|
||||
|
||||
## `rbwpw`
|
||||
|
||||
The `rbwpw` function is a wrapper around `rbw`. It copies the password in the
|
||||
clipboard for the service you ask for and clears the clipboard 20s later.
|
||||
The usage is as follows:
|
||||
|
||||
```zsh
|
||||
rbwpw <service>
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
|
|
|||
|
|
@ -17,3 +17,33 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rbw" ]]; then
|
|||
fi
|
||||
|
||||
rbw gen-completions zsh >| "$ZSH_CACHE_DIR/completions/_rbw" &|
|
||||
|
||||
# rbwpw function copies the password of a service to the clipboard
|
||||
# and clears it after 20 seconds
|
||||
function rbwpw {
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: rbwpw <service>"
|
||||
return 1
|
||||
fi
|
||||
local service=$1
|
||||
if ! rbw unlock; then
|
||||
echo "rbw is locked"
|
||||
return 1
|
||||
fi
|
||||
local pw=$(rbw get $service 2>/dev/null)
|
||||
if [[ -z $pw ]]; then
|
||||
echo "$service not found"
|
||||
return 1
|
||||
fi
|
||||
echo -n $pw | clipcopy
|
||||
echo "password for $service copied!"
|
||||
{sleep 20 && clipcopy </dev/null 2>/dev/null} &|
|
||||
}
|
||||
|
||||
function _rbwpw {
|
||||
local -a services
|
||||
services=("${(@f)$(rbw ls 2>/dev/null)}")
|
||||
[[ -n "$services" ]] && compadd -a -- services
|
||||
}
|
||||
|
||||
compdef _rbwpw rbwpw
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ The plugin also supports the following:
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ---------- | ---------------------- | -------------------------------------------------------- |
|
||||
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
|
||||
| `tad` | tmux attach -d -t | Detach named tmux session |
|
||||
| `ts` | tmux new-session -s | Create a new named tmux session |
|
||||
| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
|
||||
| `tksv` | tmux kill-server | Terminate all running tmux sessions |
|
||||
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
|
||||
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
|
||||
| `tmuxconf` | `$EDITOR ~/.tmux.conf` | Open .tmux.conf file with an editor |
|
||||
| Alias | Command | Description |
|
||||
| ---------- | -------------------------- | -------------------------------------------------------- |
|
||||
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
|
||||
| `tad` | tmux attach -d -t | Detach named tmux session |
|
||||
| `ts` | tmux new-session -s | Create a new named tmux session |
|
||||
| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
|
||||
| `tksv` | tmux kill-server | Terminate all running tmux sessions |
|
||||
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
|
||||
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
|
||||
| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor |
|
||||
|
||||
## Configuration Variables
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,6 @@ if ! (( $+commands[tmux] )); then
|
|||
return 1
|
||||
fi
|
||||
|
||||
# ALIASES
|
||||
|
||||
alias ta='tmux attach -t'
|
||||
alias tad='tmux attach -d -t'
|
||||
alias ts='tmux new-session -s'
|
||||
alias tl='tmux list-sessions'
|
||||
alias tksv='tmux kill-server'
|
||||
alias tkss='tmux kill-session -t'
|
||||
alias tmuxconf='$EDITOR ~/.tmux.conf'
|
||||
|
||||
# CONFIGURATION VARIABLES
|
||||
# Automatically start tmux
|
||||
: ${ZSH_TMUX_AUTOSTART:=false}
|
||||
|
|
@ -40,6 +30,16 @@ alias tmuxconf='$EDITOR ~/.tmux.conf'
|
|||
# Set -u option to support unicode
|
||||
: ${ZSH_TMUX_UNICODE:=false}
|
||||
|
||||
# ALIASES
|
||||
|
||||
alias ta='tmux attach -t'
|
||||
alias tad='tmux attach -d -t'
|
||||
alias ts='tmux new-session -s'
|
||||
alias tl='tmux list-sessions'
|
||||
alias tksv='tmux kill-server'
|
||||
alias tkss='tmux kill-session -t'
|
||||
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
|
||||
|
||||
# Determine if the terminal supports 256 colors
|
||||
if [[ $terminfo[colors] == 256 ]]; then
|
||||
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
|
||||
|
|
|
|||
|
|
@ -56,7 +56,13 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
|||
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
|
||||
# We've just left the repo, deactivate the environment
|
||||
# Note: this only happens if the virtualenv was activated automatically
|
||||
deactivate && unset CD_VIRTUAL_ENV
|
||||
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||
# Only deactivate if VIRTUAL_ENV was set
|
||||
# User may have deactivated manually or via another mechanism
|
||||
deactivate
|
||||
fi
|
||||
# clean up regardless
|
||||
unset CD_VIRTUAL_ENV
|
||||
fi
|
||||
if [[ "$ENV_NAME" != "" ]]; then
|
||||
# Activate the environment only if it is not already active
|
||||
|
|
|
|||
|
|
@ -9,6 +9,15 @@ To use it, add `yarn` to the plugins array in your zshrc file:
|
|||
plugins=(... yarn)
|
||||
```
|
||||
|
||||
## Global scripts directory
|
||||
|
||||
It also adds `yarn` global scripts dir (commonly `~/.yarn/bin`) to the `$PATH`.
|
||||
To disable this feature, set the following style in your `.zshrc`:
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:yarn' global-path false
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
# Skip yarn call if default global bin dir exists
|
||||
[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)"
|
||||
if zstyle -T ':omz:plugins:yarn' global-path; then
|
||||
# Skip yarn call if default global bin dir exists
|
||||
[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)"
|
||||
|
||||
# Add yarn bin directory to $PATH if it exists and not already in $PATH
|
||||
[[ $? -eq 0 ]] \
|
||||
&& [[ -d "$bindir" ]] \
|
||||
&& (( ! ${path[(Ie)$bindir]} )) \
|
||||
&& path+=("$bindir")
|
||||
unset bindir
|
||||
# Add yarn bin directory to $PATH if it exists and not already in $PATH
|
||||
[[ $? -eq 0 ]] \
|
||||
&& [[ -d "$bindir" ]] \
|
||||
&& (( ! ${path[(Ie)$bindir]} )) \
|
||||
&& path+=("$bindir")
|
||||
unset bindir
|
||||
fi
|
||||
|
||||
alias y="yarn"
|
||||
alias ya="yarn add"
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# zsh_reload plugin
|
||||
|
||||
**This plugin is deprecated.** Use `omz reload` or `exec zsh` instead.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
print ${(%):-"%F{yellow}The \`zsh_reload\` plugin is deprecated and will be removed."}
|
||||
print ${(%):-"Use \`%Bomz reload%b\` or \`%Bexec zsh%b\` instead.%f"}
|
||||
|
||||
src() {
|
||||
print ${(%):-"%F{yellow}$0 is deprecated. Use \`%Bomz reload%b\` or \`%Bexec zsh%b\` instead.%f\n"}
|
||||
omz reload
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue