Merge branch 'master' into minimal

This commit is contained in:
Christoph J. Scherr 2023-12-02 17:36:47 +01:00
commit 1b71d7e329
9 changed files with 4187 additions and 11 deletions

212
.config/btop/btop.conf Normal file
View File

@ -0,0 +1,212 @@
#? Config file for btop v. 1.2.13
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
color_theme = "gruvbox_dark_v2"
#* If the theme set background should be shown, set to False if you want terminal background transparency.
theme_background = False
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
truecolor = True
#* Set to true to force tty mode regardless if a real tty has been detected or not.
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
force_tty = False
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
#* Use whitespace " " as separator between different presets.
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
vim_keys = True
#* Rounded corners on boxes, is ignored if TTY mode is ON.
rounded_corners = True
#* Default symbols to use for graph creation, "braille", "block" or "tty".
#* "braille" offers the highest resolution but might not be included in all fonts.
#* "block" has half the resolution of braille but uses more common characters.
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
graph_symbol = "block"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_cpu = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_mem = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_net = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_proc = "default"
#* Manually set which boxes to show. Available values are "cpu mem net proc", separate values with whitespace.
shown_boxes = "cpu mem net proc"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = 1000
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
proc_sorting = "cpu lazy"
#* Reverse sorting order, True or False.
proc_reversed = False
#* Show processes as a tree.
proc_tree = False
#* Use the cpu graph colors in the process list.
proc_colors = True
#* Use a darkening gradient in the process list.
proc_gradient = True
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
proc_per_core = False
#* Show process memory as bytes instead of percent.
proc_mem_bytes = True
#* Show cpu graph for each process.
proc_cpu_graphs = True
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
proc_info_smaps = False
#* Show proc box on left side of screen instead of right.
proc_left = False
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
proc_filter_kernel = True
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_upper = "total"
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_lower = "user"
#* Toggles if the lower CPU graph should be inverted.
cpu_invert_lower = False
#* Set to True to completely disable the lower CPU graph.
cpu_single_graph = False
#* Show cpu box at bottom of screen instead of top.
cpu_bottom = False
#* Shows the system uptime in the CPU box.
show_uptime = True
#* Show cpu temperature.
check_temp = True
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
cpu_sensor = "Auto"
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
show_coretemp = True
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
#* Example: "4:0 5:1 6:3"
cpu_core_map = ""
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
temp_scale = "celsius"
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
base_10_sizes = False
#* Show CPU frequency.
show_cpu_freq = True
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
clock_format = "/user@/host %X"
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
background_update = True
#* Custom cpu model name, empty string to disable.
custom_cpu_name = ""
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user".
disks_filter = "exclude=/boot /proc /boot/efi"
#* Show graphs instead of meters for memory values.
mem_graphs = True
#* Show mem box below net box instead of above.
mem_below_net = False
#* Count ZFS ARC in cached and available memory.
zfs_arc_cached = True
#* If swap memory should be shown in memory box.
show_swap = True
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
swap_disk = True
#* If mem box should be split to also show disks info.
show_disks = True
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
only_physical = True
#* Read disks list from /etc/fstab. This also disables only_physical.
use_fstab = True
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
zfs_hide_datasets = False
#* Set to true to show available disk space for privileged users.
disk_free_priv = False
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
show_io_stat = True
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
io_mode = False
#* Set to True to show combined read/write io graphs in io mode.
io_graph_combined = False
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
#* Example: "/mnt/media:100 /:20 /boot:1".
io_graph_speeds = ""
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
net_download = 1000
net_upload = 100
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
net_auto = True
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
net_sync = True
#* Starts with the Network Interface specified here.
net_iface = ""
#* Show battery stats in top right if battery is present.
show_battery = True
#* Which battery to use if multiple are present. "Auto" for auto detection.
selected_battery = "Auto"
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
log_level = "WARNING"

2245
.config/kitty/kitty.conf Normal file

File diff suppressed because it is too large Load Diff

15
.gitignore vendored
View File

