commit b2d211e257e62cc26771f6c7c0a03f769cbf9e67 from: mtmn date: Sat Aug 1 06:01:17 2026 UTC backup zsh completion, mpv fixes, etc. commit - 838681870e6b49fa8e7c76cd83928a00fd702b3d commit + b2d211e257e62cc26771f6c7c0a03f769cbf9e67 blob - bd6b991bd2d3ae07543e0122b49c35b1bd23d224 blob + 22c869e34745765b2ac68bdac81f13bf7f7a1131 --- flake.lock +++ flake.lock @@ -250,11 +250,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1785452004, - "narHash": "sha256-k94ksv7XmaLeK5sE1ST/TTdu2aDEO9sfbcgEaNJPTXA=", + "lastModified": 1785542685, + "narHash": "sha256-sjfvXMbG5pCFgpvw2OZAFcZiTvrppCWvnB6cuGrSY08=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a5e9f2fd9ef6011c6886d6935f3ef678c81385fa", + "rev": "f8e81fc7eb063db454f563cdd596fb96a5ad1497", "type": "github" }, "original": { blob - 1ecdba901addc7463c6d3c011861cffcedbcfa95 blob + 4442968891e3be980fc740fdbb1dd777804acff4 Binary files hosts/void/overlays/config/shell/rc/void and hosts/void/overlays/config/shell/rc/void differ blob - a753c28e323e82f1ba5bb12fc4b102cf32aa3a94 blob + aec7f8499b54f29144a90a11d0f93df6bcfdc752 --- modules/mixins/dotfiles/config/mpv/mpv.conf +++ modules/mixins/dotfiles/config/mpv/mpv.conf @@ -1,4 +1,5 @@ hwdec=auto-safe +hwdec-codecs=h264,vc1,hevc,vp8,vp9,prores,prores_raw,ffv1,dpx vo=gpu gpu-api=opengl @@ -47,4 +48,3 @@ vo=gpu-next gpu-api=vulkan hwdec=no tone-mapping=bt.2446a -tone-mapping-mode=luma blob - d38061197ee3e9d6bf2dee7dea06563481115b9c blob + c6739f65c64a9d26eae9282f3b8b19163dde6003 --- modules/mixins/dotfiles/config/shell/rc/aliased-short-names +++ modules/mixins/dotfiles/config/shell/rc/aliased-short-names @@ -87,7 +87,7 @@ alias apc='ansible-playbook --check --diff' alias yt_dlp_audio_url='yt-dlp -f bestaudio -g' alias yt_dlp_audio='yt-dlp --embed-thumbnail --write-thumbnail --extract-audio --audio-format mp3 --audio-quality 0' -alias nds='nix develop' +alias nds='nix develop --command zsh' alias nbr='nix build --builders ssh://root@furion' alias hms='just --justfile ~/src/sr.ht/nix/justfile home' blob - d7aca74f440faba8e74f210ba4af680d07e432b3 blob + 4f269c8e6f4e31f84838071ab458104cb7dc1414 --- modules/mixins/dotfiles/config/shell/rc/prompt-functions +++ modules/mixins/dotfiles/config/shell/rc/prompt-functions @@ -42,12 +42,17 @@ _prompt_pwd() { esac } -_prompt_git() { +_prompt_nix() { + [ -n "${IN_NIX_SHELL-}" ] || return + _seg "$C_6" '❄' +} + +_prompt_git_ref() { head=${GIT_DIR:-.git}/HEAD if [ -r "$head" ]; then IFS= read -r ref <"$head" || return case "$ref" in - refs/heads/*) _seg "$C_6" "[${ref#refs/heads/}]" ;; + refs/heads/*) printf '[%s]' "${ref#refs/heads/}" ;; *) return ;; esac else @@ -74,13 +79,19 @@ _prompt_time() { } _get_ps1() { - exit_status=$? + exit_status=${1:-$?} sep=' ' pwd=$(_prompt_pwd) - git=$(_prompt_git) + git_ref=$(_prompt_git_ref) + if [ -n "$git_ref" ]; then + git=$(_seg "$C_6" "$git_ref") + else + git='' + fi time=$(_prompt_time) host=$(_prompt_host) take=$(_prompt_takeover) + nix=$(_prompt_nix) l1="$_CORNER_TL$pwd" if [ -n "$git" ]; then @@ -88,6 +99,9 @@ _get_ps1() { fi l2="$_CORNER_BL$time" + if [ -n "$nix" ]; then + l2="$l2$sep$nix" + fi if [ -n "$host" ]; then l2="$l2$sep$host" fi @@ -100,7 +114,5 @@ _get_ps1() { marker=$_MARKER_ERROR fi l2="$l2$sep$marker" - - # POSIX-compatible printf printf '%s\n%s ' "$l1" "$l2" } blob - c34c572b0589be7969ca10791c6414d62f472089 (mode 644) blob + /dev/null --- modules/mixins/dotfiles/config/zsh/completion/_bazel +++ /dev/null @@ -1,341 +0,0 @@ -#compdef bazel - -# Copyright 2015 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Installation -# ------------ -# -# 1. Add this script to a directory on your $fpath: -# fpath[1,0]=~/.zsh/completion/ -# mkdir -p ~/.zsh/completion/ -# cp scripts/zsh_completion/_bazel ~/.zsh/completion -# -# 2. Optionally, add the following to your .zshrc. -# zstyle ':completion:*' use-cache on -# zstyle ':completion:*' cache-path ~/.zsh/cache -# -# This way, the completion script does not have to parse Bazel's options -# repeatedly. The directory in cache-path must be created manually. -# -# 3. Restart the shell -# -# Options -# ------- -# completion:init:bazel:* cache-lifetime -# Lifetime for the completion cache (if turned on, default: 1 week) - -local curcontext="$curcontext" state line - -: ${BAZEL_COMPLETION_PACKAGE_PATH:=%workspace%} -: ${BAZEL:=bazel} -_bazel_b() { ${BAZEL} --noblock_for_lock "$@" 2>/dev/null; } - -# Default cache lifetime is 1 week -zstyle -s ":completion:${curcontext}:" cache-lifetime lifetime -if [[ -z "${lifetime}" ]]; then - lifetime=$((60*60*24*7)) -fi - -_bazel_cache_policy() { - local -a oldp - oldp=( "$1"(Nms+${lifetime}) ) - (( $#oldp )) -} - -_set_cache_policy() { - zstyle -s ":completion:*:$curcontext*" cache-policy update_policy - - if [[ -z "$update_policy" ]]; then - zstyle ":completion:$curcontext*" cache-policy _bazel_cache_policy - fi -} - -# Skips over all global arguments. After invocation, OFFSET contains the -# position of the bazel command in $words. -_adapt_subcommand_offset() { - OFFSET=2 - for w in ${words[2,-1]}; do - if [[ $w == (#b)-* ]]; then - (( OFFSET++ )) - else - return - fi - done -} - -# Retrieve the cache but also check that the value is not empty. -_bazel_safe_retrieve_cache() { - _retrieve_cache $1 && [[ ${(P)#2} -gt 0 ]] -} - -# Puts the name of the variable that contains the options for the bazel -# subcommand handed in as the first argument into the global variable -# _bazel_cmd_options. -_bazel_get_options() { - local lcmd=$1 - _bazel_cmd_options=_bazel_${lcmd}_options - _bazel_cmd_args=_bazel_${lcmd}_args - if [[ ${(P)#_bazel_cmd_options} != 0 ]]; then - return - fi - if _cache_invalid BAZEL_${lcmd}_options || _cache_invalid BAZEL_${lcmd}_args \ - || ! _bazel_safe_retrieve_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} \ - || ! _retrieve_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}; then - if ! eval "$(_bazel_b help completion)"; then - return - fi - local opts_var - if [[ $lcmd == "startup_options" ]]; then - opts_var="BAZEL_STARTUP_OPTIONS" - else - opts_var="BAZEL_COMMAND_${lcmd:u}_FLAGS" - fi - local -a raw_options - if ! eval "raw_options=(\${(@f)$opts_var})"; then - return - fi - - local -a option_list - for opt in $raw_options; do - case $opt in - --*"={"*) - local lst="${${opt##*"={"}%"}"}" - local opt="${opt%%=*}=" - option_list+=("${opt}:string:_values '' ${lst//,/ }") ;; - --*=path) - option_list+=("${opt%path}:path:_files") ;; - --*=label) - option_list+=("${opt%label}:target:_bazel_complete_target") ;; - --*=*) - option_list+=("${opt}:string:") ;; - *) - option_list+=("$opt") ;; - esac - done - - local -a cmd_args - local cmd_type - if eval "cmd_type=\${BAZEL_COMMAND_${lcmd:u}_ARGUMENT}" && [[ -n $cmd_type ]]; then - case $cmd_type in - label|label-*) - cmd_args+=("*::${cmd_type}:_bazel_complete_target_${cmd_type//-/_}") ;; - info-key) - cmd_args+=('1::key:_bazel_info_key') ;; - path) - cmd_args+=('1::profile:_path_files') ;; - "command|{"*"}") - local lst=${${cmd_type#"command|{"}%"}"} - cmd_args+=("1::topic:_bazel_help_topic -- ${lst//,/ }") ;; - esac - fi - - typeset -g "${_bazel_cmd_options}"="${(pj:|:)option_list[*]}" - _store_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} - typeset -g "${_bazel_cmd_args}"="${(pj:|:)cmd_args[*]}" - _store_cache BAZEL_${lcmd}_args ${_bazel_cmd_args} - fi -} - -_get_build_targets() { - local pkg=$1 - local rule_re - typeset -a completions - case $target_type in - test) - rule_re=".*_test" - ;; - build) - rule_re=".*" - ;; - bin) - rule_re=".*_test|.*_binary" - ;; - esac - completions=(${$(_bazel_b query "kind(\"${rule_re}\", ${pkg}:all)" 2>/dev/null)##*:}) - if ( (( ${#completions} > 0 )) && [[ $target_type != bin ]] ); then - completions+=(all) - fi - echo ${completions[*]} -} - -# Returns all packages that match $PREFIX. PREFIX may start with //, in which -# case the workspace roots are searched. Otherwise, they are completed based on -# PWD. -_get_build_packages() { - local workspace pfx - typeset -a package_roots paths final_paths - workspace=$PWD - package_roots=(${(ps.:.)BAZEL_COMPLETION_PACKAGE_PATH}) - package_roots=(${^package_roots//\%workspace\%/$workspace}) - if [[ "${(e)PREFIX}" == //* ]]; then - pfx=${(e)PREFIX[2,-1]} - else - pfx=${(e)PREFIX} - fi - paths=(${^package_roots}/${pfx}*(/)) - for p in ${paths[*]}; do - if [[ -f ${p}/BUILD || -f ${p}/BUILD.bazel ]]; then - final_paths+=(${p##*/}:) - fi - final_paths+=(${p##*/}/) - done - echo ${final_paths[*]} -} - -_package_remove_slash() { - if [[ $KEYS == ':' && $LBUFFER == */ ]]; then - LBUFFER=${LBUFFER[1,-2]} - fi -} - -# Completion function for BUILD targets, called by the completion system. -_bazel_complete_target() { - local expl - typeset -a packages targets - if [[ "${(e)PREFIX}" != *:* ]]; then - # There is no : in the prefix, completion can be either - # a package or a target, if the cwd is a package itself. - if [[ -f $PWD/BUILD || -f $PWD/BUILD.bazel ]]; then - targets=($(_get_build_targets "")) - _description build_target expl "BUILD target" - compadd "${expl[@]}" -a targets - fi - packages=($(_get_build_packages)) - _description build_package expl "BUILD package" - # Chop of the leading path segments from the prefix for display. - compset -P '*/' - compadd -R _package_remove_slash -S '' "${expl[@]}" -a packages - else - targets=($(_get_build_targets "${${(e)PREFIX}%:*}")) - _description build_target expl "BUILD target" - # Ignore the current prefix for the upcoming completion, since we only list - # the names of the targets, not the full path. - compset -P '*:' - compadd "${expl[@]}" -a targets - fi -} - -_bazel_complete_target_label() { - typeset -g target_type=build - _bazel_complete_target -} - -_bazel_complete_target_label_test() { - typeset -g target_type=test - _bazel_complete_target -} - -_bazel_complete_target_label_bin() { - typeset -g target_type=bin - _bazel_complete_target -} - -### Actual completion commands - -_bazel() { - _adapt_subcommand_offset - if (( CURRENT - OFFSET > 0 )); then - # Remember the subcommand name, stored globally so we can access it - # from any subsequent function - cmd=${words[OFFSET]//-/_} - - # Set the context for the subcommand. - curcontext="${curcontext%:*:*}:bazel-$cmd:" - _set_cache_policy - - # Narrow the range of words we are looking at to exclude cmd - # name and any leading options - (( CURRENT = CURRENT - OFFSET + 1 )) - shift $((OFFSET - 1)) words - # Run the completion for the subcommand - _bazel_get_options $cmd - _arguments : \ - ${(Pps:|:)_bazel_cmd_options} \ - ${(Pps:|:)_bazel_cmd_args} - else - _set_cache_policy - # Start special handling for global options, - # which can be retrieved by calling - # $ bazel help startup_options - _bazel_get_options startup_options - _arguments : \ - ${(Pps:|:)_bazel_cmd_options} \ - "*:commands:_bazel_commands" - fi - return -} - -_get_commands() { - # bazel_cmd_list is a global (g) array (a) - typeset -ga _bazel_cmd_list - # Use `bazel help` instead of `bazel help completion` to get command - # descriptions. - if _bazel_cmd_list=("${(@f)$(_bazel_b help | awk ' -/Available commands/ { command=1; } -/ [-a-z]+[ \t]+.+/ { if (command) { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" } } -/^$/ { command=0; }')}"); then - _store_cache BAZEL_commands _bazel_cmd_list - fi -} - -# Completion function for bazel subcommands, called by the completion system. -_bazel_commands() { - if [[ ${#_bazel_cmd_list} == 0 ]]; then - if _cache_invalid BAZEL_commands \ - || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then - _get_commands - fi - fi - - _describe -t bazel-commands 'Bazel command' _bazel_cmd_list -} - -# Completion function for bazel help options, called by the completion system. -_bazel_help_topic() { - if [[ ${#_bazel_cmd_list} == 0 ]]; then - if _cache_invalid BAZEL_commands \ - || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then - _get_commands - fi - fi - - while [[ $# -gt 0 ]]; do - if [[ $1 == -- ]]; then - shift - break - fi - shift - done - _bazel_help_list=($@) - _bazel_help_list+=($_bazel_cmd_list) - _describe -t bazel-help 'Help topic' _bazel_help_list -} - -# Completion function for bazel info keys, called by the completion system. -_bazel_info_key() { - if [[ ${#_bazel_info_keys_list} == 0 ]]; then - if _cache_invalid BAZEL_info_keys \ - || ! _bazel_safe_retrieve_cache BAZEL_info_keys _bazel_info_keys_list; then - typeset -ga _bazel_info_keys_list - # Use `bazel help` instead of `bazel help completion` to get info-key - # descriptions. - if _bazel_info_keys_list=("${(@f)$(_bazel_b help info-keys | awk ' - { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" }')}"); then - _store_cache BAZEL_info_keys _bazel_info_keys_list - fi - fi - fi - _describe -t bazel-info 'Key' _bazel_info_keys_list -} blob - /dev/null blob + 1d54f916bea15ef7247bbd5b7a62d1c5f152339e (mode 644) --- /dev/null +++ modules/mixins/dotfiles/config/zsh/completion/_backup @@ -0,0 +1,70 @@ +#compdef backup + +_backup() { + local curcontext="$curcontext" state state_descr line + local -a arguments targets stores sources + + arguments=( + '(-p --push)'{-p,--push}'[fetch and push changes after commit]' + '(-f --fetch)'{-f,--fetch}'[pull Git targets before backup]' + '(-q --quiet)'{-q,--quiet}'[suppress command output]' + '(-l --list)'{-l,--list}'[list configured backup targets]' + '(-e --exclude)'{-e,--exclude}'[comma-separated sources or targets to skip]:sources' + '(-h --help)'{-h,--help}'[show help]' + '1:backup target:->target' + ) + + _arguments -S -s $arguments && return + + case $state in + target) + case $words[CURRENT] in + *:*) + local backend=${words[CURRENT]%%:*} + local remainder=${words[CURRENT]#*:} + case $backend in + git) + compadd -P 'git:' -S '' - \ + bandcamp mpd nix notes pass releases + ;; + tarsnap) + compadd -P 'tarsnap:' -S '' - \ + mpd notes password-store releases + ;; + plakar) + if [[ $remainder == *:* ]]; then + local store=${remainder%%:*} + local source_spec=${remainder#*:} + local completed_sources prefix source existing + local -a remaining selected + sources=("${(@f)$(backup --list 2>/dev/null | awk '/^plakar$/{p=1; next} /^rclone$/{p=0} p && /^ /{print $1}')}") + if [[ $source_spec == *,* ]]; then + completed_sources=${source_spec%,*} + selected=("${(@s:,:)completed_sources}") + prefix="plakar:${store}:${completed_sources}," + for source in $sources; do + (( ${selected[(Ie)$source]} )) || remaining+=($source) + done + sources=($remaining) + else + prefix="plakar:${store}:" + fi + compadd -P "$prefix" -S ',' - $sources + else + stores=("${(@f)$(backup --list 2>/dev/null | awk '/^plakar$/{p=1; next} /^rclone$/{p=0} p && /^ [^ ]/ && $1 != "sources"{print $1}')}") + compadd -P 'plakar:' -S ':' - $stores + fi + ;; + rclone) + sources=("${(@f)$(backup --list 2>/dev/null | awk '/^rclone$/{p=1; next} p && /^ /{print $1}')}") + compadd -P 'rclone:' -S '' - $sources + ;; + esac + ;; + *) + compadd -S ':' - git plakar tarsnap rclone + ;; + esac + ;; + esac +} blob - d0b4766c917b068a7eda92d8a5ee9221ed6da3f6 blob + fb9adc8131ff95e2585280e0cad3bb6fa7668dcc --- modules/mixins/dotfiles/config/zsh/rc/completion +++ modules/mixins/dotfiles/config/zsh/rc/completion @@ -5,6 +5,8 @@ if [[ -d $HOME/.config/zsh/plugins/zsh-completions/src fpath=($HOME/.config/zsh/plugins/zsh-completions/src $fpath) fi +fpath=($HOME/.config/zsh/completion $fpath) + autoload -U compinit # Checking the cached .zcompdump file to see if it must be regenerated adds a blob - d6ef11545c4b3687b087101bb11a672ffb8d997f blob + 79a57be64b385402ade1be1067c0102458123ae5 --- modules/mixins/dotfiles/home/bashrc +++ modules/mixins/dotfiles/home/bashrc @@ -7,7 +7,5 @@ config_home="$HOME" . "$config_home"/.config/shell/early-funcs for file in "$config_home"/.config/{shell,bash}/rc/*; do - [[ -e $file ]] && . "$file" + [[ -e $file ]] && . "$file" done - -PS1='$(_get_ps1)'