this repo has no description
0
fork

Configure Feed

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

Miscellaneous git/fish configurations

- Check in config for gh and gitkeep dirs for gdb + emacs
- Misc. gitignore, git aliases, and SSH config updates
- Various fish completion fixes, functions, etc.

+244 -35
+1 -1
.config/bat/config
··· 1 - # --theme="Monokai Extended" 1 + --theme="Monokai Extended" 2 2 3 3 # This is not supported on all terminal emulators (like tmux, by default) 4 4 # --italic-text="always"
+11
.config/cargo/config.toml
··· 13 13 # "./target:/app/target", 14 14 # "test-runner-3ds:latest", 15 15 # ] 16 + [alias] 17 + # would be nice to make this default even for `cargo check` fully spelled out: 18 + c = "check --all-targets" 19 + cl = "clippy --all-targets" 20 + rr = "run --release" 21 + i = "install --locked" 22 + 23 + w = "watch -w src,crates --command run --clear" 24 + 25 + # This works slightly better than cargo-alias, but also only works on nightly :( 26 + aliases = "-Zunstable-options config get alias"
+11 -6
.config/fish/completions/cargo.fish
··· 26 26 end 27 27 end 28 28 29 - # Check command works the same as b/build basically so we can reuse those completions 29 + # Check command works the same as b/build basically so we can reuse those completions. Fixed in 4.0 30 30 # https://github.com/fish-shell/fish-shell/pull/10499 31 31 for x in check c 32 32 complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bench -a "(cargo bench --bench 2>&1 | string replace -rf '^\s+' '')" ··· 47 47 complete -c cargo -n "__fish_seen_subcommand_from 3ds" -f -a "$__fish_cargo_subcommands" 48 48 49 49 # This might be easier with https://github.com/fish-shell/fish-shell/issues/7107 50 - # But for now we just sub in `check` for `clippy` and fallback to regular completions 51 - function __fish_cmdline_clippy_as_check 50 + function __fish_cmdline_replace_cmd -a orig_cmd new_cmd 52 51 set -l cmd 53 52 # Not sure exactly why this works, but sudo.fish completion also uses this pattern: 54 53 set -l toks (commandline -opc) (commandline -ct) 55 54 for tok in $toks 56 - if test "$tok" = clippy 57 - set tok check 55 + if test "$tok" = $orig_cmd 56 + set tok $new_cmd 58 57 end 59 58 set -a cmd $tok 60 59 end 61 60 string join -- " " $cmd 62 61 end 63 62 63 + 64 + # Aliases / clippy 65 + # Just sub in `check` for `clippy` and fallback to regular completions 64 66 complete -c cargo -n "__fish_seen_subcommand_from clippy" \ 65 - -a '(complete --do-complete (__fish_cmdline_clippy_as_check))' 67 + -a '(complete --do-complete (__fish_cmdline_replace_cmd clippy check))' 68 + 69 + complete -c cargo -n "__fish_seen_subcommand_from t" \ 70 + -a '(complete --do-complete (__fish_cmdline_replace_cmd t test))'
+2
.config/fish/completions/git.exe.fish
··· 1 + # Mainly for WSL things to work... I could probably do this more programmatically but meh 2 + complete -c git.exe --wraps git
+21 -6
.config/fish/conf.d/50-config.fish
··· 36 36 # Set jq to show null/true/false as magenta instead of black or otherwise 37 37 set -gx JQ_COLORS "1;35:1;35:1;35:0;39:0;32:1;39:1;39" 38 38 39 + # Most of the default fish theme colors are fine, but escape sequences are a little too close 40 + # to some other colors; this makes them more like my editor 41 + set -g fish_color_escape "#AE81FF" 42 + 39 43 # Use `bat` as pager if it present 40 44 if command -qs bat 41 45 set -gx PAGER bat ··· 48 52 set sed gsed 49 53 end 50 54 51 - # wewlad: https://github.com/sharkdp/bat/issues/652 52 - # Pending better support from bat, just strip all overstrike chars 53 - # and rely on the syntax highlighting instead of underscores/bold 54 - set -gx MANPAGER \ 55 - "sh -c \"$sed -E -e 's#(.)\x08\1#\1#g' -e 's#_\x08(.)#\1#g' | bat --plain --language=Manpage\"" 55 + if command -qs batman 56 + command batman --export-env | source 57 + else 58 + # wewlad: https://github.com/sharkdp/bat/issues/652 59 + # Pending better support from bat, just strip all overstrike chars 60 + # and rely on the syntax highlighting instead of underscores/bold 61 + set -gx MANPAGER \ 62 + "sh -c \"$sed -E -e 's#(.)\x08\1#\1#g' -e 's#_\x08(.)#\1#g' | bat --plain --language=Manpage\"" 63 + end 56 64 end 57 65 58 66 # https://stackoverflow.com/a/39352670 ··· 81 89 $DEVKITARM/bin \ 82 90 $DEVKITPRO/tools/bin \ 83 91 ~/.cargo/bin \ 92 + ~/.config/cargo/bin \ 84 93 ~/.local/share/rbenv/shims \ 85 94 ~/.local/bin \ 86 95 $GOPATH/bin \ ··· 108 117 # Any explicit nix store paths should remain at the front, most likely 109 118 # introduced by e.g. `nix shell` or `nix develop` 110 119 if string match --quiet -- '/nix/store/*' "$pth" 111 - fish_add_path --global --prepend --move "$pth" 120 + fish_add_path --global --prepend --move --path "$pth" 112 121 end 122 + end 123 + 124 + # interactiveShellInit seems to be usable as its own sourceable file to do this 125 + # automatically in some later nixpkgs but for now just gonna add this manually 126 + if not contains /etc/fish/generated_completions -- $fish_complete_path 127 + set -a fish_complete_path /etc/fish/generated_completions 113 128 end 114 129 115 130 # https://github.com/nix-community/home-manager/issues/5602
-1
.config/fish/conf.d/51-envs.fish
··· 6 6 7 7 set -Ux PYENV_VIRTUALENV_DISABLE_PROMPT 1 8 8 9 - 10 9 if status is-interactive 11 10 # TODO: rtx activation can be inlined here, and replace pyenv/rbenv ideally 12 11 if command -qs rtx
+1 -1
.config/fish/conf.d/55-events.fish
··· 2 2 3 3 function __set_color_theme --on-event fish_preexec 4 4 # On macOS, this can change dynamically, so re-evaluate every time 5 - if test $YADM_OS = Darwin 5 + if test "$YADM_OS" = Darwin 6 6 if test "$(defaults read -g AppleInterfaceStyle 2>/dev/null)" != Dark 7 7 set -gx COLOR_THEME light 8 8 else
+9
.config/fish/functions/find_completions.fish
··· 1 + function find_completions 2 + for pth in $fish_complete_path 3 + set -l possible_completion "$pth/$argv[1].fish" 4 + if test -f $possible_completion 5 + echo $possible_completion 6 + break 7 + end 8 + end 9 + end
+31 -6
.config/fish/functions/fish_prompt.fish
··· 45 45 set __fish_prompt_nix "$white""($nix_icon nix) $__fish_prompt_normal" 46 46 end 47 47 48 + set -l __fish_prompt_direnv "" 49 + if set -q DIRENV_USED 50 + set -l direnv_dir (basename "$DIRENV_USED") 51 + if string match -q "flake:*" -- "$DIRENV_USED" 52 + set direnv_dir "$nix_icon $direnv_dir" 53 + set __fish_prompt_nix "" 54 + else 55 + set direnv_dir " $direnv_dir" 56 + end 57 + set -l direnv_dir (string shorten --max 15 -- "$direnv_dir") 58 + set __fish_prompt_direnv "$white""($direnv_dir) $__fish_prompt_normal" 59 + end 60 + 48 61 set -l prompt_hostname (prompt_hostname) 49 62 # Color hostname magenta if we're in a container, otherwise just use it as-is 50 63 if test -f /run/.containerenv # podman ··· 54 67 55 68 set -l prompt_os (uname) 56 69 if test "$YADM_DISTRO" = nixos 57 - set prompt_os "$nix_icon " 70 + set prompt_os "$nix_icon" 58 71 else if test $prompt_os = Darwin 59 - set prompt_os " " 60 - else if test $prompt_os = Linux # Maybe could special-case nixos here? 61 - set prompt_os " " 72 + set prompt_os "" 73 + else if test $prompt_os = Linux 74 + set prompt_os "" 62 75 else 63 76 set prompt_os "" 64 77 end 78 + if test "$YADM_OS" = WSL 79 + set prompt_os "$prompt_os  " 80 + end 65 81 66 82 set prompt_os "$white$prompt_os$__fish_prompt_normal" 67 83 68 84 set first_line ( 69 - echo -n -s "$prompt_os" "$__fish_prompt_pyenv" "$__fish_prompt_nix" \ 85 + echo -n -s "$prompt_os" \ 86 + "$__fish_prompt_pyenv" "$__fish_prompt_nix" "$__fish_prompt_direnv" \ 70 87 '[' "$USER" '@' "$prompt_hostname" ']' \ 71 88 ' ' "$__fish_prompt_cwd" (prompt_pwd) 72 89 ) ··· 101 118 102 119 set -g __fish_git_prompt_shorten_branch_len $remaining_char_count 103 120 104 - set -l vcs_prompt (__fish_vcs_prompt) 121 + 122 + set -l vcs_prompt 123 + if test "$YADM_OS" = WSL; and string match -q --regex '^/mnt/[a-z]/' $PWD 124 + if git rev-parse --show-toplevel &>/dev/null 125 + set vcs_prompt (set_color bryellow)" (-WSL-)"(set_color normal) 126 + end 127 + else 128 + set vcs_prompt (__fish_vcs_prompt) 129 + end 105 130 if string length -q -- $vcs_prompt 106 131 set first_line "$first_line""$vcs_prompt" 107 132 end
+11
.config/fish/functions/fork.fish
··· 1 + function fork 2 + if test "$YADM_OS" = WSL 3 + set -l args 4 + for arg in $argv 5 + set -a args (wslpath -w -- $arg) 6 + end 7 + command fork.exe $args 8 + else 9 + command fork $argv 10 + end 11 + end
+16 -4
.config/fish/functions/upfind.fish
··· 1 1 function upfind --description 'Finds a file with the given name, upwards' 2 + set -l usage "Usage: 3 + upfind [-a|--all] [-d DIR|--from=DIR] FILE" 4 + 5 + argparse --min-args=1 a/all d/from= -- $argv 6 + or begin 7 + echo $usage 8 + return 9 + end 10 + 2 11 set dir $PWD 3 - if set -q argv[2] 4 - set dir $argv[2] 12 + if set -q _flag_from 13 + set dir $_flag_from 5 14 end 6 15 7 16 test (builtin realpath --no-symlinks $dir) != / ··· 9 18 10 19 if test -e $dir/$argv[1] 11 20 builtin realpath --no-symlinks $dir/$argv[1] 12 - else 13 - upfind $argv[1] $dir/.. 21 + if not set -ql _flag_all 22 + return 23 + end 14 24 end 25 + 26 + upfind $argv[1] --from=$dir/.. 15 27 end
+20
.config/gh/config.yml
··· 1 + # The current version of the config schema 2 + version: 1 3 + # What protocol to use when performing git operations. Supported values: ssh, https 4 + git_protocol: https 5 + # What editor gh should run when creating issues, pull requests, etc. If blank, will refer to environment. 6 + editor: 7 + # When to interactively prompt. This is a global config that cannot be overridden by hostname. Supported values: enabled, disabled 8 + prompt: enabled 9 + # Preference for editor-based interactive prompting. This is a global config that cannot be overridden by hostname. Supported values: enabled, disabled 10 + prefer_editor_prompt: disabled 11 + # A pager program to send command output to, e.g. "less". If blank, will refer to environment. Set the value to "cat" to disable the pager. 12 + pager: 13 + # Aliases allow you to create nicknames for gh commands 14 + aliases: 15 + co: pr checkout 16 + cpr: pr create --web --assignee @me 17 + # The path to a unix socket through which send HTTP connections. If blank, HTTP traffic will be handled by net/http.DefaultTransport. 18 + http_unix_socket: 19 + # What web browser gh should use when opening URLs. If blank, will refer to environment. 20 + browser:
+19 -9
.config/git/config
··· 1 1 [alias] 2 2 co = checkout 3 - br = branch 4 3 ci = commit 5 4 st = status 6 5 unstage = reset HEAD -- ··· 11 10 hardreset = reset --hard @{u} 12 11 fpush = push --force-with-lease 13 12 ld = log --pretty=format:\"%C(yellow)%h\\ %ad%C(red)%d\\ %C(reset)%s%C(blue)\\ [%cn]\" --decorate --date=relative 14 - lg = !sh -c 'git log --reverse --no-merges --pretty=format:\"%C(yellow)%h %C(reset)%s\" --decorate \"$1\"..HEAD' - 13 + lg = !bash -c 'git log --reverse --no-merges --pretty=format:\"%C(yellow)%h %C(reset)%s\" --decorate \"${1:-$(git default-branch)}\"..HEAD' - 15 14 sw = switch 16 15 softreset = reset --soft HEAD~ 17 16 default-branch = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' 18 - branch-clean = !git branch --merged origin/\"$(git default-branch)\" | egrep -v \"[*+]|$(git default-branch)\\$\" | xargs -n 1 git branch --delete 17 + clean-branches = !git branch --merged origin/\"$(git default-branch)\" | egrep -v \"[*+]|$(git default-branch)\\$\" | xargs -n 1 git branch --delete 18 + clean-gone = !git branch --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" { print $1 }' | xargs -n 1 git branch -D 19 19 alias = "!sh -c '[ $# = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias <new alias> <original command>\" >&2 && exit 1' -" 20 20 aliases = "!echo [alias]; git config --get-regexp 'alias[.].*' | sed -E 's/alias[.]([^[:space:]]+)/\t\\1 =/'" 21 21 bc = branch-clean 22 22 bpull = !sh -c 'git fetch origin $1:$1' - 23 23 vdiff = difftool -d HEAD 24 24 conflicts = !sh -c 'git diff --name-only --diff-filter=U --line-prefix="$(git rev-parse --show-toplevel)/"' 25 - local-branch = "!git branch --format '%(refname:short) %(upstream:trackshort)' | awk '{if (!$2 || $2 == \"[gone]\") print $1;}'" 26 - local-branch-clean = "!for b in $(git local-branch); do echo \"$b\"; git ld --color=always \"$b\" \"^$(git default-branch)\" | sed \"s/^/ /\"; printf \"\\x1b[B\\x1b[m\\n\"; read -r -p \"Delete branch? [y/N]: \"; if [[ \"$REPLY\" =~ ^[Yy]$ ]]; then git branch -D \"$b\"; fi; done #" 27 25 # Helpers for quoting/unquoting git aliases, from https://stackoverflow.com/questions/38057261/git-config-alias-escaping 28 26 quote-string = "!read -r l; printf \\\"!; printf %s \"$l\" | sed 's/\\([\\\"]\\)/\\\\\\1/g'; printf \" #\\\"\\n\" #" 29 27 quote-string-undo = "!read -r l; printf %s \"$l\" | sed 's/\\\\\\([\\\"]\\)/\\1/g'; printf \"\\n\" #" ··· 35 33 sswitch = !sh -c 'git stash && git switch \"$@\" && git stash pop' - 36 34 ssw = sswitch 37 35 su = submodule update 38 - copy = !fish -c \"git diff $argv | fish_clipboard_copy\" - 39 - paste = !fish -c \"fish_clipboard_paste | git apply\" 40 - ls = ls-files 36 + copy = !fish -c \"git diff --unified=3 $argv | fish_clipboard_copy\" -- 37 + paste = !fish -c \"fish_clipboard_paste | git apply $argv\" -- 38 + [tag] 39 + sort = version:refname 41 40 [core] 42 41 # editor unset, rely on $EDITOR to be set to my preference 43 42 quotePath = true 44 43 protectNTFS = false 44 + [column] 45 + ui = auto 45 46 [diff] 46 47 tool = code 47 48 context = 5 49 + algorithm = histogram 50 + colorMoved = plain 51 + # May not necessarily want to keep this one: 52 + mnemonicPrefix = true 53 + renames = true 48 54 [difftool] 49 55 trustExitCode = true 50 56 prompt = false ··· 66 72 rebase = false 67 73 [commit] 68 74 gpgsign = true 75 + verbose = true 69 76 [gpg] 70 77 program = gpg 71 78 [checkout] ··· 80 87 editor = code 81 88 [advice] 82 89 detachedHead = false 83 - 90 + [help] 91 + autocorrect = prompt 84 92 [rerere] 85 93 enabled = true 94 + autoupdate = true 86 95 [rebase] 87 96 autoSquash = true 88 97 autoStash = true 98 + updateRefs = true 89 99 [filter "lfs"] 90 100 required = true 91 101 # Don't configure process filter, my wrapper doesn't work with it
+4
.config/git/ignore
··· 51 51 Network Trash Folder 52 52 Temporary Items 53 53 .apdisk 54 + 55 + # direnv 56 + .envrc 57 + .direnv
.config/yadm/alt/.config/git/config.local##class.2work

This is a binary file and will not be displayed.

+3 -1
.config/yadm/alt/.gitattributes
··· 1 - .ssh/** filter=git-crypt diff=git-crypt 1 + .ssh/** filter=git-crypt diff=git-crypt 2 + .npmrc*2work* filter=git-crypt diff=git-crypt 3 +
.config/yadm/alt/.npmrc##class.2work,e.npmrc

This is a binary file and will not be displayed.

.config/yadm/alt/.ssh/config.local##class.2work

This is a binary file and will not be displayed.

+15
.config/yadm/alt/.vscode-server/data/Machine/settings.json##os.WSL
··· 1 + { 2 + "remote.WSL.useShellEnvironment": false, 3 + "files.eol": "\n", 4 + "vscode-neovim.useWSL": true, 5 + "nix.enableLanguageServer": true, 6 + 7 + "terminal.integrated.profiles.linux": { 8 + "Ubuntu (bash)": { 9 + "path": "wsl.exe", 10 + "args": [ "-d", "ubuntu", "--cd", "~" ], 11 + "icon": "terminal-linux", 12 + "color": "terminal.ansiMagenta", 13 + } 14 + }, 15 + }
+7
.cspell/default.txt
··· 3 3 archiver 4 4 argn 5 5 asyncio 6 + backnav'd 6 7 Bazel 7 8 bazelbuild 8 9 bazelisk ··· 14 15 capsys 15 16 CCache 16 17 CentOS 18 + CHAMI 17 19 Citra 18 20 citro 19 21 clippy 20 22 CMake 21 23 cmdbuf 24 + committerdate 22 25 concat 23 26 consts 24 27 coreutils ··· 39 42 dlig 40 43 dotfiles 41 44 dpad 45 + dplus 42 46 DUT 43 47 DUTs 44 48 eabi ··· 99 103 miri 100 104 mistsys 101 105 mkdir 106 + Monaspace 102 107 monokai 103 108 msvc 104 109 nalgebra ··· 217 222 webgl 218 223 wgpu 219 224 winit 225 + worktreepath 220 226 xargs 221 227 XQuartz 222 228 yadm 229 + yeesh 223 230 yoink 224 231 zhaofengli
+2
.local/bin/cargo-env
··· 1 + #!/usr/bin/env bash 2 + env
+33
.local/bin/git-br
··· 1 + #!/usr/bin/env bash 2 + 3 + ## In lieu of a more customizable --sort=... option, this is a shortcut to replace `git branch` which 4 + ## sorts first by a known prefix, then by committerdate. It 5 + ## Output format is based on the upstream implementation: 6 + ## <https://github.com/git/git/blob/08bdfd453584e489d5a551aecbdcb77584e1b958/builtin/branch.c#L386> 7 + 8 + set -euo pipefail 9 + 10 + # TODO: it might be nice to also support main/master as higher-ranked prefix here 11 + MY_PREFIX="ian" 12 + MINE="%(if:equals=refs/heads/${MY_PREFIX})%(refname:rstrip=-3)%(then)1%(else)0%(end)" 13 + DATE='%(committerdate:unix)' # TODO maybe also consider reverse-version-sorting by branch (i.e. ticket #) 14 + 15 + TAB=$'\t' 16 + 17 + # Unclear why %(color:normal) doesn't behave the same as the RGB color here, or why 18 + # this is set to some white color at all (since normal is green in my terminal settings). 19 + # There must be some magic in git's codebase that sets RGB when terminal support is detected. 20 + NORMAL_COLOR='%(color:#F8F8F2)' 21 + 22 + HEAD_PREFIX='*%(color:green)' 23 + WORKTREE_PREFIX='+%(color:cyan)' 24 + WORKTREE="%(if)%(worktreepath)%(then)${WORKTREE_PREFIX}%(else) %(end)" 25 + PREFIX="${NORMAL_COLOR}%(if)%(HEAD)%(then)${HEAD_PREFIX}%(else)${WORKTREE}%(end)" 26 + 27 + FORMAT='%(refname:lstrip=2)%(color:reset)%(if)%(symref)%(then) -> %(symref:short)%(end)' 28 + 29 + git branch --color \ 30 + --format="${DATE}${TAB}${MINE}${TAB}${PREFIX} ${FORMAT}" | 31 + sort -r -n -k2 -k1 | # sort by $MINE, then $DATE 32 + cut -d"$TAB" -f3 | # trim off the sort keys 33 + git column
+27
.local/bin/git-clean-squashed
··· 1 + #!/usr/bin/env bash 2 + 3 + ## Clean up local branches that were squash-merged into the main branch. Ported from 4 + ## <https://github.com/not-an-aardvark/git-delete-squashed/blob/master/bin/git-delete-squashed.js> 5 + 6 + set -euo pipefail 7 + 8 + DEFAULT_BRANCH=${1:-$(git default-branch)} 9 + 10 + # Skip checked-out branches with worktreepath 11 + git for-each-ref refs/heads/ --format='%(if)%(worktreepath)%(then)%(else)%(refname:short)%(end)' | 12 + while read -r branch; do 13 + [[ -z $branch || $branch = "$DEFAULT_BRANCH" ]] && continue 14 + 15 + ancestor=$(git merge-base "$DEFAULT_BRANCH" "$branch") 16 + tree=$(git rev-parse "$branch^{tree}") 17 + 18 + commit=$(git commit-tree "$tree" -p "$ancestor" -m "squash-clean: temporary commit") 19 + set -x 20 + echo "$branch" 21 + cherry_result=$(git cherry "$DEFAULT_BRANCH" "$commit") 22 + set +x 23 + 24 + if [[ "$cherry_result" = -* ]]; then 25 + echo git branch -D "$branch" 26 + fi 27 + done
.local/share/emacs/autosave/.gitkeep

This is a binary file and will not be displayed.

.local/share/gdb/.gitkeep

This is a binary file and will not be displayed.