@ -3,17 +3,22 @@
# except:
!.zshrc
!.vimrc
!.ideavimrc
!.config
!.config/nvim
!.config/nvim/**
!.config/btop
!.config/btop/**
!.config/kitty
!.config/kitty/*
!.config/kitty/**
!.gitignore
!.zsh
!.zsh/**
!.tmux.conf
!.gitconfig
!.local/share/fzf
!.local/share/nnn
!.local/share/fzf/**
!.local/share/nnn/**
!.local/fzf
!.local/fzf/**
!.local/nvim
!.local/nvim/**
.config/btop/btop.log

26
.ideavimrc Normal file
View File

@ -0,0 +1,26 @@
"" Source your .vimrc
source /home/plex/.vimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching.
set incsearch
" Do the joining with the ide
set ideajoin
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r <Action>(ReformatCode)
"" Map <leader>d to start debug
"map <leader>d <Action>(Debug)
"" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)
" Find more examples here: https://jb.gg/share-ideavimrc

129
.vimrc Normal file
View File

@ -0,0 +1,129 @@
" GENERAL CONFIGS ----------------------------------------------------------------------------------
syntax on " syntax highlighting
set nocompatible " disable compatibility to old-time vi
set number
set nocompatible
set hlsearch " highlight search
set incsearch " incremental search
set tabstop=4 " number of columns occupied by a tab
set softtabstop=4 " see multiple spaces as tab stops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for auto indents
set autoindent " indent a new line the same amount as the line just typed
set number " add line numbers
set wildmode=longest,list " get bash-like tab completions
set cc=100 " set an 100 column border for good coding style
set mouse=a " enable mouse for help file editing and hitting prompts
set cursorline " highlight current cursor line
set ttyfast " Speed up scrolling in Vim
set fdm=indent " folding method syntax
set foldlevel=10 " only fold when a certain complexity is reached by default.
" This applies only at startup.
set numberwidth=4 " How much space the line numbers should take
set signcolumn=yes " Show extra icons in the line numbers (like git marks, errors)
set timeout timeoutlen=400 " How long to wait for non prefix free hotkey melodies
set ttimeoutlen=0
" Avoid showing message extra message when using completion
set shortmess+=c
"allow auto-indenting depending on file type
filetype plugin indent on
filetype plugin on
let g:indentLine_char = '│'
" HOTKEYS ------------------------------------------------------------------------------------------
" add lines with double o
noremap oo o<ESC>
noremap OO O<ESC>
" H and L for end and beginning
nmap H ^
nmap L $
vmap H ^
vmap L $
" useful functions for arrow keys
" (and force the user to use `hjkl`)
" right/left to add/remove a tab in the beginning of the line.
nmap <Left> <<
nmap <Right> >>
" same for visual mode (plus reselecting stuff for visual mode)
vmap <Left> <gv
vmap <Right> >gv
" up and down move lines up and down
nmap <Up> :m -2<CR>
nmap <Down> :m +1<CR>
" same for visual mode (plus reselecting stuff for visual mode)
vmap <Up> :m -2<CR>
vmap <Down> :m +1<CR>
" resize windows
nnoremap <C-Left> :vertical resize -1<CR>
nnoremap <C-Right> :vertical resize +1<CR>
nnoremap <C-Up> :resize -1<CR>
nnoremap <C-Down> :resize +1<CR>
" hit F3 to toggle search highlighting"
nnoremap <F3> :set hlsearch!<CR>
nnoremap <SPACE> <Nop>
let mapleader=" "
map <leader>t :echo "leader tested!"<CR>
map <leader>h :noh<CR>
" copy to Wayland clipboard when leader is used. (note, install gvim for this)
vnoremap <leader>wy y :call system("wl-copy", @")<CR>
nnoremap <leader>wY Y :call system("wl-copy", @")<CR>
nnoremap <leader>wy y :call system("wl-copy", @")<CR>
nnoremap <leader>wyy yy :call system("wl-copy", @")<CR>
" copy to system clipboard when leader is used. (note, install gvim for this)
vnoremap <leader>y "+y
nnoremap <leader>Y "+Y
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" don't write the pasted upon stuff in visual mode into the register
vnoremap p pgvy
" open terminal with F12
nnoremap <F12> :terminal<CR>
" vsplit with <Leader>, then "
map <Leader>" :vsplit<CR>
" split with <Leader>, then %"
map <Leader>% :split<CR>
" join with <leader>j
nnoremap <leader>j :join<CR>
" join up with <leader>J
nnoremap <leader>J :move .-2<CR> :join<CR>
" split lines with <leader>s
nnoremap <leader>s i<CR><ESC>
" split lines up with <leader>S
nnoremap <leader>S i<CR><ESC> V:m -2<CR>
" move screen a line up/down with alt U/D
nmap <A-u> kzz
nmap <A-d> jzz
" spell checking -----------------------------------------------------------------------------------
set spell spelllang=en
" set a location
set spellfile=~/.config/nvim/spell/en.utf-8.add
" go to last or next misspelled word
nnoremap zn ]s
nnoremap zN [s
" same as above but only with bad words (unrecognized)
nnoremap Zn ]S
nnoremap ZN [S

4
.zsh/zfunc/_cargo Normal file
View File

@ -0,0 +1,4 @@
#compdef cargo
if command -v rustc >/dev/null 2>&1; then
source "$(rustc --print sysroot)"/share/zsh/site-functions/_cargo
fi

734
.zsh/zfunc/_conda Normal file
View File

@ -0,0 +1,734 @@
#compdef conda mamba micromamba
#description:conda package manager
#
# ZSH Completion for conda (http://conda.pydata.org/)
#
# Author: Valentin Haenel <valentin@haenel.co> (https://github.com/esc/)
# Licence: WTFPL (http://sam.zoy.org/wtfpl/)
# Version: 0.11-dev
# Homepage: https://github.com/conda-incubator/conda-zsh-completion
# Demo: https://asciinema.org/a/16516
#
# This completion depends on Python for a json parser, sorry. Unfortunately
# there is no such thing in zsh (yet).
#
# To use this completion, install it somewhere on your hard drive:
#
# $ git clone https://github.com/esc/conda-zsh-completion
#
# And then add it to your $fpath in ~/.zshrc before you call compinit:
#
# fpath+=/path/to/where/you/installed/conda-zsh-completion
# compinit
#
# If you're using oh-my-zsh or Prezto, they will call compinit for you, so
# just add it to your $fpath before calling the OMZ or Prezto initialization
# functions. For example:
#
# git clone https://github.com/esc/conda-zsh-completion ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/conda-zsh-completion
#
# And add lines in `.zshrc`
# plugins=(… conda-zsh-completion)
# autoload -U compinit && compinit
#
# If you use oh-my-zsh, you might have to move the "autoload" line to after you sourced
# oh-my-zsh.sh.
#
# To activate the completion cache for packages, add the following to your
# '.zshrc':
#
# zstyle ':completion::complete:*' use-cache 1
#
# To display subcommand completion in groups, please add the following to your
# '.zshrc':
#
# zstyle ":conda_zsh_completion:*" use-groups true
#
# To display unnamed environments and prefixes of environments, add the following
# to your '.zshrc':
#
# zstyle ":conda_zsh_completion:*" show-unnamed true
#
# To display environments autocompletion sorted in creation order add the following
# to your '.zshrc':
#
# zstyle ":conda_zsh_completion:*" sort-envs-by-time true
#
# The completion will display both global environments (envs located in conda_dir/envs and base env)
# and local environments (located in ~/.conda/envs).
# If enables sort-envs-by-time, it will display local environments first.
# To display global environments first, add the following to your '.zshrc':
#
# zstyle ":conda_zsh_completion:*" show-global-envs-first true
#
# If not enables sort-envs-by-time, then all environments will be sorted by alphabetical order,
# and this option is useless.
#
# To forcefully clean the completion cache, look in '~/.zcompcache' and remove
# file starting with 'conda_'. And/or do 'rm ~/.zcompdump*'.
#
# When developing, you can use the following to reload the completion after
# having modified it:
#
# $ unfunction _conda && autoload -U _conda
#
# Please report any issues at:
# https://github.com/esc/conda-zsh-completion/issues
#
# CHANGELOG
# ---------
#
# * v0.10
#
# * Search environments in custom environments paths, thanks to Thomas G. (coldfix).
# * Naive mamba support, thanks to olegtarasov
# * Remove path prefix from environments in default location, thanks to 3mb3dw0rk5
# * Sort environments to be completed by creation time, thanks to m-novikov
# * Check for environment directory before accessing, thanks to huyz-git
#
# * v0.9
#
# * Improved the completion speed for completing environments, thanks to
# Niels Mündler.
# * Various minor improvements and documentation upgrades
#
# * v0.8
#
# * Updated installation instructions and added a license file, thanks to
# Andrew Janke
#
# * v0.7
#
# * Fix alignment during menu-completion
#
# * v0.6
#
# * conda activate and conda deactivate can now be completed, thanks to
# Taylor Kang Beck
#
# * v0.5
#
# * conda-env can now be completed
# * conda-build can now be completed
#
# * v0.4
#
# * conda info can complete available packages
# * conda install and create have rudimentary package version completion
# * remove caching for local package list, it's fast enough
# * conda remove and update are aware of -n or similar and complete only
# packages in the given environment
# * list of packages excludes those installed with pip
#
# * v0.3
#
# * overhaul of the completion for config
#
# * complete only existing keys
# * complete only existing values
# * differentiate between list and boolean config
# * reader and writer options mutually exclusive
# * complete multiple keys for --get
#
# * -n,--name and -p,--prefix are now mutually exclusive
#
# * v0.2
#
# * completion cache for packages
# * complete all channels defined in .condarc
#
# * v0.1
#
# * inital release
#
# TODO
# ----
#
# * Subcommand grouping is still alpha.
# * Example of activating cache only for conda completion
# * Make cache policy configurable
# * Completion for version numbers is rudimentary:
# only 'install' can complete them and only for a single '=' sign
# * Configuration for external commands: only build and env supported
# * Properly handle package specs on the command line
# * Don't continue to complete options once -- is given
# * None of the commands are aware of channels
local state line context
local -A opt_args
__conda_envs(){
local -a envs unnamed sort globalfirst localenvs globalenvs
local -a ls_opts=("-1")
local -a describe_opts
local localenvspath
# only parse environments.txt (including unnamed envs) if asked by the user
zstyle -s ":conda_zsh_completion:*" show-unnamed unnamed
zstyle -s ":conda_zsh_completion:*" sort-envs-by-time sort
zstyle -s ":conda_zsh_completion:*" show-global-envs-first globalfirst
if test -n "$sort"; then
ls_opts+=("-t")
describe_opts+=("-V")
fi
# global envs (if exists) and base env.
globalenvs=($([[ -d "${${CONDA_EXE}%bin/conda}/envs" ]] && ls $ls_opts ${${CONDA_EXE}%bin/conda}/envs))
globalenvs+=("base")
# local envs (if exists).
if [[ -n "$CONDA_ENVS_PATH" ]]; then
localenvspath="$CONDA_ENVS_PATH"
elif [[ -n "$CONDA_ENVS_DIRS" ]]; then
localenvspath="$CONDA_ENVS_DIRS"
else
localenvspath="${HOME:?}/.conda/envs"
fi
localenvs=($([[ -d "$localenvspath" ]] && ls $ls_opts "$localenvspath"))
if test -n "$globalfirst"; then
envs=($globalenvs $localenvs)
else
envs=($localenvs $globalenvs)
fi
# unmaned envs (if show-unammed).
if test -n "$unnamed"; then
envs+=($( (test -n "$unnamed" && cat ${HOME:?}/.conda/environments.txt) | cut -f1 -d' ' | sed -e "s|^$localenvspath/||"))
fi
_describe $describe_opts -t envs 'conda environments' envs
}
__conda_packages_installed(){
local -a installed_packages option environment additional_message
# check for command line overrides
[[ -n "$1" ]] && option="$1"
[[ -n "$2" ]] && environment="$2"
installed_packages=($( conda list --no-pip $option $environment | sed 1,2d | cut -f1 -d' ' ))
[[ -n $option ]] && [[ -n $environment ]] && additional_message=" in environment: '$environment'"
_describe -t installed_packages "installed packages$additional_message" installed_packages
}
__conda_package_available(){
zstyle ":completion:${curcontext}:" cache-policy __conda_caching_policy
local -a available_packages
if _cache_invalid conda_available_packages || ! _retrieve_cache conda_available_packages ; then
available_packages=($(conda search --use-index-cache --json |
python -c "
import json, sys
parsed = json.load(sys.stdin)
for k in parsed.keys():
print(k)
"))
_store_cache conda_available_packages available_packages
fi
print -l $available_packages
}
__describe_conda_package_available(){
local -a available_packages
available_packages=($( __conda_package_available))
_describe -t available_packages 'available packages' available_packages
}
__conda_existing_config_keys(){
local -a config_keys
config_keys=($(conda config --json --get |
python -c "
import json, sys
keys = json.load(sys.stdin)['get'].keys()
for k in keys:
print(k)
"))
print -l $config_keys
}
__conda_describe_existing_config_keys(){
local -a config_keys
config_keys=($( __conda_existing_config_keys ))
if [ "${#config_keys}" == 0 ] ; then
_message "no keys found!"
else
_describe -t config_keys 'existing configuration keys' config_keys
fi
}
__conda_describe_existing_list_config_keys(){
local -a config_keys existing_list_config_keys
config_keys=($( __conda_existing_config_keys ))
existing_list_config_keys=()
for k in $config_keys; do
if (( ${__conda_list_config_keys[(I)$k]} )) ; then
existing_list_config_keys+=$k
fi
done
if [ "${#existing_list_config_keys}" == 0 ] ; then
_message "no keys found!"
else
_describe -t existing_list_config_keys 'existing list configuration keys' existing_list_config_keys
fi
}
__conda_existing_config_values(){
local -a config_values search_term
search_term="$1"
config_values=($(conda config --json --get "$search_term" 2> /dev/null |
python -c "
import json, sys
try:
values = json.load(sys.stdin)['get']['$search_term']
for v in values:
print(v)
except KeyError:
pass
except ValueError:
pass
"))
print -l $config_values
}
__conda_describe_existing_config_values(){
local -a config_values search_term
search_term="$1"
config_values=($( __conda_existing_config_values $search_term ))
if [ "${#config_values}" == 0 ] ; then
_message "no values found for '$search_term'!"
else
_describe -t config_values 'configuration values' config_values
fi
}
__conda_describe_boolean_config_values(){
local -a config_values
config_values=(True False)
_describe -t config_values 'boolean configuration values' config_values
}
__conda_channels(){
local -a channels
channels=($( __conda_existing_config_values "channels" ))
channels+=(system)
_describe -t channels 'conda channels' channels
}
local -a __conda_boolean_config_keys __conda_list_config_keys __conda_config_keys
__conda_boolean_config_keys=(
'add_binstar_token'
'always_yes'
'allow_softlinks'
'changeps1'
'use_pip'
'offline'
'binstar_upload'
'binstar_personal'
'show_channel_urls'
'allow_other_channels'
'ssl_verify'
)
__conda_list_config_keys=(
'channels'
'disallow'
'create_default_packages'
'track_features'
'envs_dirs'
)
__conda_config_keys=($__conda_boolean_config_keys $__conda_list_config_keys)
__conda_describe_boolean_config_keys(){
_describe -t __conda_boolean_config_keys 'boolean keys' __conda_boolean_config_keys
}
__conda_describe_list_config_keys(){
_describe -t __conda_list_config_keys 'list keys' __conda_list_config_keys
}
__conda_describe_config_keys(){
_describe -t __conda_config_keys 'conda configuration keys' __conda_config_keys
}
#__conda_package_specs=('<' '>' '<=' '>=' '==' '!=')
__conda_package_specs=('=')
__conda_describe_package_specs(){
_describe -t __conda_package_specs 'conda package specs' __conda_package_specs
}
__conda_describe_package_version(){
local -a current_package versions
current_package="$1"
versions=($( conda search --json --use-index-cache $current_package | python -c "
import json,sys
try:
versions = set((e['version'] for e in json.load(sys.stdin)['$current_package']))
for v in versions:
print(v)
except KeyError:
pass
"))
_describe -t versions "$current_package version" versions
}
__conda_commands(){
local -a package maint environment help config special tmp
package=(
search:'Search for packages and display their information.'
install:'Install a list of packages into a specified conda environment.'
)
maint=(
update:'Update conda packages.'
clean:'Remove unused packages and caches.'
)
environment=(
info:'Display information about current conda install.'
create:'Create a new conda environment from a list of specified packages.'
list:'List linked packages in a conda environment.'
remove:'Remove a list of packages from a specified conda environment.'
uninstall:'Alias for conda remove'
activate:'Activate an environment; alias for source activate'
deactivate:'Deactivate an environment; alias for source deactivate'
)
help=(
help:'Displays a list of available conda commands and their help strings.'
)
config=(
config:'Modify configuration values in .condarc.'
)
special=(
run:'Launches an application installed with Conda.'
init:'Initialize conda into a regular environment. (EXPERIMENTAL)'
package:'Low-level conda package utility. (EXPERIMENTAL)'
bundle:'Create or extract a "bundle package" (EXPERIMENTAL)'
)
external=(
env:'Manage environments.'
build:'tool for building conda packages'
)
# This takes care of alignment if the user wanted the subcommand completion
# to be split into groups.
zstyle -s ":conda_zsh_completion:*" use-groups tmp
if [[ -n $tmp ]] ; then
_describe -t package_commands "package commands" package
_describe -t maint_commands "maint commands" maint
_describe -t environment_commands "environment commands" environment
_describe -t help_commands "help commands" help
_describe -t config_commands "config commands" config
_describe -t special_commands "special commands" special
_describe -t external_commands "external commands" external
else
_describe "conda commands" package -- maint -- environment -- help -- config -- special -- external
fi
}
__conda_caching_policy() {
local -a oldp
oldp=( "$1"(Nmh+12) ) # 12 hour
(( $#oldp ))
}
local -a opts help_opts json_opts env_opts channel_opts install_opts
opts=(
'(-h --help)'{-h,--help}'[show this help message and exit]'
'(-V --version)'{-V,--version}'[show program''s version number and exit]'
)
help_opts=(
'(-h --help)'{-h,--help}'[show this help message and exit]' \
)
json_opts=(
'--json[report all output as json.]' \
)
env_opts=(
'(-n --name -p --prefix)'{-n,--name}'[name of environment]:environment:__conda_envs' \
'(-n --name -p --prefix)'{-p,--prefix}'[full path to environment prefix]:path:_path_files' \
)
channel_opts=(
'(-c --channel)'{-c,--channel}'[additional channel to search for packages]:channel:__conda_channels'\
'--override-channels [do not search default or .condarc channels]' \
'--use-index-cache[use cache of channel index files]' \
'--use-local[use locally built packages]' \
)
install_opts=(
'(-y --yes)'{-y,--yes}'[do not ask for confirmation]' \
'--dry-run[only display what would have been done]' \
'(-f --force)'{-f,--force}'[force install]' \
'--file[read package versions from file]:file:_path_files' \
'--no-deps[do not install dependencies]' \
'(-m --mkdir)'{-m,--mkdir}'[create prefix directory if necessary]' \
'--offline[offline mode, don''t connect to internet]' \
'--no-pin[ignore pinned file]' \
'(-q --quiet)'{-q,--quiet}'[do not display progress bar]'\
'--copy[Install all packages using copies instead of hard- or soft-linking]' \
'--alt-hint[Use an alternate algorithm to generate an unsatisfiable hint]' \
)
_arguments -C $opts \
': :->command' \
'*:: :->subcmd'
# the magic function, complete either a package or a package and it's version
__magic(){
local -a last_item available_packages current_package
last_item=$line[$CURRENT]
available_packages=($( __conda_package_available ))
if compset -P "*=" ; then
current_package="$IPREFIX[1,-2]"
__conda_describe_package_version $current_package
else
__describe_conda_package_available
if [[ -n $last_item ]] && (( ${available_packages[(I)$last_item]} )); then
compset -P '*'
__conda_describe_package_specs
fi
fi
}
case $state in
(command)
__conda_commands
;;
(subcmd)
case ${line[1]} in
(info)
_arguments -C $help_opts \
'--json[report all output as json.]' \
'(-a --all)'{-a,--all}'[show all information, (environments, license, and system information]' \
'(-e --envs)'{-e,--envs}'[list all known conda environments]' \
'(-l --license)'{-l,--license}'[display information about local conda licenses list]' \
'(-s --system)'{-s,--system}'[list environment variables]' \
'--root[display root environment path]' \
'*:packages:__describe_conda_package_available' \
;;
(help)
_arguments -C $help_opts \
'*:commands:__conda_commands' \
;;
(list)
_arguments -C $help_opts \
$env_opts \
$json_opts \
'(-c --canonical)'{-c,--canonical}'[output canonical names of packages only]' \
'(-e --export)'{-e,--export}'[output requirement string only]' \
'(-r --revisions)'{-r,--revision}'[list the revision history and exit]' \
'--no-pip[Do not include pip-only installed packages]' \
'*:regex:' \
;;
(search)
_arguments -C $help_opts \
$env_opts \
$json_opts \
$channel_opts \
'(-c --canonical)'{-c,--canonical}'[output canonical names of packages only]' \
'--unknown[use index metadata from the local package cache]' \
'(-o --outdated)'{-o,--outdated}'[only display installed but outdated packages]' \
'(-v --verbose)'{-v,--verbose}'[Show available packages as blocks of data]' \
'--platform[Search the given platform.]' \
'--spec[Treat regex argument as a package specification]' \
'*:regex:' \
;;
(create)
_arguments -C $help_opts \
$env_opts \
$install_opts \
$json_opts \
$channel_opts \
'--unknown[use index metadata from the local package cache]' \
'--clone[path to (or name of) existing local environment]' \
'--no-default-packages[ignore create_default_packages in condarc file]' \
'*:packages:__magic' \
;;
(install)
_arguments -C $help_opts \
$env_opts \
$install_opts \
$json_opts \
$channel_opts \
'--revision[revert to the specified revision]:revision' \
'*:packages:__magic' \
;;
(update)
local -a environment options specifier
options=('-n' '--name' '-p' '--prefix')
for i in $options ; do
(( ${line[(I)$i]} )) && specifier=$i
done
[[ -n $specifier ]] && environment="$line[${line[(i)$specifier]}+1]"
_arguments -C $help_opts \
$env_opts \
$install_opts \
$json_opts \
$channel_opts \
'--unknown[use index metadata from the local package cache]' \
'--all[Update all installed packages in the environment]' \
'*:packages:{__conda_packages_installed $specifier $environment}' \
;;
(remove|uninstall)
local -a environment options specifier
options=('-n' '--name' '-p' '--prefix')
for i in $options ; do
(( ${line[(I)$i]} )) && specifier=$i
done
[[ -n $specifier ]] && environment="$line[${line[(i)$specifier]}+1]"
_arguments -C $help_opts \
$env_opts \
$json_opts \
$channel_opts \
'(-y --yes)'{-y,--yes}'[do not ask for confirmation]' \
'--dry-run[only display what would have been done]' \
'(-a --all)'{-a,--all}'[remove all packages, i.e. the entire environment]' \
'--features[remove features (instead of packages)]' \
'--no-pin[ignore pinned file]' \
'(-q --quiet)'{-q,--quiet}'[do not display progress bar]'\
'--offline[offline mode, don''t connect to internet]' \
'*:packages:{__conda_packages_installed $specifier $environment}' \
;;
(config)
# this allows completing multiple keys when --get is given
local -a last_item get_opts
last_item=$line[$CURRENT-1]
if (( ${line[(I)--get]} )) && (( ${__conda_config_keys[(I)$last_item]} )) ; then
get_opts=('*:keys:__conda_describe_existing_config_keys')
else
get_opts=''
fi
_arguments -C $help_opts \
$json_opts \
'--system[write to the system .condarc file]' \
'--file[write to the given file.]:file:_path_files' \
'( --add --set --remove --remove-key)--get[get the configuration value]:key:__conda_describe_existing_config_keys' \
'(--get --set --remove --remove-key)--add[add one configuration value to a list key]:list key:__conda_describe_list_config_keys:value:' \
'(--get --add --remove --remove-key)--set[set a boolean key]:boolean key:__conda_describe_boolean_config_keys:value:__conda_describe_boolean_config_values' \
'(--get --add --set --remove-key)--remove[remove a configuration value from a list key]:list key:__conda_describe_existing_list_config_keys:value:{__conda_describe_existing_config_values '$last_item'}' \
'(--get --add --set --remove )--remove-key[remove a configuration key (and all its values)]:key:__conda_describe_existing_config_keys' \
'(-f --force)'{-f,--force}'[write to the config file using the yaml parser]' \
$get_opts
;;
(init)
_arguments -C $help_opts \
;;
(clean)
_arguments -C $help_opts \
$json_opts \
'(-y --yes)'{-y,--yes}'[do not ask for confirmation]' \
'--dry-run[only display what would have been done]' \
'(-i --index-cache)'{-i,--index-cache}'[remove index cache]' \
'(-l --lock)'{-l,--lock}'[remove all conda lock files]' \
'(-t --tarballs)'{-t,--tarballs}'[remove cached package tarballs]' \
'(-p --packages)'{-p,--packages}'[remove unused cached packages]' \
'(-s --source-cache)'{-s,--source-cache}'[remove files from the source cache of conda build]' \
;;
(package)
_arguments -C $help_opts \
$env_opts \
'(-w --which)'{-w,--which}'[given some path print which conda package the file came from]:path:_path_files' \
'(-L --ls-files)'{-L,--ls-files}'[list all files belonging to specified package]' \
'(-r --reset)'{-r,--reset}'[remove all untracked files and exit]' \
'(-u --untracked)'{-u,--untracked}'[display all untracked files and exit]' \
'--pkg-name[package name of the created package]:pkg_name:' \
'--pkg-version[package version of the created package]:pkg_version:' \
'--pkg-build[package build number of the created package]:pkg_build:' \
;;
(bundle)
_arguments -C $help_opts \
$env_opts \
$json_opts \
'(-c --create)'{-c,--create}'[create bundle]' \
'(-x --extract)'{-x,--extract}'[extact bundle located at path]:path:_path_files' \
'--metadump[dump metadata of bundle at path]:path:_path_files' \
'(-q --quiet)'{-q,--quiet}'[do not display progress bar]'\
'--bundle-name[name of bundle]:NAME:' \
'--data-path[path to data to be included in bundle]:path:_path_files' \
'--extra-meta[path to json file with additional meta-data no]:path:_path_files' \
'--no-env[no environment]' \
;;
(build)
_arguments -C $help_opts \
'(-c --check)'{-c,--check}'[only check (validate) the recipe]' \
'--no-binstar-upload[do not ask to upload the package to binstar]' \
'--output[output the conda package filename which would have been created and exit]' \
'(-s --source)'{-s,--source}'[only obtain the source (but don''t build)]' \
'(-t --test)'{-t,--test}'[test package (assumes package is already build)]' \
'--no-test[do not test the package]' \
'(-b --build-only)'{-b,--build-only}'[only run the build, without any post processing or testing]' \
'(-p --post)'{-p,--post}'[run the post-build logic]' \
'(-V --version)'{-V,--version}'[show program''s version number and exit]' \
'(-q --quiet)'{-q,--quiet}'[do not display progress bar]' \
'--python[Set the Python version used by conda build]' \
'--perl[Set the Perl version used by conda build]' \
'--numpy[Set the NumPy version used by conda build]' \
'*:recipe_path:_path_files' \
;;
(env)
_arguments -C $opts \
': :->command' \
'*:: :->subcmd'
case $state in
(command)
local -a env
env=(
create:'Create an environment based on an environment file'
export:'Export a given environment'
list:'List the Conda environments'
remove:'Remove an environment'
update:'Update the current environment based on environment file'
)
_describe -t env_commands "help commands" env
;;
(subcmd)
case ${line[1]} in
(create)
_arguments -C $help_opts \
$json_opts \
'(-n --name)'{-n,--name}'[name of environment]:environment:__conda_envs' \
'(-f --file)'{-f,--file}'[environment definition]:file:_path_files' \
'(-q --quiet)'{-q,--quiet}'[]' \
;;
(export)
_arguments -C $help_opts \
'(-n --name)'{-n,--name}'[name of environment]:environment:__conda_envs' \
'(-f --file)'{-f,--file}'[]:file:_path_files' \
;;
(list)
_arguments -C $help_opts \
$json_opts \
;;
(remove)
_arguments -C $help_opts \
$json_opts \
$env_opts \
'(-q --quiet)'{-q,--quiet}'[do not display progress bar]'\
'(-y --yes)'{-y,--yes}'[do not ask for confirmation]' \
'--dry-run[only display what would have been done]' \
;;
(update)
_arguments -C $help_opts \
$json_opts \
'(-n --name)'{-n,--name}'[name of environment]:environment:__conda_envs' \
'(-f --file)'{-f,--file}'[environment definition]:file:_path_files' \
'(-q --quiet)'{-q,--quiet}'[]' \
;;
esac
;;
esac
;;
(activate)
_arguments -C $help_opts \
'--stack[activate this environment on top of the previous environment]' \
'*:environment:__conda_envs'
;;
(deactivate)
_arguments -C $help_opts \
;;
esac
;;
esac

786
.zsh/zfunc/_rustup Normal file
View File

@ -0,0 +1,786 @@
#compdef rustup
autoload -U is-at-least
_rustup() {
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[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*-v[Enable verbose output]' \
'*--verbose[Enable verbose output]' \
'(-v --verbose)*-q[Disable progress output]' \
'(-v --verbose)*--quiet[Disable progress output]' \
'::+toolchain -- release channel (e.g. +stable) or custom toolchain to set override:' \
":: :_rustup_commands" \
"*::: :->rustup" \
&& ret=0
case $state in
(rustup)
words=($line[2] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-command-$line[2]:"
case $line[2] in
(dump-testament)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(show)
_arguments "${_arguments_options[@]}" \
'*-v[Enable verbose output with rustc information for all installed toolchains]' \
'*--verbose[Enable verbose output with rustc information for all installed toolchains]' \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__show_commands" \
"*::: :->show" \
&& ret=0
case $state in
(show)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:"
case $line[1] in
(active-toolchain)
_arguments "${_arguments_options[@]}" \
'*-v[Enable verbose output with rustc information]' \
'*--verbose[Enable verbose output with rustc information]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(home)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(profile)
_arguments "${_arguments_options[@]}" \
'-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
;;
(install)
_arguments "${_arguments_options[@]}" \
'--profile=[]: :(minimal default complete)' \
'*--no-self-update[Don'\''t perform self-update when running the `rustup install` command]' \
'*--force[Force an update, even if some components are missing]' \
'*--force-non-host[Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" \
'*--no-self-update[Don'\''t perform self update when running the `rustup update` command]' \
'*--force[Force an update, even if some components are missing]' \
'*--force-non-host[Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(check)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(default)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'::toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(toolchain)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__toolchain_commands" \
"*::: :->toolchain" \
&& ret=0
case $state in
(toolchain)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:"
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'*-v[Enable verbose output with toolchain information]' \
'*--verbose[Enable verbose output with toolchain information]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" \
'--profile=[]: :(minimal default complete)' \
'*-c+[Add specific components on installation]: : ' \
'*--component=[Add specific components on installation]: : ' \
'*-t+[Add specific targets on installation]: : ' \
'*--target=[Add specific targets on installation]: : ' \
'*--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \
'*--force[Force an update, even if some components are missing]' \
'*--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \
'*--force-non-host[Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(link)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':toolchain -- Custom toolchain name:' \
':path -- Path to the directory:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(target)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__target_commands" \
"*::: :->target" \
&& ret=0
case $state in
(target)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:"
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'*--installed[List only installed targets]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::target -- List of targets to install; "all" installs all available targets:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::target -- List of targets to uninstall:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(component)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__component_commands" \
"*::: :->component" \
&& ret=0
case $state in
(component)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:"
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'*--installed[List only installed components]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'--target=[]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::component:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'--target=[]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::component:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(override)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__override_commands" \
"*::: :->override" \
&& ret=0
case $state in
(override)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:"
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(set)
_arguments "${_arguments_options[@]}" \
'--path=[Path to the directory]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
':toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
&& ret=0
;;
(unset)
_arguments "${_arguments_options[@]}" \
'--path=[Path to the directory]: : ' \
'*--nonexistent[Remove override toolchain for all nonexistent directories]' \
'-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
;;
(run)
_arguments "${_arguments_options[@]}" \
'*--install[Install the requested toolchain if needed]' \
'-h[Print help information]' \
'--help[Print help information]' \
':toolchain -- Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`:' \
'*::command:' \
&& ret=0
;;
(which)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
':command:' \
&& ret=0
;;
(doc)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'*--path[Only print the path to the documentation]' \
'*--alloc[The Rust core allocation and collections library]' \
'*--book[The Rust Programming Language book]' \
'*--cargo[The Cargo Book]' \
'*--core[The Rust Core Library]' \
'*--edition-guide[The Rust Edition Guide]' \
'*--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \
'*--proc_macro[A support library for macro authors when defining new macros]' \
'*--reference[The Rust Reference]' \
'*--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \
'*--rustc[The compiler for the Rust programming language]' \
'*--rustdoc[Documentation generator for Rust projects]' \
'*--std[Standard library API documentation]' \
'*--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \
'*--unstable-book[The Unstable Book]' \
'*--embedded-book[The Embedded Rust Book]' \
'-h[Print help information]' \
'--help[Print help information]' \
'::topic -- Topic such as '\''core'\'', '\''fn'\'', '\''usize'\'', '\''eprintln!'\'', '\''core\:\:arch'\'', '\''alloc\:\:format!'\'', '\''std\:\:fs'\'', '\''std\:\:fs\:\:read_dir'\'', '\''std\:\:io\:\:Bytes'\'', '\''std\:\:iter\:\:Sum'\'', '\''std\:\:io\:\:error\:\:Result'\'' etc...:' \
&& ret=0
;;
(man)
_arguments "${_arguments_options[@]}" \
'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]: : ' \
'-h[Print help information]' \
'--help[Print help information]' \
':command:' \
&& ret=0
;;
(self)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__self_commands" \
"*::: :->self" \
&& ret=0
case $state in
(self)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:"
case $line[1] in
(update)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" \
'*-y[]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(upgrade-data)
_arguments "${_arguments_options[@]}" \
'-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
;;
(set)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_rustup__set_commands" \
"*::: :->set" \
&& ret=0
case $state in
(set)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:"
case $line[1] in
(default-host)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':host_triple:' \
&& ret=0
;;
(profile)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':profile-name:(minimal default complete)' \
&& ret=0
;;
(auto-self-update)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':auto-self-update-mode:(enable disable check-only)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'::shell:(bash elvish fish powershell zsh)' \
'::command:(rustup cargo)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_rustup_commands] )) ||
_rustup_commands() {
local commands; commands=(
'dump-testament:Dump information about the build' \
'show:Show the active and installed toolchains or profiles' \
'install:Update Rust toolchains' \
'uninstall:Uninstall Rust toolchains' \
'update:Update Rust toolchains and rustup' \
'check:Check for updates to Rust toolchains and rustup' \
'default:Set the default toolchain' \
'toolchain:Modify or query the installed toolchains' \
'target:Modify a toolchain'\''s supported targets' \
'component:Modify a toolchain'\''s installed components' \
'override:Modify directory toolchain overrides' \
'run:Run a command with an environment configured for a given toolchain' \
'which:Display which binary will be run for a given command' \
'doc:Open the documentation for the current toolchain' \
'man:View the man page for a given command' \
'self:Modify the rustup installation' \
'set:Alter rustup settings' \
'completions:Generate tab-completion scripts for your shell' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup commands' commands "$@"
}
(( $+functions[_rustup__show__active-toolchain_commands] )) ||
_rustup__show__active-toolchain_commands() {
local commands; commands=()
_describe -t commands 'rustup show active-toolchain commands' commands "$@"
}
(( $+functions[_rustup__component__add_commands] )) ||
_rustup__component__add_commands() {
local commands; commands=()
_describe -t commands 'rustup component add commands' commands "$@"
}
(( $+functions[_rustup__target__add_commands] )) ||
_rustup__target__add_commands() {
local commands; commands=()
_describe -t commands 'rustup target add commands' commands "$@"
}
(( $+functions[_rustup__set__auto-self-update_commands] )) ||
_rustup__set__auto-self-update_commands() {
local commands; commands=()
_describe -t commands 'rustup set auto-self-update commands' commands "$@"
}
(( $+functions[_rustup__check_commands] )) ||
_rustup__check_commands() {
local commands; commands=()
_describe -t commands 'rustup check commands' commands "$@"
}
(( $+functions[_rustup__completions_commands] )) ||
_rustup__completions_commands() {
local commands; commands=()
_describe -t commands 'rustup completions commands' commands "$@"
}
(( $+functions[_rustup__component_commands] )) ||
_rustup__component_commands() {
local commands; commands=(
'list:List installed and available components' \
'add:Add a component to a Rust toolchain' \
'remove:Remove a component from a Rust toolchain' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup component commands' commands "$@"
}
(( $+functions[_rustup__default_commands] )) ||
_rustup__default_commands() {
local commands; commands=()
_describe -t commands 'rustup default commands' commands "$@"
}
(( $+functions[_rustup__set__default-host_commands] )) ||
_rustup__set__default-host_commands() {
local commands; commands=()
_describe -t commands 'rustup set default-host commands' commands "$@"
}
(( $+functions[_rustup__doc_commands] )) ||
_rustup__doc_commands() {
local commands; commands=()
_describe -t commands 'rustup doc commands' commands "$@"
}
(( $+functions[_rustup__dump-testament_commands] )) ||
_rustup__dump-testament_commands() {
local commands; commands=()
_describe -t commands 'rustup dump-testament commands' commands "$@"
}
(( $+functions[_rustup__component__help_commands] )) ||
_rustup__component__help_commands() {
local commands; commands=()
_describe -t commands 'rustup component help commands' commands "$@"
}
(( $+functions[_rustup__help_commands] )) ||
_rustup__help_commands() {
local commands; commands=()
_describe -t commands 'rustup help commands' commands "$@"
}
(( $+functions[_rustup__override__help_commands] )) ||
_rustup__override__help_commands() {
local commands; commands=()
_describe -t commands 'rustup override help commands' commands "$@"
}
(( $+functions[_rustup__self__help_commands] )) ||
_rustup__self__help_commands() {
local commands; commands=()
_describe -t commands 'rustup self help commands' commands "$@"
}
(( $+functions[_rustup__set__help_commands] )) ||
_rustup__set__help_commands() {
local commands; commands=()
_describe -t commands 'rustup set help commands' commands "$@"
}
(( $+functions[_rustup__show__help_commands] )) ||
_rustup__show__help_commands() {
local commands; commands=()
_describe -t commands 'rustup show help commands' commands "$@"
}
(( $+functions[_rustup__target__help_commands] )) ||
_rustup__target__help_commands() {
local commands; commands=()
_describe -t commands 'rustup target help commands' commands "$@"
}
(( $+functions[_rustup__toolchain__help_commands] )) ||
_rustup__toolchain__help_commands() {
local commands; commands=()
_describe -t commands 'rustup toolchain help commands' commands "$@"
}
(( $+functions[_rustup__show__home_commands] )) ||
_rustup__show__home_commands() {
local commands; commands=()
_describe -t commands 'rustup show home commands' commands "$@"
}
(( $+functions[_rustup__install_commands] )) ||
_rustup__install_commands() {
local commands; commands=()
_describe -t commands 'rustup install commands' commands "$@"
}
(( $+functions[_rustup__toolchain__install_commands] )) ||
_rustup__toolchain__install_commands() {
local commands; commands=()
_describe -t commands 'rustup toolchain install commands' commands "$@"
}
(( $+functions[_rustup__toolchain__link_commands] )) ||
_rustup__toolchain__link_commands() {
local commands; commands=()
_describe -t commands 'rustup toolchain link commands' commands "$@"
}
(( $+functions[_rustup__component__list_commands] )) ||
_rustup__component__list_commands() {
local commands; commands=()
_describe -t commands 'rustup component list commands' commands "$@"
}
(( $+functions[_rustup__override__list_commands] )) ||
_rustup__override__list_commands() {
local commands; commands=()
_describe -t commands 'rustup override list commands' commands "$@"
}
(( $+functions[_rustup__target__list_commands] )) ||
_rustup__target__list_commands() {
local commands; commands=()
_describe -t commands 'rustup target list commands' commands "$@"
}
(( $+functions[_rustup__toolchain__list_commands] )) ||
_rustup__toolchain__list_commands() {
local commands; commands=()
_describe -t commands 'rustup toolchain list commands' commands "$@"
}
(( $+functions[_rustup__man_commands] )) ||
_rustup__man_commands() {
local commands; commands=()
_describe -t commands 'rustup man commands' commands "$@"
}
(( $+functions[_rustup__override_commands] )) ||
_rustup__override_commands() {
local commands; commands=(
'list:List directory toolchain overrides' \
'set:Set the override toolchain for a directory' \
'unset:Remove the override toolchain for a directory' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup override commands' commands "$@"
}
(( $+functions[_rustup__set__profile_commands] )) ||
_rustup__set__profile_commands() {
local commands; commands=()
_describe -t commands 'rustup set profile commands' commands "$@"
}
(( $+functions[_rustup__show__profile_commands] )) ||
_rustup__show__profile_commands() {
local commands; commands=()
_describe -t commands 'rustup show profile commands' commands "$@"
}
(( $+functions[_rustup__component__remove_commands] )) ||
_rustup__component__remove_commands() {
local commands; commands=()
_describe -t commands 'rustup component remove commands' commands "$@"
}
(( $+functions[_rustup__target__remove_commands] )) ||
_rustup__target__remove_commands() {
local commands; commands=()
_describe -t commands 'rustup target remove commands' commands "$@"
}
(( $+functions[_rustup__run_commands] )) ||
_rustup__run_commands() {
local commands; commands=()
_describe -t commands 'rustup run commands' commands "$@"
}
(( $+functions[_rustup__self_commands] )) ||
_rustup__self_commands() {
local commands; commands=(
'update:Download and install updates to rustup' \
'uninstall:Uninstall rustup.' \
'upgrade-data:Upgrade the internal data format.' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup self commands' commands "$@"
}
(( $+functions[_rustup__override__set_commands] )) ||
_rustup__override__set_commands() {
local commands; commands=()
_describe -t commands 'rustup override set commands' commands "$@"
}
(( $+functions[_rustup__set_commands] )) ||
_rustup__set_commands() {
local commands; commands=(
'default-host:The triple used to identify toolchains when not specified' \
'profile:The default components installed' \
'auto-self-update:The rustup auto self update mode' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup set commands' commands "$@"
}
(( $+functions[_rustup__show_commands] )) ||
_rustup__show_commands() {
local commands; commands=(
'active-toolchain:Show the active toolchain' \
'home:Display the computed value of RUSTUP_HOME' \
'profile:Show the current profile' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup show commands' commands "$@"
}
(( $+functions[_rustup__target_commands] )) ||
_rustup__target_commands() {
local commands; commands=(
'list:List installed and available targets' \
'add:Add a target to a Rust toolchain' \
'remove:Remove a target from a Rust toolchain' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup target commands' commands "$@"
}
(( $+functions[_rustup__toolchain_commands] )) ||
_rustup__toolchain_commands() {
local commands; commands=(
'list:List installed toolchains' \
'install:Install or update a given toolchain' \
'uninstall:Uninstall a toolchain' \
'link:Create a custom toolchain by symlinking to a directory' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rustup toolchain commands' commands "$@"
}
(( $+functions[_rustup__self__uninstall_commands] )) ||
_rustup__self__uninstall_commands() {
local commands; commands=()
_describe -t commands 'rustup self uninstall commands' commands "$@"
}
(( $+functions[_rustup__toolchain__uninstall_commands] )) ||
_rustup__toolchain__uninstall_commands() {
local commands; commands=()
_describe -t commands 'rustup toolchain uninstall commands' commands "$@"
}
(( $+functions[_rustup__uninstall_commands] )) ||
_rustup__uninstall_commands() {
local commands; commands=()
_describe -t commands 'rustup uninstall commands' commands "$@"
}
(( $+functions[_rustup__override__unset_commands] )) ||
_rustup__override__unset_commands() {
local commands; commands=()
_describe -t commands 'rustup override unset commands' commands "$@"
}
(( $+functions[_rustup__self__update_commands] )) ||
_rustup__self__update_commands() {
local commands; commands=()
_describe -t commands 'rustup self update commands' commands "$@"
}
(( $+functions[_rustup__update_commands] )) ||
_rustup__update_commands() {
local commands; commands=()
_describe -t commands 'rustup update commands' commands "$@"
}
(( $+functions[_rustup__self__upgrade-data_commands] )) ||
_rustup__self__upgrade-data_commands() {
local commands; commands=()
_describe -t commands 'rustup self upgrade-data commands' commands "$@"
}
(( $+functions[_rustup__which_commands] )) ||
_rustup__which_commands() {
local commands; commands=()
_describe -t commands 'rustup which commands' commands "$@"
}
_rustup "$@"

47
.zshrc
View File

@ -1,11 +1,19 @@
### ENVVARS
PATH="/usr/bin:/usr/sbin:$HOME/.local/bin:$HOME/.cargo/bin:/usr/local/bin"
PATH="/usr/bin:/usr/sbin:$HOME/.local/bin:$HOME/.cargo/bin:/usr/local/bin:$HOME/.deno/bin"
export PATH
export EDITOR=nvim
export editor=nvim
export XDG_CONFIG_HOME=~/.config
export TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
export ZSH=$HOME/.zsh
export CLIPBOARD_NOGUI=1 # wayland only allows GUI apps to use the clipboard.
# cb would have to open every 2 seconds and steal
# focus. This sucks, so I will have to disable GUI
# integration (yes that means ctrl+v) for now.
#
# For wayland, set this to `1`
# see https://github.com/Slackadays/Clipboard/issues/171
### Aliases
alias l="ls -lah"
@ -20,11 +28,7 @@ alias isotime='date +"%Y-%m-%dT%H:%M:%S%z"'
alias gg=lazygit
alias reload="source ~/.zshrc"
alias gls=/bin/ls
### non standard aliases
if [ -f ~/.zsh_aliases ]; then
source ~/.zsh_aliases
fi
alias gotemp="cd $(mktemp -d)"
### Functions
function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\s" }
@ -33,10 +37,15 @@ function smallfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(B|K)\s" }
function newpass() {
LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c${1:-$0}
}
function condac() {
conda activate $@
export HOST=$(hostname)
}
### ---- zsh options -------------------------------------
setopt autocd
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_IGNORE_ALL_DUPS
setopt appendhistory
setopt INC_APPEND_HISTORY
@ -94,6 +103,7 @@ bindkey '^M' expand-dots-then-accept-line
PS1='%B%F{red}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k'
### ---- ZSH MODULES -----------------------------------
fpath+=$ZSH/zfunc
# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
@ -175,3 +185,28 @@ else
eval "$(zoxide init zsh)"
fi
### --- conda Config -------------------------------------
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/plex/.local/share/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/plex/.local/share/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/plex/.local/share/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/plex/.local/share/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# we don't want to see (base) constantly, so we do this:
PS1=$(echo $PS1 | sed 's/(base) //') # remove base
### load unversioned zsh code
if [ -f ~/.zsh.local ]; then
source ~/.zsh.local
else
touch ~/.zsh.local
fi