no more lib

This commit is contained in:
Daylin Morgan 2023-03-30 10:58:31 -05:00
parent 4d0e0974b2
commit 9e892436ee
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
16 changed files with 0 additions and 1701 deletions

View file

@ -1,76 +0,0 @@
#!/usr/bin/env zsh
alias aliases="alias | sed 's/=.*//'"
alias functions="declare -f | grep '^[a-z].* ()' | sed 's/{$//'"
alias reload="source ~/.zshrc"
alias rr="rm -rf"
alias c="clear"
# ls -> lsd | swap ls for ls-deluxe if it exists
alias ls='ls --color=auto'
alias l='ls -lh'
alias la="ls -a"
alias ll="ls -lhA"
alias lr='ls -R'
alias lla="ls -la"
alias lsl="ls -lhFA --color=always | less"
alias left='ls -t -1'
if is-executable lsd; then
is-tty && alias lsd="lsd --icon never"
alias ls='lsd'
alias lt='lsd --tree --depth=3'
else
alias lt="tree -L 3"
fi
is-executable lazygit && alias lg=lazygit
alias rc="rclone --filter-from ~/.config/rclone/filter-file.txt"
# prefer lvim > nvim > vim
if is-executable lvim; then
alias vim=lvim
elif is-executable nvim; then
alias vim=nvim
fi
is-executable gdu && alias gdu -I '.*node_modules' -H
alias fzf-bat="fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'"
alias vivaldi="vivaldi-stable"
if is-executable zellij; then
alias zs="zellij -s"
alias zl="zellij ls"
alias za="zellij a"
fi
alias zenith="zenith -d 0 -n 0"
alias pdm-start='eval "$(pdm shell)"'
# GNU make
alias mkrt='make -C $(git rev-parse --show-toplevel)'
alias mk="make"
alias mkc="make -C"
alias umamba="micromamba"
alias g="git"
## TODO: make lock state aware function
is-executable gum && alias plz="gum input --prompt='🔒' --password | sudo -nS"
alias dockdots='docker run --rm -it -u "$(id -u):$(id -g)" -v "$PWD:/home/$USER/data" dots'
# tmux
alias t-labbook="$DOTFILES_DIR/tmux/labbook.sh"
# source custom tmux.conf with older tmux
alias tmux="tmux -f ~/.config/tmux/tmux.conf"
alias t='tmux'
alias tn='tmux new-session'
alias tl='tmux list-sessions'

View file

@ -1,27 +0,0 @@
#!/usr/bin/env zsh
autoload -Uz compinit
compinit
# XDG
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.local/cache}"
export HISTFILE=~/.zsh_history
export HISTSIZE=32768
export HISTFILESIZE="${HISTSIZE}"
export SAVEHIST=4096
export HISTCONTROL=ignoredups:erasedups
export LESS='-R'
export LS_COLORS="ow=1;34:tw=1;34:st=00;"
# add completions to fpath
fpath=($DOTFILES_DIR/lib/completions $fpath)
# Append to the history file, rather than overwriting it
setopt APPEND_HISTORY
# Disable autocd
unsetopt autocd

View file

