Void Linux workstation powered by niri, Fish and NeoVim. Contains scripts, browser extensions, custom XBPS packages, and typst plugins. git.anhgelus.world/anhgelus/dotfiles
void niri fish neovim nvim vim dotfiles linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(config): fish

+491
+186
config/fish/completions/bun.fish
··· 1 + # This is terribly complicated 2 + # It's because: 3 + # 1. bun run has to have dynamic completions 4 + # 2. there are global options 5 + # 3. bun {install add remove} gets special options 6 + # 4. I don't know how to write fish completions well 7 + # Contributions very welcome!! 8 + 9 + function __fish__get_bun_bins 10 + string split ' ' (bun getcompletes b) 11 + end 12 + 13 + function __fish__get_bun_scripts 14 + set -lx SHELL bash 15 + set -lx MAX_DESCRIPTION_LEN 40 16 + string trim (string split '\n' (string split '\t' (bun getcompletes z))) 17 + end 18 + 19 + function __fish__get_bun_packages 20 + if test (commandline -ct) != "" 21 + set -lx SHELL fish 22 + string split ' ' (bun getcompletes a (commandline -ct)) 23 + end 24 + end 25 + 26 + function __history_completions 27 + set -l tokens (commandline --current-process --tokenize) 28 + history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | string replace -r \^$tokens[2]\\s\* "" | string split ' ' 29 + end 30 + 31 + function __fish__get_bun_bun_js_files 32 + string split ' ' (bun getcompletes j) 33 + end 34 + 35 + set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global 36 + set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't update package.json or save a lockfile" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependencies" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder" 37 + 38 + set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x 39 + set -l bun_builtin_cmds_accepting_flags create help bun upgrade discord run init link unlink pm x 40 + 41 + function __bun_complete_bins_scripts --inherit-variable bun_builtin_cmds_without_run -d "Emit bun completions for bins and scripts" 42 + # Do nothing if we already have a builtin subcommand, 43 + # or any subcommand other than "run". 44 + if __fish_seen_subcommand_from $bun_builtin_cmds_without_run 45 + or not __fish_use_subcommand && not __fish_seen_subcommand_from run 46 + return 47 + end 48 + # Do we already have a bin or script subcommand? 49 + set -l bins (__fish__get_bun_bins) 50 + if __fish_seen_subcommand_from $bins 51 + return 52 + end 53 + # Scripts have descriptions appended with a tab separator. 54 + # Strip off descriptions for the purposes of subcommand testing. 55 + set -l scripts (__fish__get_bun_scripts) 56 + if __fish_seen_subcommand_from (string split \t -f 1 -- $scripts) 57 + return 58 + end 59 + # Emit scripts. 60 + for script in $scripts 61 + echo $script 62 + end 63 + # Emit binaries and JS files (but only if we're doing `bun run`). 64 + if __fish_seen_subcommand_from run 65 + for bin in $bins 66 + echo "$bin"\t"package bin" 67 + end 68 + for file in (__fish__get_bun_bun_js_files) 69 + echo "$file"\t"Bun.js" 70 + end 71 + end 72 + end 73 + 74 + 75 + # Clear existing completions 76 + complete -e -c bun 77 + 78 + # Dynamically emit scripts and binaries 79 + complete -c bun -f -a "(__bun_complete_bins_scripts)" 80 + 81 + # Complete flags if we have no subcommand or a flag-friendly one. 82 + set -l flag_applies "__fish_use_subcommand; or __fish_seen_subcommand_from $bun_builtin_cmds_accepting_flags" 83 + complete -c bun \ 84 + -n $flag_applies --no-files -s 'u' -l 'origin' -r -d 'Server URL. Rewrites import paths' 85 + complete -c bun \ 86 + -n $flag_applies --no-files -s 'p' -l 'port' -r -d 'Port number to start server from' 87 + complete -c bun \ 88 + -n $flag_applies --no-files -s 'd' -l 'define' -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"' 89 + complete -c bun \ 90 + -n $flag_applies --no-files -s 'e' -l 'external' -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react' 91 + complete -c bun \ 92 + -n $flag_applies --no-files -l 'use' -r -d 'Use a framework (ex: next)' 93 + complete -c bun \ 94 + -n $flag_applies --no-files -l 'hot' -r -d 'Enable hot reloading in Bun\'s JavaScript runtime' 95 + 96 + # Complete dev and create as first subcommand. 97 + complete -c bun \ 98 + -n "__fish_use_subcommand" -a 'dev' -d 'Start dev server' 99 + complete -c bun \ 100 + -n "__fish_use_subcommand" -a 'create' -f -d 'Create a new project from a template' 101 + 102 + # Complete "next" and "react" if we've seen "create". 103 + complete -c bun \ 104 + -n "__fish_seen_subcommand_from create" -a 'next' -d 'new Next.js project' 105 + 106 + complete -c bun \ 107 + -n "__fish_seen_subcommand_from create" -a 'react' -d 'new React project' 108 + 109 + # Complete "upgrade" as first subcommand. 110 + complete -c bun \ 111 + -n "__fish_use_subcommand" -a 'upgrade' -d 'Upgrade bun to the latest version' -x 112 + # Complete "-h/--help" unconditionally. 113 + complete -c bun \ 114 + -s "h" -l "help" -d 'See all commands and flags' -x 115 + 116 + # Complete "-v/--version" if we have no subcommand. 117 + complete -c bun \ 118 + -n "not __fish_use_subcommand" -l "version" -s "v" -d 'Bun\'s version' -x 119 + 120 + # Complete additional subcommands. 121 + complete -c bun \ 122 + -n "__fish_use_subcommand" -a 'discord' -d 'Open bun\'s Discord server' -x 123 + 124 + 125 + complete -c bun \ 126 + -n "__fish_use_subcommand" -a 'bun' -d 'Generate a new bundle' 127 + 128 + 129 + complete -c bun \ 130 + -n "__fish_seen_subcommand_from bun" -F -d 'Bundle this' 131 + 132 + complete -c bun \ 133 + -n "__fish_seen_subcommand_from create; and __fish_seen_subcommand_from react next" -F -d "Create in directory" 134 + 135 + 136 + complete -c bun \ 137 + -n "__fish_use_subcommand" -a 'init' -F -d 'Start an empty Bun project' 138 + 139 + complete -c bun \ 140 + -n "__fish_use_subcommand" -a 'install' -f -d 'Install packages from package.json' 141 + 142 + complete -c bun \ 143 + -n "__fish_use_subcommand" -a 'add' -F -d 'Add a package to package.json' 144 + 145 + complete -c bun \ 146 + -n "__fish_use_subcommand" -a 'remove' -F -d 'Remove a package from package.json' 147 + 148 + 149 + for i in (seq (count $bun_install_boolean_flags)) 150 + complete -c bun \ 151 + -n "__fish_seen_subcommand_from install add remove" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]" 152 + end 153 + 154 + complete -c bun \ 155 + -n "__fish_seen_subcommand_from install add remove" -l 'cwd' -d 'Change working directory' 156 + 157 + complete -c bun \ 158 + -n "__fish_seen_subcommand_from install add remove" -l 'cache-dir' -d 'Choose a cache directory (default: $HOME/.bun/install/cache)' 159 + 160 + complete -c bun \ 161 + -n "__fish_seen_subcommand_from add" -d 'Popular' -a '(__fish__get_bun_packages)' 162 + 163 + complete -c bun \ 164 + -n "__fish_seen_subcommand_from add" -d 'History' -a '(__history_completions)' 165 + 166 + complete -c bun \ 167 + -n "__fish_seen_subcommand_from pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) cache;" -a 'bin ls cache hash hash-print hash-string' -f 168 + 169 + complete -c bun \ 170 + -n "__fish_seen_subcommand_from pm; and __fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts);" -a 'rm' -f 171 + 172 + # Add built-in subcommands with descriptions. 173 + complete -c bun -n "__fish_use_subcommand" -a "create" -f -d "Create a new project from a template" 174 + complete -c bun -n "__fish_use_subcommand" -a "build bun" --require-parameter -F -d "Transpile and bundle one or more files" 175 + complete -c bun -n "__fish_use_subcommand" -a "upgrade" -d "Upgrade Bun" 176 + complete -c bun -n "__fish_use_subcommand" -a "run" -d "Run a script or package binary" 177 + complete -c bun -n "__fish_use_subcommand" -a "install" -d "Install dependencies from package.json" -f 178 + complete -c bun -n "__fish_use_subcommand" -a "remove" -d "Remove a dependency from package.json" -f 179 + complete -c bun -n "__fish_use_subcommand" -a "add" -d "Add a dependency to package.json" -f 180 + complete -c bun -n "__fish_use_subcommand" -a "init" -d "Initialize a Bun project in this directory" -f 181 + complete -c bun -n "__fish_use_subcommand" -a "link" -d "Register or link a local npm package" -f 182 + complete -c bun -n "__fish_use_subcommand" -a "unlink" -d "Unregister a local npm package" -f 183 + complete -c bun -n "__fish_use_subcommand" -a "pm" -d "Additional package management utilities" -f 184 + complete -c bun -n "__fish_use_subcommand" -a "x" -d "Execute a package binary, installing if needed" -f 185 + complete -c bun -n "__fish_use_subcommand" -a "outdated" -d "Display the latest versions of outdated dependencies" -f 186 + complete -c bun -n "__fish_use_subcommand" -a "publish" -d "Publish your package from local to npm" -f
+177
config/fish/completions/packwiz.fish
··· 1 + # fish completion for packwiz -*- shell-script -*- 2 + 3 + function __packwiz_debug 4 + set -l file "$BASH_COMP_DEBUG_FILE" 5 + if test -n "$file" 6 + echo "$argv" >> $file 7 + end 8 + end 9 + 10 + function __packwiz_perform_completion 11 + __packwiz_debug "Starting __packwiz_perform_completion" 12 + 13 + # Extract all args except the last one 14 + set -l args (commandline -opc) 15 + # Extract the last arg and escape it in case it is a space 16 + set -l lastArg (string escape -- (commandline -ct)) 17 + 18 + __packwiz_debug "args: $args" 19 + __packwiz_debug "last arg: $lastArg" 20 + 21 + # Disable ActiveHelp which is not supported for fish shell 22 + set -l requestComp "PACKWIZ_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg" 23 + 24 + __packwiz_debug "Calling $requestComp" 25 + set -l results (eval $requestComp 2> /dev/null) 26 + 27 + # Some programs may output extra empty lines after the directive. 28 + # Let's ignore them or else it will break completion. 29 + # Ref: https://github.com/spf13/cobra/issues/1279 30 + for line in $results[-1..1] 31 + if test (string trim -- $line) = "" 32 + # Found an empty line, remove it 33 + set results $results[1..-2] 34 + else 35 + # Found non-empty line, we have our proper output 36 + break 37 + end 38 + end 39 + 40 + set -l comps $results[1..-2] 41 + set -l directiveLine $results[-1] 42 + 43 + # For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>) 44 + # completions must be prefixed with the flag 45 + set -l flagPrefix (string match -r -- '-.*=' "$lastArg") 46 + 47 + __packwiz_debug "Comps: $comps" 48 + __packwiz_debug "DirectiveLine: $directiveLine" 49 + __packwiz_debug "flagPrefix: $flagPrefix" 50 + 51 + for comp in $comps 52 + printf "%s%s\n" "$flagPrefix" "$comp" 53 + end 54 + 55 + printf "%s\n" "$directiveLine" 56 + end 57 + 58 + # This function does two things: 59 + # - Obtain the completions and store them in the global __packwiz_comp_results 60 + # - Return false if file completion should be performed 61 + function __packwiz_prepare_completions 62 + __packwiz_debug "" 63 + __packwiz_debug "========= starting completion logic ==========" 64 + 65 + # Start fresh 66 + set --erase __packwiz_comp_results 67 + 68 + set -l results (__packwiz_perform_completion) 69 + __packwiz_debug "Completion results: $results" 70 + 71 + if test -z "$results" 72 + __packwiz_debug "No completion, probably due to a failure" 73 + # Might as well do file completion, in case it helps 74 + return 1 75 + end 76 + 77 + set -l directive (string sub --start 2 $results[-1]) 78 + set --global __packwiz_comp_results $results[1..-2] 79 + 80 + __packwiz_debug "Completions are: $__packwiz_comp_results" 81 + __packwiz_debug "Directive is: $directive" 82 + 83 + set -l shellCompDirectiveError 1 84 + set -l shellCompDirectiveNoSpace 2 85 + set -l shellCompDirectiveNoFileComp 4 86 + set -l shellCompDirectiveFilterFileExt 8 87 + set -l shellCompDirectiveFilterDirs 16 88 + 89 + if test -z "$directive" 90 + set directive 0 91 + end 92 + 93 + set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2) 94 + if test $compErr -eq 1 95 + __packwiz_debug "Received error directive: aborting." 96 + # Might as well do file completion, in case it helps 97 + return 1 98 + end 99 + 100 + set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2) 101 + set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2) 102 + if test $filefilter -eq 1; or test $dirfilter -eq 1 103 + __packwiz_debug "File extension filtering or directory filtering not supported" 104 + # Do full file completion instead 105 + return 1 106 + end 107 + 108 + set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2) 109 + set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2) 110 + 111 + __packwiz_debug "nospace: $nospace, nofiles: $nofiles" 112 + 113 + # If we want to prevent a space, or if file completion is NOT disabled, 114 + # we need to count the number of valid completions. 115 + # To do so, we will filter on prefix as the completions we have received 116 + # may not already be filtered so as to allow fish to match on different 117 + # criteria than the prefix. 118 + if test $nospace -ne 0; or test $nofiles -eq 0 119 + set -l prefix (commandline -t | string escape --style=regex) 120 + __packwiz_debug "prefix: $prefix" 121 + 122 + set -l completions (string match -r -- "^$prefix.*" $__packwiz_comp_results) 123 + set --global __packwiz_comp_results $completions 124 + __packwiz_debug "Filtered completions are: $__packwiz_comp_results" 125 + 126 + # Important not to quote the variable for count to work 127 + set -l numComps (count $__packwiz_comp_results) 128 + __packwiz_debug "numComps: $numComps" 129 + 130 + if test $numComps -eq 1; and test $nospace -ne 0 131 + # We must first split on \t to get rid of the descriptions to be 132 + # able to check what the actual completion will be. 133 + # We don't need descriptions anyway since there is only a single 134 + # real completion which the shell will expand immediately. 135 + set -l split (string split --max 1 \t $__packwiz_comp_results[1]) 136 + 137 + # Fish won't add a space if the completion ends with any 138 + # of the following characters: @=/:., 139 + set -l lastChar (string sub -s -1 -- $split) 140 + if not string match -r -q "[@=/:.,]" -- "$lastChar" 141 + # In other cases, to support the "nospace" directive we trick the shell 142 + # by outputting an extra, longer completion. 143 + __packwiz_debug "Adding second completion to perform nospace directive" 144 + set --global __packwiz_comp_results $split[1] $split[1]. 145 + __packwiz_debug "Completions are now: $__packwiz_comp_results" 146 + end 147 + end 148 + 149 + if test $numComps -eq 0; and test $nofiles -eq 0 150 + # To be consistent with bash and zsh, we only trigger file 151 + # completion when there are no other completions 152 + __packwiz_debug "Requesting file completion" 153 + return 1 154 + end 155 + end 156 + 157 + return 0 158 + end 159 + 160 + # Since Fish completions are only loaded once the user triggers them, we trigger them ourselves 161 + # so we can properly delete any completions provided by another script. 162 + # Only do this if the program can be found, or else fish may print some errors; besides, 163 + # the existing completions will only be loaded if the program can be found. 164 + if type -q "packwiz" 165 + # The space after the program name is essential to trigger completion for the program 166 + # and not completion of the program name itself. 167 + # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. 168 + complete --do-complete "packwiz " > /dev/null 2>&1 169 + end 170 + 171 + # Remove any pre-existing completions for the program since we will be handling all of them. 172 + complete -c packwiz -e 173 + 174 + # The call to __packwiz_prepare_completions will setup __packwiz_comp_results 175 + # which provides the program's completion choices. 176 + complete -c packwiz -n '__packwiz_prepare_completions' -f -a '$__packwiz_comp_results' 177 +
+14
config/fish/config.fish
··· 1 + if status is-interactive 2 + # Commands to run in interactive sessions can go here 3 + if tty | string match "/dev/tty1" 4 + $HOME/start 5 + end 6 + end 7 + 8 + # bun 9 + set --export BUN_INSTALL "$HOME/.bun" 10 + set --export GOPATH "$HOME/go" 11 + set --export PATH $BUN_INSTALL/bin $GOPATH/bin $HOME/.local/bin $PATH 12 + 13 + # gpg 14 + export GPG_TTY=$(tty)
+31
config/fish/fish_variables
··· 1 + # This file contains fish universal variable definitions. 2 + # VERSION: 3.0 3 + SETUVAR __fish_initialized:3800 4 + SETUVAR fish_color_autosuggestion:brblack 5 + SETUVAR fish_color_cancel:\x2dr 6 + SETUVAR fish_color_command:normal 7 + SETUVAR fish_color_comment:red 8 + SETUVAR fish_color_cwd:green 9 + SETUVAR fish_color_cwd_root:red 10 + SETUVAR fish_color_end:green 11 + SETUVAR fish_color_error:brred 12 + SETUVAR fish_color_escape:brcyan 13 + SETUVAR fish_color_history_current:\x2d\x2dbold 14 + SETUVAR fish_color_host:normal 15 + SETUVAR fish_color_host_remote:yellow 16 + SETUVAR fish_color_normal:normal 17 + SETUVAR fish_color_operator:brcyan 18 + SETUVAR fish_color_param:cyan 19 + SETUVAR fish_color_quote:yellow 20 + SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold 21 + SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack 22 + SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack 23 + SETUVAR fish_color_status:red 24 + SETUVAR fish_color_user:brgreen 25 + SETUVAR fish_color_valid_path:\x2d\x2dunderline 26 + SETUVAR fish_key_bindings:fish_default_key_bindings 27 + SETUVAR fish_pager_color_completion:normal 28 + SETUVAR fish_pager_color_description:yellow\x1e\x2di 29 + SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline 30 + SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan 31 + SETUVAR fish_pager_color_selected_background:\x2dr
+21
config/fish/functions/fish_greeting.fish
··· 1 + function fish_greeting 2 + if not set -q fish_greeting 3 + set -l line1 (printf (_ 'Welcome to %sanhgelus-void%s.') (set_color "#95d5b2" green) (set_color normal)) 4 + set -l line2 \n(printf (_ 'Workstation powered by the %svoid%s.') (set_color green) (set_color normal)) 5 + set -g fish_greeting "$line1$line2" 6 + end 7 + 8 + if set -q fish_private_mode 9 + set -l line (_ "fish is running in private mode, history will not be persisted.") 10 + if set -q fish_greeting[1] 11 + set -g fish_greeting $fish_greeting\n$line 12 + else 13 + set -g fish_greeting $line 14 + end 15 + end 16 + 17 + # The greeting used to be skipped when fish_greeting was empty (not just undefined) 18 + # Keep it that way to not print superfluous newlines on old configuration 19 + test -n "$fish_greeting" 20 + and echo $fish_greeting 21 + end
+34
config/fish/functions/fish_prompt.fish
··· 1 + # name: Default 2 + # author: Lily Ballard 3 + 4 + function fish_prompt --description 'Write out the prompt' 5 + set -l last_pipestatus $pipestatus 6 + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. 7 + set -l normal (set_color normal) 8 + set -q fish_color_status 9 + or set -g fish_color_status red 10 + 11 + # Color the prompt differently when we're root 12 + set -l color_cwd "#ffd6ff" 13 + set -l suffix '>' 14 + if functions -q fish_is_root_user; and fish_is_root_user 15 + if set -q fish_color_cwd_root 16 + set color_cwd $fish_color_cwd_root 17 + end 18 + set suffix '#' 19 + end 20 + 21 + # Write pipestatus 22 + # If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it. 23 + set -l bold_flag --bold 24 + set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation 25 + if test $__fish_prompt_status_generation = $status_generation 26 + set bold_flag 27 + end 28 + set __fish_prompt_status_generation $status_generation 29 + set -l status_color (set_color $fish_color_status) 30 + set -l statusb_color (set_color $bold_flag $fish_color_status) 31 + set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) 32 + 33 + echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " " 34 + end
+28
config/fish/functions/prompt_login.fish
··· 1 + function prompt_login --description "display user name for the prompt" 2 + if not set -q __fish_machine 3 + set -g __fish_machine 4 + set -l debian_chroot $debian_chroot 5 + 6 + if test -r /etc/debian_chroot 7 + set debian_chroot (cat /etc/debian_chroot) 8 + end 9 + 10 + if set -q debian_chroot[1] 11 + and test -n "$debian_chroot" 12 + set -g __fish_machine "(chroot:$debian_chroot)" 13 + end 14 + end 15 + 16 + # Prepend the chroot environment if present 17 + if set -q __fish_machine[1] 18 + echo -n -s (set_color yellow) "$__fish_machine" (set_color normal) ' ' 19 + end 20 + 21 + # If we're running via SSH, change the host color. 22 + set -l color_host "#95d5b2" 23 + if set -q SSH_TTY; and set -q fish_color_host_remote 24 + set color_host $fish_color_host_remote 25 + end 26 + 27 + echo -n -s (set_color "#ffd6ff" green) "$USER" (set_color normal) @ (set_color $color_host) (prompt_hostname) (set_color normal) 28 + end