@ -1,154 +0,0 @@
#compdef just
autoload -U is-at-least
_just() {
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
local common=(
'--chooser=[Override binary invoked by `--choose`]' \
'--color=[Print colorful output]: :(auto always never)' \
'--dump-format=[Dump justfile as <FORMAT>]: :(just json)' \
'--list-heading=[Print <TEXT> before list]' \
'--list-prefix=[Print <TEXT> before each list item]' \
'-f+[Use <JUSTFILE> as justfile]' \
'--justfile=[Use <JUSTFILE> as justfile]' \
'*--set[Override <VARIABLE> with <VALUE>]: :_just_variables' \
'--shell=[Invoke <SHELL> to run recipes]' \
'*--shell-arg=[Invoke shell with <SHELL-ARG> as an argument]' \
'-d+[Use <WORKING-DIRECTORY> as working directory. --justfile must also be set]' \
'--working-directory=[Use <WORKING-DIRECTORY> as working directory. --justfile must also be set]' \
'-c+[Run an arbitrary command with the working directory, `.env`, overrides, and exports set]' \
'--command=[Run an arbitrary command with the working directory, `.env`, overrides, and exports set]' \
'--completions=[Print shell completion script for <SHELL>]: :(zsh bash fish powershell elvish)' \
'-s+[Show information about <RECIPE>]: :_just_commands' \
'--show=[Show information about <RECIPE>]: :_just_commands' \
'(--dotenv-path)--dotenv-filename=[Search for environment file named <DOTENV-FILENAME> instead of `.env`]' \
'--dotenv-path=[Load environment file at <DOTENV-PATH> instead of searching for one]' \
'--check[Run `--fmt` in '\''check'\'' mode. Exits with 0 if justfile is formatted correctly. Exits with 1 and prints a diff if formatting is required.]' \
'(-q --quiet)--dry-run[Print what just would do without doing it]' \
'--highlight[Highlight echoed recipe lines in bold]' \
'--no-dotenv[Don'\''t load `.env` file]' \
'--no-highlight[Don'\''t highlight echoed recipe lines in bold]' \
'(--dry-run)-q[Suppress all output]' \
'(--dry-run)--quiet[Suppress all output]' \
'--shell-command[Invoke <COMMAND> with the shell used to run recipe lines and backticks]' \
'--clear-shell-args[Clear shell arguments]' \
'-u[Return list and summary entries in source order]' \
'--unsorted[Return list and summary entries in source order]' \
'--unstable[Enable unstable features]' \
'*-v[Use verbose output]' \
'*--verbose[Use verbose output]' \
'--changelog[Print changelog]' \
'--choose[Select one or more recipes to run using a binary. If `--chooser` is not passed the chooser defaults to the value of $JUST_CHOOSER, falling back to `fzf`]' \
'--dump[Print justfile]' \
'-e[Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`]' \
'--edit[Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`]' \
'--evaluate[Evaluate and print all variables. If a variable name is given as an argument, only print that variable'\''s value.]' \
'--fmt[Format and overwrite justfile]' \
'--init[Initialize new justfile in project root]' \
'-l[List available recipes and their arguments]' \
'--list[List available recipes and their arguments]' \
'--summary[List names of available recipes]' \
'--variables[List names of variables]' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
)
_arguments "${_arguments_options[@]}" $common \
'1: :_just_commands' \
'*: :->args' \
&& ret=0
case $state in
args)
curcontext="${curcontext%:*}-${words[2]}:"
local lastarg=${words[${#words}]}
local recipe
local cmds; cmds=(
${(s: :)$(_call_program commands just --summary)}
)
# Find first recipe name
for ((i = 2; i < $#words; i++ )) do
if [[ ${cmds[(I)${words[i]}]} -gt 0 ]]; then
recipe=${words[i]}
break
fi
done
if [[ $lastarg = */* ]]; then
# Arguments contain slash would be recognised as a file
_arguments -s -S $common '*:: :_files'
elif [[ $lastarg = *=* ]]; then
# Arguments contain equal would be recognised as a variable
_message "value"
elif [[ $recipe ]]; then
# Show usage message
_message "`just --show $recipe`"
# Or complete with other commands
#_arguments -s -S $common '*:: :_just_commands'
else
_arguments -s -S $common '*:: :_just_commands'
fi
;;
esac
return ret
}
(( $+functions[_just_commands] )) ||
_just_commands() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local variables; variables=(
${(s: :)$(_call_program commands just --variables)}
)
local commands; commands=(
${${${(M)"${(f)$(_call_program commands just --list)}":# *}/ ##/}/ ##/:Args: }
)
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
*) _message 'value' && ret=0 ;;
esac
else
_describe -t variables 'variables' variables -qS "=" && ret=0
_describe -t commands 'just commands' commands "$@"
fi
}
(( $+functions[_just_variables] )) ||
_just_variables() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local variables; variables=(
${(s: :)$(_call_program commands just --variables)}
)
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
*) _message 'value' && ret=0 ;;
esac
else
_describe -t variables 'variables' variables && ret=0
fi
return ret
}
_just "$@"

View file

@ -1,81 +0,0 @@
#compdef lsd
autoload -U is-at-least
_lsd() {
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[@]}" \
'*--color=[When to use terminal colours]: :(always auto never)' \
'*--icon=[When to print the icons]: :(always auto never)' \
'*--icon-theme=[Whether to use fancy or unicode icons]: :(fancy unicode)' \
'--config-file=[Provide a custom lsd configuration file]' \
'*--depth=[Stop recursing into directories after reaching specified depth]' \
'*--size=[How to display size]: :(default short bytes)' \
'*--date=[How to display date \[possible values: date, relative, +date-time-format\]]' \
'*--sort=[sort by WORD instead of name]: :(size time version extension)' \
'*--group-dirs=[Sort the directories then the files]: :(none first last)' \
'*--blocks=[Specify the blocks that will be displayed and in what order]: :(permission user group size date name inode links)' \
'*-I+[Do not display files/directories with names matching the glob pattern(s). More than one can be specified by repeating the argument]' \
'*--ignore-glob=[Do not display files/directories with names matching the glob pattern(s). More than one can be specified by repeating the argument]' \
'*-a[Do not ignore entries starting with .]' \
'*--all[Do not ignore entries starting with .]' \
'*-A[Do not list implied . and ..]' \
'*--almost-all[Do not list implied . and ..]' \
'*-F[Append indicator (one of */=>@|) at the end of the file names]' \
'*--classify[Append indicator (one of */=>@|) at the end of the file names]' \
'*-l[Display extended file metadata as a table]' \
'*--long[Display extended file metadata as a table]' \
'--ignore-config[Ignore the configuration file]' \
'*-1[Display one entry per line]' \
'*--oneline[Display one entry per line]' \
'(--tree)*-R[Recurse into directories]' \
'(--tree)*--recursive[Recurse into directories]' \
'*-h[For ls compatibility purposes ONLY, currently set by default]' \
'*--human-readable[For ls compatibility purposes ONLY, currently set by default]' \
'(-R --recursive)*--tree[Recurse into directories and present the result as a tree]' \
'(--depth -R --recursive)-d[Display directories themselves, and not their contents (recursively when used with --tree)]' \
'(--depth -R --recursive)--directory-only[Display directories themselves, and not their contents (recursively when used with --tree)]' \
'*--total-size[Display the total size of directories]' \
'*-t[Sort by time modified]' \
'*--timesort[Sort by time modified]' \
'*-S[Sort by size]' \
'*--sizesort[Sort by size]' \
'*-X[Sort by file extension]' \
'*--extensionsort[Sort by file extension]' \
'*-v[Natural sort of (version) numbers within text]' \
'*--versionsort[Natural sort of (version) numbers within text]' \
'*-r[Reverse the order of the sort]' \
'*--reverse[Reverse the order of the sort]' \
'--classic[Enable classic mode (display output similar to ls)]' \
'*--no-symlink[Do not display symlink target]' \
'*-i[Display the index number of each file]' \
'*--inode[Display the index number of each file]' \
'*-L[When showing file information for a symbolic link, show information for the file the link references rather than for the link itself]' \
'*--dereference[When showing file information for a symbolic link, show information for the file the link references rather than for the link itself]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::FILE:_files' \
&& ret=0
}
(( $+functions[_lsd_commands] )) ||
_lsd_commands() {
local commands; commands=(
)
_describe -t commands 'lsd commands' commands "$@"
}
_lsd "$@"

View file

@ -1,474 +0,0 @@
#compdef pdm
PDM_PYTHON="$HOME/.local/pipx/venvs/pdm/bin/python"
PDM_PIP_INDEXES=($(command ${PDM_PYTHON} -m pdm config pypi.url))
_pdm() {
emulate -L zsh -o extended_glob
typeset -A opt_args
local context state state_descr line
local curcontext=$curcontext ret=1
local -a arguments=(
{-h,--help}'[Show help message and exit]'
{-v,--verbose}'[Show detailed output]'
)
local sub_commands=(
'add:Add package(s) to pyproject.toml and install them'
'build:Build artifacts for distribution'
'cache:Control the caches of PDM'
'completion:Generate completion scripts for the given shell'
'config:Display the current configuration'
'export:Export the locked packages set to other formats'
'import:Import project metadata from other formats'
'info:Show the project information'
'init:Initialize a pyproject.toml for PDM'
'install:Install dependencies from lock file'
'list:List packages installed in the current working set'
'lock:Resolve and lock dependencies'
'plugin:Manage the PDM plugins'
'publish:Build and publish the project to PyPI'
'remove:Remove packages from pyproject.toml'
'run:Run commands or scripts with local packages loaded'
'search:Search for PyPI packages'
'show:Show the package information'
'sync:Synchronize the current working set with lock file'
'update:Update package(s) in pyproject.toml'
'use:Use the given python version or path as base interpreter'
)
_arguments -s -C -A '-*' \
$arguments \
{-c,--config}'[Specify another config file path(env var: PDM_CONFIG_FILE)]' \
{-V,--version}'[Show the version and exit]' \
{-I,--ignore-python}'[Ignore the Python path saved in the .pdm.toml config]' \
'--pep582:Print the command line to be eval by the shell:shell:(zsh bash fish tcsh csh)' \
'*:: :->_subcmds' \
&& return 0
if (( CURRENT == 1 )); then
_describe -t commands 'pdm subcommand' sub_commands
return
fi
curcontext=${curcontext%:*}:$words[1]
case $words[1] in
add)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-d,--dev}'[Add packages into dev dependencies]'
{-G,--group}'[Specify the target dependency group to add into]:group:_pdm_groups'
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
'--no-sync[Only write pyproject.toml and do not sync the working set]'
'--save-compatible[Save compatible version specifiers]'
'--save-wildcard[Save wildcard version specifiers]'
'--save-exact[Save exact version specifiers]'
'--save-minimum[Save minimum version specifiers]'
'--update-reuse[Reuse pinned versions already present in lock file if possible]'
'--update-eager[Try to update the packages and their dependencies recursively]'
'--update-all[Update all dependencies and sub-dependencies]'
'--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
{-u,--unconstrained}'[Ignore the version constraint of packages]'
{--pre,--prerelease}'[Allow prereleases to be pinned]'
{-e+,--editable+}'[Specify editable packages]:packages'
"--no-isolation[do not isolate the build in a clean environment]"
"--dry-run[Show the difference only without modifying the lockfile content]"
'*:packages:_pdm_pip_packages'
)
;;
build)
arguments+=(
"--no-sdist[Don't build source tarballs]"
"--no-wheel[Don't build wheels]"
{-d+,--dest+}'[Target directory to put artifacts]:directory:_files -/'
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
'--no-clean[Do not clean the target directory]'
{-C,--config-setting}'[Pass options to the backend. options with a value must be specified after "=": "--config-setting=--opt(=value)" or "-C--opt(=value)"]'
"--no-isolation[do not isolate the build in a clean environment]"
)
;;
cache)
_arguments -C \
$arguments \
': :->command' \
'*:: :->args' && ret=0
case $state in
command)
local -a actions=(
"clear:Clean all the files under cache directory"
"remove:Remove files matching the given pattern"
"list:List the built wheels stored in the cache"
"info:Show the info and current size of caches"
)
_describe -t command 'pdm cache actions' actions && ret=0
;;
args)
case $words[1] in
clear)
compadd -X type 'hashes' 'http' 'wheels' 'metadata' 'packages' && ret=0
;;
*)
_message "pattern" && ret=0
;;
esac
;;
esac
return $ret
;;
config)
_arguments -s \
{-g,--global}'[Use the global project, supply the project root with `-p` option]' \
{-l,--local}"[Set config in the project's local configuration file]" \
{-d,--delete}'[Unset a configuration key]' \
'1:key:->keys' \
'2:value:_files' && return 0
if [[ $state == keys ]]; then
local l mbegin mend match keys=()
for l in ${(f)"$(command ${PDM_PYTHON} -m pdm config)"}; do
if [[ $l == (#b)" "#(*)" = "(*) ]]; then
keys+=("$match[1]:$match[2]")
fi
done
_describe -t key "key" keys && return 0
fi
;;
export)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-f+,--format+}"[Specify the export file format]:format:(pipfile poetry flit requirements setuppy)"
"--without-hashes[Don't include artifact hashes]"
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
{-o+,--output+}"[Write output to the given file, or print to stdout if not given]:output file:_files"
{-G+,--group+}'[Select group of optional-dependencies or dev-dependencies(with -d). Can be supplied multiple times, use ":all" to include all groups under the same species]:group:_pdm_groups'
{-d,--dev}"[Select dev dependencies]"
{--prod,--production}"[Unselect dev dependencies]"
"--no-default[Don't include dependencies from the default group]"
)
;;
import)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-f+,--format+}"[Specify the file format explicitly]:format:(pipfile poetry flit requirements)"
'1:filename:_files'
)
;;
info)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
'--python[Show the interpreter path]'
'--where[Show the project root path]'
'--env[Show PEP 508 environment markers]'
'--packages[Show the packages root]'
)
;;
init)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-n,--non-interactive}"[Don't ask questions but use default values]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
)
;;
install)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-G+,--group+}'[Select group of optional-dependencies or dev-dependencies(with -d). Can be supplied multiple times, use ":all" to include all groups under the same species]:group:_pdm_groups'
{-d,--dev}"[Select dev dependencies]"
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
{--prod,--production}"[Unselect dev dependencies]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
"--no-lock[Don't do lock if lock file is not found or outdated]"
"--no-default[Don\'t include dependencies from the default group]"
'--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]"
"--no-isolation[do not isolate the build in a clean environment]"
"--dry-run[Show the difference only without modifying the lock file content]"
"--check[Check if the lock file is up to date and fail otherwise]"
)
;;
list)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-r,--reverse}'[Reverse the dependency graph]'
'--json[Show the installed dependencies in JSON document format]'
'--graph[Display a graph of dependencies]'
"--freeze[Show the installed dependencies as pip's requirements.txt format]"
)
;;
lock)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
"--no-isolation[Do not isolate the build in a clean environment]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
"--refresh[Don't update pinned versions, only refresh the lock file]"
)
;;
plugin)
_arguments -C \
$arguments \
': :->command' \
'*:: :->args' && ret=0
case $state in
command)
local -a actions=(
"add:Install new plugins with PDM"
"remove:Remove plugins from PDM's environment"
"list:List all plugins installed with PDM"
)
_describe -t command 'pdm plugin actions' actions && ret=0
;;
args)
case $words[1] in
add)
arguments+=(
'--pip-args[Arguments that will be passed to pip install]:pip args:'
'*:packages:_pdm_pip_packages'
)
;;
remove)
arguments+=(
'--pip-args[Arguments that will be passed to pip uninstall]:pip args:'
{-y,--yes}'[Answer yes on the question]'
'*:packages:_pdm_pip_packages'
)
;;
*)
;;
esac
;;
esac
return $ret
;;
publish)
arguments+=(
{-r,--repository}'[The repository name or url to publish the package to }[env var: PDM_PUBLISH_REPO]]:repository:'
{-u,--username}'[The username to access the repository [env var: PDM_PUBLISH_USERNAME]]:username:'
{-P,--password}'[The password to access the repository [env var: PDM_PUBLISH_PASSWORD]]:password:'
{-S,--sign}'[Upload the package with PGP signature]'
{-i,--identity}'[GPG identity used to sign files.]:gpg identity:'
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
{-c,--comment}'[The comment to include with the distribution file.]:comment:'
"--no-build[Don't build the package before publishing]"
)
;;
remove)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-G,--group}'[Specify the target dependency group to remove from]:group:_pdm_groups'
{-d,--dev}"[Remove packages from dev dependencies]"
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
"--no-sync[Only write pyproject.toml and do not uninstall packages]"
'--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]"
"--no-isolation[do not isolate the build in a clean environment]"
"--dry-run[Show the difference only without modifying the lockfile content]"
"*:packages:_pdm_packages"
)
;;
run)
_arguments -s \
{-g,--global}'[Use the global project, supply the project root with `-p` option]' \
{-l,--list}'[Show all available scripts defined in pyproject.toml]' \
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]' \
{-s,--site-packages}'[Load site-packages from the selected interpreter]' \
'(-)1:command:->command' \
'*:arguments: _normal ' && return 0
if [[ $state == command ]]; then
_command_names -e
local local_commands=($(_pdm_scripts))
_describe "local command" local_commands
return 0
fi
;;
search)
arguments+=(
'1:query string:'
)
;;
show)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
'--name[Show name]'
'--version[Show version]'
'--summary[Show summary]'
'--license[Show license]'
'--platform[Show platform]'
'--keywords[Show keywords]'
'1:package:'
)
;;
sync)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-G+,--group+}'[Select group of optional-dependencies or dev-dependencies(with -d). Can be supplied multiple times, use ":all" to include all groups under the same species]:group:_pdm_groups'
{-d,--dev}"[Select dev dependencies]"
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
{--prod,--production}"[Unselect dev dependencies]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
'--dry-run[Only prints actions without actually running them]'
{-r,--reinstall}"[Force reinstall existing dependencies]"
'--clean[Clean unused packages]'
"--only-keep[Only keep the selected packages]"
"--no-default[Don\'t include dependencies from the default group]"
'--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]"
"--no-isolation[do not isolate the build in a clean environment]"
)
;;
update)
arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-G+,--group+}'[Select group of optional-dependencies or dev-dependencies(with -d). Can be supplied multiple times, use ":all" to include all groups under the same species]:group:_pdm_groups'
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
'--save-compatible[Save compatible version specifiers]'
'--save-wildcard[Save wildcard version specifiers]'
'--save-exact[Save exact version specifiers]'
'--save-minimum[Save minimum version specifiers]'
'--update-reuse[Reuse pinned versions already present in lock file if possible]'
'--update-eager[Try to update the packages and their dependencies recursively]'
'--update-all[Update all dependencies and sub-dependencies]'
'--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]"
"--no-sync[Only update lock file but do not sync packages]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
{-u,--unconstrained}'[Ignore the version constraint of packages]'
{--pre,--prerelease}'[Allow prereleases to be pinned]'
{-d,--dev}'[Select dev dependencies]'
{--prod,--production}"[Unselect dev dependencies]"
"--no-default[Don\'t include dependencies from the default group]"
{-t,--top}'[Only update those list in pyproject.toml]'
"--dry-run[Show the difference only without modifying the lockfile content]"
"--outdated[Show the difference only without modifying the lockfile content]"
"--no-isolation[do not isolate the build in a clean environment]"
"*:packages:_pdm_packages"
)
;;
use)
arguments+=(
{-f,--first}'[Select the first matched interpreter]'
{-i,--ignore-remembered}'[Ignore the remembered selection]'
'*:python:_files'
)
;;
esac
_arguments -s $arguments && ret=0
return ret
}
_pdm_groups() {
if [[ ! -f pyproject.toml ]]; then
_message "not a pdm project"
return 1
fi
local l groups=() in_groups=0
while IFS= read -r l; do
case $l in
"["project.optional-dependencies"]") in_groups=1 ;;
"["tool.pdm.dev-dependencies"]") in_groups=1 ;;
"["*"]") in_groups=0 ;;
*"= [")
if (( in_groups )); then
groups+=$l[(w)1]
fi
;;
esac
done <pyproject.toml
compadd -X groups -a groups
}
_get_packages_with_python() {
command ${PDM_PYTHON} - << EOF
import sys
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
import os, re
PACKAGE_REGEX = re.compile(r'^[A-Za-z][A-Za-z0-9._-]*')
def get_packages(lines):
return [PACKAGE_REGEX.match(line).group() for line in lines]
with open('pyproject.toml', 'rb') as f:
data = tomllib.load(f)
packages = get_packages(data.get('project', {}).get('dependencies', []))
for reqs in data.get('project', {}).get('optional-dependencies', {}).values():
packages.extend(get_packages(reqs))
for reqs in data.get('tool', {}).get('pdm', {}).get('dev-dependencies', {}).values():
packages.extend(get_packages(reqs))
print(*set(packages))
EOF
}
_pdm_scripts() {
local scripts=() package_dir=$($PDM_PYTHON -m pdm info --packages)
if [[ -f pyproject.toml ]]; then
local l in_scripts=0
while IFS= read -r l; do
case $l in
"["tool.pdm.scripts"]") in_scripts=1 ;;
"["*"]") in_scripts=0 ;;
*"= "*)
if (( in_scripts )); then
scripts+=$l[(w)1]
fi
;;
esac
done < pyproject.toml
fi
if [[ $package_dir != "None" ]]; then
scripts+=($package_dir/bin/*(N:t))
fi
echo $scripts
}
_pdm_packages() {
if [[ ! -f pyproject.toml ]]; then
_message "not a pdm project"
return 1
fi
local packages=(${=$(_get_packages_with_python)})
compadd -X packages -a packages
}
_pdm_caching_policy() {
[[ ! -f $1 && -n "$1"(Nm+28) ]]
}
_pdm_pip_packages_update() {
typeset -g _pdm_packages
if _cache_invalid pdm_packages || ! _retrieve_cache pdm_packages; then
local index
for index in $PDM_PIP_INDEXES; do
_pdm_packages+=($(command curl -sL $index | command sed -nE '/<a href/ s/.*>(.+)<.*/\1/p'))
done
_store_cache pdm_packages _pdm_packages
fi
}
_pdm_pip_packages() {
if (( ! $+commands[curl] || ! $+commands[sed] )); then
_message "package name"
return 1
fi
local update_policy
zstyle ":completion:${curcontext%:}:" use-cache on
zstyle -s ":completion:${curcontext%:}:" cache-policy update_policy
if [[ -z $update_policy ]]; then
zstyle ":completion:${curcontext%:}:" cache-policy _pdm_caching_policy
fi
local -a _pdm_packages
_pdm_pip_packages_update
compadd -X packages -a _pdm_packages
}
_pdm "$@"

View file

@ -1,172 +0,0 @@
#compdef sheldon
autoload -U is-at-least
_sheldon() {
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[@]}" \
'--color=[Output coloring: always, auto, or never]:WHEN: ' \
'--home=[The home directory]:PATH: ' \
'--config-dir=[The configuration directory]:PATH: ' \
'--data-dir=[The data directory]:PATH: ' \
'--config-file=[The config file]:PATH: ' \
'--lock-file=[The lock file]:PATH: ' \
'--clone-dir=[The directory where git sources are cloned to]:PATH: ' \
'--download-dir=[The directory where remote sources are downloaded to]:PATH: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'-q[Suppress any informational output]' \
'--quiet[Suppress any informational output]' \
'-v[Use verbose output]' \
'--verbose[Use verbose output]' \
":: :_sheldon_commands" \
"*::: :->sheldon" \
&& ret=0
case $state in
(sheldon)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:sheldon-command-$line[1]:"
case $line[1] in
(init)
_arguments "${_arguments_options[@]}" \
'--shell=[The type of shell, accepted values are: bash, zsh]:SHELL: ' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
'--git=[Add a clonable Git repository]:URL: ' \
'--gist=[Add a clonable Gist snippet]:ID: ' \
'--github=[Add a clonable GitHub repository]:REPO: ' \
'--remote=[Add a downloadable file]:URL: ' \
'--local=[Add a local directory]:DIR: ' \
'(--git --remote --local)--proto=[The Git protocol for a Gist or GitHub plugin]:PROTO: ' \
'--branch=[Checkout the tip of a branch]:BRANCH: ' \
'--rev=[Checkout a specific commit]:SHA: ' \
'--tag=[Checkout a specific tag]:TAG: ' \
'--dir=[Which sub directory to use in this plugin]:PATH: ' \
'*--use=[Which files to use in this plugin]:MATCH: ' \
'*--apply=[Templates to apply to this plugin]:TEMPLATE: ' \
'-h[Print help information]' \
'--help[Print help information]' \
':name -- A unique name for this plugin:' \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':name -- A unique name for this plugin:' \
&& ret=0
;;
(lock)
_arguments "${_arguments_options[@]}" \
'--update[Update all plugin sources]' \
'(--update)--reinstall[Reinstall all plugin sources]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(source)
_arguments "${_arguments_options[@]}" \
'--relock[Regenerate the lock file]' \
'--update[Update all plugin sources (implies --relock)]' \
'(--update)--reinstall[Reinstall all plugin sources (implies --relock)]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'--shell=[The type of shell, accepted values are: bash, zsh]:SHELL: ' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(version)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_sheldon_commands] )) ||
_sheldon_commands() {
local commands; commands=(
'init:Initialize a new config file' \
'add:Add a new plugin to the config file' \
'edit:Open up the config file in the default editor' \
'remove:Remove a plugin from the config file' \
'lock:Install the plugins sources and generate the lock file' \
'source:Generate and print out the script' \
'completions:Generate completions for the given shell' \
'version:Prints detailed version information' \
)
_describe -t commands 'sheldon commands' commands "$@"
}
(( $+functions[_sheldon__add_commands] )) ||
_sheldon__add_commands() {
local commands; commands=()
_describe -t commands 'sheldon add commands' commands "$@"
}
(( $+functions[_sheldon__completions_commands] )) ||
_sheldon__completions_commands() {
local commands; commands=()
_describe -t commands 'sheldon completions commands' commands "$@"
}
(( $+functions[_sheldon__edit_commands] )) ||
_sheldon__edit_commands() {
local commands; commands=()
_describe -t commands 'sheldon edit commands' commands "$@"
}
(( $+functions[_sheldon__init_commands] )) ||
_sheldon__init_commands() {
local commands; commands=()
_describe -t commands 'sheldon init commands' commands "$@"
}
(( $+functions[_sheldon__lock_commands] )) ||
_sheldon__lock_commands() {
local commands; commands=()
_describe -t commands 'sheldon lock commands' commands "$@"
}
(( $+functions[_sheldon__remove_commands] )) ||
_sheldon__remove_commands() {
local commands; commands=()
_describe -t commands 'sheldon remove commands' commands "$@"
}
(( $+functions[_sheldon__source_commands] )) ||
_sheldon__source_commands() {
local commands; commands=()
_describe -t commands 'sheldon source commands' commands "$@"
}
(( $+functions[_sheldon__version_commands] )) ||
_sheldon__version_commands() {
local commands; commands=()
_describe -t commands 'sheldon version commands' commands "$@"
}
_sheldon "$@"

View file

@ -1,60 +0,0 @@
#compdef task
local context state state_descr line
typeset -A opt_args
# Listing commands from Taskfile.yml
function __task_list() {
local -a scripts cmd
local -i enabled=0
local taskfile item task desc
cmd=(task)
taskfile="${(v)opt_args[(i)-t|--taskfile]}"
if [[ -n "$taskfile" && -f "$taskfile" ]]; then
enabled=1
cmd+=(--taskfile "$taskfile")
else
for taskfile in Taskfile{,.dist}.{yaml,yml}; do
if [[ -f "$taskfile" ]]; then
enabled=1
break
fi
done
fi
(( enabled )) || return 0
scripts=()
for item in "${(@)${(f)$("${cmd[@]}" --list-all)}[2,-1]#\* }"; do
task="${item%%:[[:space:]]*}"
desc="${item##[^[:space:]]##[[:space:]]##}"
scripts+=( "${task//:/\\:}:$desc" )
done
_describe 'Task to run' scripts
}
_arguments \
'(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \
'(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \
'(-f --force)'{-f,--force}'[run even if task is up-to-date]' \
'(-c --color)'{-c,--color}'[colored output]' \
'(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \
'(--dry)--dry[dry-run mode, compile and print tasks only]' \
'(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \
'(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \
'(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \
'(-s --silent)'{-s,--silent}'[disable echoing]' \
'(--status)--status[exit non-zero if supplied tasks not up-to-date]' \
'(--summary)--summary[show summary\: field from tasks instead of running them]' \
'(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
'(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \
+ '(operation)' \
{-l,--list}'[list describable tasks]' \
{-a,--list-all}'[list all tasks]' \
{-i,--init}'[create new Taskfile.yaml]' \
'(-*)'{-h,--help}'[show help]' \
'(-*)--version[show version and exit]' \
'*: :__task_list'

View file

@ -1,245 +0,0 @@
#compdef zellij
autoload -U is-at-least
_zellij() {
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[@]}" \
'--max-panes=[Maximum panes on screen, caution: opening more panes will close old ones]:MAX_PANES: ' \
'--data-dir=[Change where zellij looks for layouts and plugins]:DATA_DIR: ' \
'--server=[Run server listening at the specified socket path]:SERVER: ' \
'-s+[Specify name of a new session]:SESSION: ' \
'--session=[Specify name of a new session]:SESSION: ' \
'-l+[Name of a predefined layout inside the layout directory or the path to a layout file]:LAYOUT: ' \
'--layout=[Name of a predefined layout inside the layout directory or the path to a layout file]:LAYOUT: ' \
'-c+[Change where zellij looks for the configuration file]:CONFIG: ' \
'--config=[Change where zellij looks for the configuration file]:CONFIG: ' \
'--config-dir=[Change where zellij looks for the configuration directory]:CONFIG_DIR: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'-d[]' \
'--debug[]' \
":: :_zellij_commands" \
"*::: :->zellij" \
&& ret=0
case $state in
(zellij)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zellij-command-$line[1]:"
case $line[1] in
(options)
_arguments "${_arguments_options[@]}" \
'--simplified-ui=[Allow plugins to use a more simplified layout that is compatible with more fonts (true or false)]:SIMPLIFIED_UI: ' \
'--theme=[Set the default theme]:THEME: ' \
'--default-mode=[Set the default mode]:DEFAULT_MODE:((normal\:"In `Normal` mode, input is always written to the terminal, except for the shortcuts leading to other modes"
locked\:"In `Locked` mode, input is always written to the terminal and all shortcuts are disabled except the one leading back to normal mode"
resize\:"`Resize` mode allows resizing the different existing panes"
pane\:"`Pane` mode allows creating and closing panes, as well as moving between them"
tab\:"`Tab` mode allows creating and closing tabs, as well as moving between them"
scroll\:"`Scroll` mode allows scrolling up and down within a pane"
rename-tab\:"`RenameTab` mode allows assigning a new name to a tab"
rename-pane\:"`RenamePane` mode allows assigning a new name to a pane"
session\:"`Session` mode allows detaching sessions"
move\:"`Move` mode allows moving the different existing panes within a tab"
prompt\:"`Prompt` mode allows interacting with active prompts"
tmux\:"`Tmux` mode allows for basic tmux keybindings functionality"))' \
'--default-shell=[Set the default shell]:DEFAULT_SHELL: ' \
'--layout-dir=[Set the layout_dir, defaults to subdirectory of config dir]:LAYOUT_DIR: ' \
'--mouse-mode=[Set the handling of mouse events (true or false) Can be temporarily bypassed by the \[SHIFT\] key]:MOUSE_MODE: ' \
'--pane-frames=[Set display of the pane frames (true or false)]:PANE_FRAMES: ' \
'--mirror-session=[Mirror session when multiple users are connected (true or false)]:MIRROR_SESSION: ' \
'--on-force-close=[Set behaviour on force close (quit or detach)]:ON_FORCE_CLOSE:(quit detach)' \
'--scroll-buffer-size=[]:SCROLL_BUFFER_SIZE: ' \
'--copy-command=[Switch to using a user supplied command for clipboard instead of OSC52]:COPY_COMMAND: ' \
'(--copy-command)--copy-clipboard=[OSC52 destination clipboard]:COPY_CLIPBOARD:(system primary)' \
'--copy-on-select=[Automatically copy when selecting text (true or false)]:COPY_ON_SELECT: ' \
'--scrollback-editor=[Explicit full path to open the scrollback editor (default is $EDITOR or $VISUAL)]:SCROLLBACK_EDITOR: ' \
'(--mouse-mode)--disable-mouse-mode[Disable handling of mouse events]' \
'(--pane-frames)--no-pane-frames[Disable display of pane frames]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" \
'--dump-layout=[Dump the specified layout file to stdout]:DUMP_LAYOUT: ' \
'--generate-completion=[Generates completion for the specified shell]:SHELL: ' \
'--generate-auto-start=[Generates auto-start script for the specified shell]:SHELL: ' \
'--dump-config[Dump the default configuration file to stdout]' \
'--clean[Disables loading of configuration file at default location, loads the defaults that zellij ships with]' \
'--check[Checks the configuration of zellij and displays currently used directories]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(list-sessions)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(attach)
_arguments "${_arguments_options[@]}" \
'--index=[Number of the session index in the active sessions ordered creation date]:INDEX: ' \
'-c[Create a session if one does not exist]' \
'--create[Create a session if one does not exist]' \
'-h[Print help information]' \
'--help[Print help information]' \
'::session-name -- Name of the session to attach to:' \
":: :_zellij__attach_commands" \
"*::: :->attach" \
&& ret=0
case $state in
(attach)
words=($line[2] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zellij-attach-command-$line[2]:"
case $line[2] in
(options)
_arguments "${_arguments_options[@]}" \
'--simplified-ui=[Allow plugins to use a more simplified layout that is compatible with more fonts (true or false)]:SIMPLIFIED_UI: ' \
'--theme=[Set the default theme]:THEME: ' \
'--default-mode=[Set the default mode]:DEFAULT_MODE:((normal\:"In `Normal` mode, input is always written to the terminal, except for the shortcuts leading to other modes"
locked\:"In `Locked` mode, input is always written to the terminal and all shortcuts are disabled except the one leading back to normal mode"
resize\:"`Resize` mode allows resizing the different existing panes"
pane\:"`Pane` mode allows creating and closing panes, as well as moving between them"
tab\:"`Tab` mode allows creating and closing tabs, as well as moving between them"
scroll\:"`Scroll` mode allows scrolling up and down within a pane"
rename-tab\:"`RenameTab` mode allows assigning a new name to a tab"
rename-pane\:"`RenamePane` mode allows assigning a new name to a pane"
session\:"`Session` mode allows detaching sessions"
move\:"`Move` mode allows moving the different existing panes within a tab"
prompt\:"`Prompt` mode allows interacting with active prompts"
tmux\:"`Tmux` mode allows for basic tmux keybindings functionality"))' \
'--default-shell=[Set the default shell]:DEFAULT_SHELL: ' \
'--layout-dir=[Set the layout_dir, defaults to subdirectory of config dir]:LAYOUT_DIR: ' \
'--mouse-mode=[Set the handling of mouse events (true or false) Can be temporarily bypassed by the \[SHIFT\] key]:MOUSE_MODE: ' \
'--pane-frames=[Set display of the pane frames (true or false)]:PANE_FRAMES: ' \
'--mirror-session=[Mirror session when multiple users are connected (true or false)]:MIRROR_SESSION: ' \
'--on-force-close=[Set behaviour on force close (quit or detach)]:ON_FORCE_CLOSE:(quit detach)' \
'--scroll-buffer-size=[]:SCROLL_BUFFER_SIZE: ' \
'--copy-command=[Switch to using a user supplied command for clipboard instead of OSC52]:COPY_COMMAND: ' \
'(--copy-command)--copy-clipboard=[OSC52 destination clipboard]:COPY_CLIPBOARD:(system primary)' \
'--copy-on-select=[Automatically copy when selecting text (true or false)]:COPY_ON_SELECT: ' \
'--scrollback-editor=[Explicit full path to open the scrollback editor (default is $EDITOR or $VISUAL)]:SCROLLBACK_EDITOR: ' \
'(--mouse-mode)--disable-mouse-mode[Disable handling of mouse events]' \
'(--pane-frames)--no-pane-frames[Disable display of pane frames]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(kill-session)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'::target-session -- Name of target session:' \
&& ret=0
;;
(kill-all-sessions)
_arguments "${_arguments_options[@]}" \
'-y[Automatic yes to prompts]' \
'--yes[Automatic yes to prompts]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_zellij_commands] )) ||
_zellij_commands() {
local commands; commands=(
'options:Change the behaviour of zellij' \
'setup:Setup zellij and check its configuration' \
'list-sessions:List active sessions' \
'ls:List active sessions' \
'attach:Attach to a session' \
'a:Attach to a session' \
'kill-session:Kill the specific session' \
'k:Kill the specific session' \
'kill-all-sessions:Kill all sessions' \
'ka:Kill all sessions' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'zellij commands' commands "$@"
}
(( $+functions[_zellij__attach_commands] )) ||
_zellij__attach_commands() {
local commands; commands=(
'options:Change the behaviour of zellij' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'zellij attach commands' commands "$@"
}
(( $+functions[_zellij__attach__help_commands] )) ||
_zellij__attach__help_commands() {
local commands; commands=()
_describe -t commands 'zellij attach help commands' commands "$@"
}
(( $+functions[_zellij__help_commands] )) ||
_zellij__help_commands() {
local commands; commands=()
_describe -t commands 'zellij help commands' commands "$@"
}
(( $+functions[_zellij__kill-all-sessions_commands] )) ||
_zellij__kill-all-sessions_commands() {
local commands; commands=()
_describe -t commands 'zellij kill-all-sessions commands' commands "$@"
}
(( $+functions[_zellij__kill-session_commands] )) ||
_zellij__kill-session_commands() {
local commands; commands=()
_describe -t commands 'zellij kill-session commands' commands "$@"
}
(( $+functions[_zellij__list-sessions_commands] )) ||
_zellij__list-sessions_commands() {
local commands; commands=()
_describe -t commands 'zellij list-sessions commands' commands "$@"
}
(( $+functions[_zellij__attach__options_commands] )) ||
_zellij__attach__options_commands() {
local commands; commands=()
_describe -t commands 'zellij attach options commands' commands "$@"
}
(( $+functions[_zellij__options_commands] )) ||
_zellij__options_commands() {
local commands; commands=()
_describe -t commands 'zellij options commands' commands "$@"
}
(( $+functions[_zellij__setup_commands] )) ||
_zellij__setup_commands() {
local commands; commands=()
_describe -t commands 'zellij setup commands' commands "$@"
}
_zellij "$@"

View file

@ -1,22 +0,0 @@
#!/usr/bin/env zsh
CURDIR=${0:a:h}
gen() {
if is-executable $1; then
echo "$1 updated"
"$@" | sed "s#$HOME#\$HOME#g" >$CURDIR/"_$argv[1]"
else
echo "skipping $1"
fi
}
echo "GENERATING COMPLETION SCRIPTS"
echo "-----------------------------"
gen sheldon completions --shell zsh
gen just --completions zsh
gen zellij setup --generate-completion zsh
gen pdm completion zsh
# echo "FETCHING COMPLETION SCRIPTS"
# wget -O _task https://raw.githubusercontent.com/go-task/task/master/completion/zsh/_task

View file

@ -1,72 +0,0 @@
#!/usr/bin/env zsh
# Updated to use $HOME
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$("$HOME/mambaforge/bin/conda" 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then
. "$HOME/mambaforge/etc/profile.d/conda.sh"
else
export PATH="$HOME/mambaforge/bin:$PATH"
fi
fi
unset __conda_setup
if [ -f "$HOME/mambaforge/etc/profile.d/mamba.sh" ]; then
. "$HOME/mambaforge/etc/profile.d/mamba.sh"
fi
# <<< conda initialize <<<
# ! is-tty && [ -d "$HOME/mambaforge/envs/dev" ] && conda activate dev
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE="$HOME/bin/micromamba";
export MAMBA_ROOT_PREFIX="$HOME/micromamba";
__mamba_setup="$('$HOME/bin/micromamba' shell hook --shell zsh --prefix '$HOME/micromamba' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
if [ -f "$HOME/micromamba/etc/profile.d/micromamba.sh" ]; then
. "$HOME/micromamba/etc/profile.d/micromamba.sh"
else
export PATH="$HOME/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
fi
fi
unset __mamba_setup
# <<< mamba initialize <<<
# <<< mamba initialize <<<
snake() {
if [[ $1 == "no" ]]; then
if [[ $VIRTUAL_ENV != "" ]]; then
echo "deactivate python virtualenv: $VIRTUAL_ENV"
deactivate
elif [[ $CONDA_DEFAULT_ENV != "" ]]; then
echo "deactivating conda env: $CONDA_DEFAULT_ENV"
conda deactivate
else
echo 'no environment to leave'
fi
else
if [[ -d $(pwd)/env ]]; then
printf 'activating project-specific env: %s\n' "${PWD##*/}/env"
conda activate ./env
elif [[ -d $(pwd)/venv ]]; then
echo "activating python virtualenv"
source ./venv/bin/activate
elif [[ -d $(pwd)/.venv ]]; then
echo "activating python virtualenv"
source ./.venv/bin/activate
else
echo "is there an environment to activate?"
echo "I was expecting either a conda(env) or virtualenv(venv,.venv)"
fi
fi
}

View file

@ -1,66 +0,0 @@
#!/usr/bin/env zsh
is-executable nvim && export EDITOR=nvim || export EDITOR=vim
is-executable lf && source "$XDG_CONFIG_HOME/lf/lfcd.sh"
if is-executable fnm && ! is-tty; then
eval "$(fnm env --shell zsh)"
fi
is-executable bat && \
export BAT_THEME=Catppuccin; \
export BAT_STYLE=header,numbers,grid
is-executable zoxide && \
export _ZO_FZF_OPTS="--preview 'command lsd --tree --color always --icon always {2..}'"
is-tty && \
export STARSHIP_CONFIG=~/.config/starship/plain.toml \
|| \
export STARSHIP_CONFIG=~/.config/starship/config.toml
export EGET_BIN=$HOME/bin
# for dotenv
export ZSH_DOTENV_ALLOWED_LIST=$HOME/.cache/dotenv-allowed.list
export ZSH_DOTENV_DISALLOWED_LIST=$HOME/.cache/dotenv-disallowed.list
# mamba
export MAMBA_NO_BANNER=1
# shiv
is-executable shiv && export SHIV_ROOT=$HOME/.local/share/shiv
# pyenv
if [ -d "$HOME/.pyenv" ]; then
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
# pnpm
is-executable pnpm && \
export PNPM_HOME="$HOME/.local/share/pnpm"; \
add-to-path prepend "$PNPM_HOME"
[[ -d "$HOME/.pkgs/google-cloud-sdk" ]] && \
. "$HOME/.pkgs/google-cloud-sdk/completion.zsh.inc"; \
add-to-path prepend "$HOME/.pkgs/google-cloud-sdk/bin"
[ -d "$HOME/.deno" ] && \
export DENO_INSTALL="$HOME/.deno"; \
add-to-path prepend "$DENO_INSTALL/bin"
if [ -d "$HOME/.bun" ]; then
# bun completions
[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun"
# bun
export BUN_INSTALL="$HOME/.bun"
add-to-path prepend "$BUN_INSTALL/bin"
fi
[ -d "$HOME/.nimble" ] && add-to-path prepend "$HOME/.nimble/bin"

View file

@ -1,129 +0,0 @@
#!/usr/bin/env zsh
function cl() {
DIR="$*"
# if no DIR given, go home
if [ $# -lt 1 ]; then
DIR=$HOME
fi
builtin cd "${DIR}" &&
# use your preferred ls command
ls -F --color=auto
}
#delete and reclone remote repo
reclone() {
basename=${PWD##*/}
remoteurl=$(git remote get-url --push origin)
cd ..
echo $basename
echo $remoteurl
rm -rf $basename
git clone $remoteurl
cd $basename
}
# snakemake use all cores by default
sm() {
if [[ $* == *"-j"* || $* == *"--jobs"* || $* == *"--cores"* ]]; then
snakemake $@
else
snakemake -j all $@
fi
}
function gi() {
curl -sL "https://www.toptal.com/developers/gitignore/api/$@"
}
# make pdfs or svgs from vegalite json's
mkvegapdf() {
vl2vg $1 | vg2pdf >$2
}
mkvegasvg() {
vl2vg $1 | vg2svg >$2
}
# quick and dirty pdf generation from simple md
md2pdf() {
root=$1
# get extension and root path: https://stackoverflow.com/a/40928328
fname="${root#.}"
fname="${root%"$fname"}${fname%.*}"
ext="${root#"$fname"}"
echo "converting $root to pdf"
if [[ $ext != ".md" ]]; then
echo "error! expected a markdown file"
echo "unrecognized extension: $ext"
return 1
fi
pandoc -V geometry:a5paper -V geometry:margin=.5in --dpi=300 -o ${fname}.pdf $root
}
py2nb2html() {
if [ $# -eq 0 ]; then
echo "No arguments provided"
return 1
fi
pyfile=$1
shift
echo "generating html file for $pyfile"
jupytext --to notebook -o - $pyfile | jupyter nbconvert --execute --to html --stdin $@
}
alias bathelp='bat --plain --language=help'
help() {
"$@" --help 2>&1 | bathelp
}
format-qmd() {
# TODO: add support for outputs
jupytext --from qmd $1 --pipe black --opt 'notebook_metadata_filter=-all'
}
add-to-path () {
# $1 prepend/append
# $2 path
! [[ -d "$2" ]] && return 0
case ":$PATH:" in
*":$2:"*) :;; # already there
*)
if [[ "$1" == 'prepend' ]]; then
PATH="$2:$PATH"
elif [[ "$1" == 'append' ]]; then
PATH="$PATH:$2"
else
echo "please specify append/prepend not $1"
fi
;;
esac
}
print-paths() {
sed 's/:/\n/g' <<< "$PATH"
}
ta () {
tmux attach -t "$@" || tmux new-session -s "$@"
}
web () {
if [[ -z "$BROWSER" ]]; then
echo 'set $BROWSER'
return
fi
for i
do
if [[ ! -r $i ]]
then
echo "$0: file doesn't exist: \`$i'" >&2
continue
fi
$BROWSER "$i" > /dev/null 2>&1 &
disown
done
}

View file

@ -1,60 +0,0 @@
#!/usr/bin/env zsh
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "$DOTFILES_DIR/lib/plugins/fzf/completion.zsh" 2>/dev/null
# Key bindings
# ------------
[[ $- == *i* ]] && source "$DOTFILES_DIR/lib/plugins/fzf/key-bindings.zsh" 2>/dev/null
# catppuccin
FZF_COLORS="
--color=bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD
--color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96
--color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD
"
FZF_LAYOUT="
--height=40%
--border=rounded
--margin=0,5,5%
--layout=reverse
"
export FZF_DEFAULT_OPTS=${FZF_COLORS}${FZF_LAYOUT}
export FZF_CTRL_GENERAL="--height=100% --margin=0,0,0"
#adapted from https://github.com/zimfw/fzf/blob/master/init.zsh
# TODO: fix this so it works with $ **<tab>
if [ -x "$(command -v fd)" ]; then
export FZF_DEFAULT_COMMAND="command fd --type file --exclude ".git/" --hidden --no-ignore"
_fzf_compgen_path() {
command fd --type file --exclude ".git/" --hidden --no-ignore "${1}"
}
elif [ -x "$(command -v rg)" ]; then
export FZF_DEFAULT_COMMAND="command rg -uu -g '!.git' --files"
_fzf_compgen_path() {
command rg -uu -g '!.git' --files "${1}"
}
fi
if [ -x "$(command -v bat)" ]; then
export FZF_CTRL_T_OPTS="
--preview 'command bat --style numbers --color=always --line-range :500 {}'
--preview-window up,70%,border-rounded
${FZF_CTRL_GENERAL}
"
fi
export FZF_ALT_C_OPTS="
--height 60%
--preview 'lsd --tree --color always --icon always {}'
--preview-window right,60%,border-rounded
"
# [[ -v FZF_CTRL_T_COMMAND ]] && && export FZF_CTRL_T_COMMAND=${FZF_DEFAULT_COMMAND}
[[ -z $FZF_CTRL_T_COMMAND ]] && export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}"
# fix spacing on fzf-tab to show max options
zstyle ':fzf-tab:*' fzf-pad 4

View file

@ -1,15 +0,0 @@
#!/usr/bin/env zsh
add-to-path prepend "/bin"
add-to-path prepend "/usr/bin"
add-to-path prepend "/usr/local/bin"
# home paths
paths=("bin" ".local/bin" ".cargo/bin" "go/bin" ".extra/bin")
for directory in "${paths[@]}"; do
add-to-path prepend "$HOME/$directory"
done
export PATH

View file

@ -1,22 +0,0 @@
#!/usr/bin/env zsh
PLUGINS_DIR=$DOTFILES_DIR/plugins
source $PLUGINS_DIR/zsh-defer/zsh-defer.plugin.zsh
# TODO: automate collection of plugin files
plugins=(
base16/base16-shell.plugin.zsh
fzf-tab/fzf-tab.plugin.zsh
zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
oh-my-zsh/clipboard.zsh
oh-my-zsh/completion.zsh
oh-my-zsh/dotenv/dotenv.plugin.zsh
oh-my-zsh/extract/extract.plugin.zsh
)
for plugin in $plugins; do
zsh-defer source $PLUGINS_DIR/$plugin
done
unset PLUGINS_DIR plugins

View file

@ -1,26 +0,0 @@
#!/usr/bin/env zsh
is-executable zoxide && eval eval "$(zoxide init zsh --cmd cd)"
if is-executable starship; then
eval "$(starship init zsh)"
else
echo "no starship = dumber prompt"
autoload -Uz vcs_info
precmd() {
vcs_info
}
zstyle ':vcs_info:git:*' formats '%b '
setopt PROMPT_SUBST
PROMPT='%F{green}%*%f %F{blue}%~%f %F{red}${vcs_info_msg_0_}%f$ '
fi
zstyle ':completion::complete:make:*:targets' call-command true
is-executable fzf && source $DOTFILES_DIR/lib/fzf.zsh
# TODO: make this fail for both no-atuin and no is-tty
# is-executable atuin && is-tty || eval "$(atuin init zsh)"