├── .gitignore ├── Makefile ├── README.md ├── _archive └── fish_greeting_rsc.fish ├── bin ├── 256-colors ├── freespc.sh ├── git-churn ├── git-clean-merge-tool-artifacts ├── git-fastsync ├── git-list-by-recency ├── git-mergeto ├── git-recent-files ├── git-squash-all ├── kill-all ├── pacman-latest ├── pacman-packages └── wall ├── conf.d ├── 10_auto_ls.fish ├── 10_mise.fish ├── 20_done_customization.fish ├── 20_wal_sequences.fish ├── 60_volta.fish ├── 90_shell.fish ├── 90_ssh-agent.fish ├── 90_update_abbreviations.fish └── archived │ ├── 60_pyenv.fish │ ├── 60_rbenv.fish │ └── 90_wsl_x_server.fish ├── etc ├── add_profiling.fish └── colors.fish ├── fish_plugins ├── fish_plugins.disabled ├── functions ├── fish_greeting.fish ├── fish_title.fish ├── gg.fish ├── install-fisher.fish ├── ls!.fish ├── rg.fish ├── update-abbreviations.fish ├── update-settings.fish └── windows_where.fish └── sounds ├── long-chime-sound.ogg ├── oringz-w447.ogg ├── stairs.ogg └── unsure.ogg /.gitignore: -------------------------------------------------------------------------------- 1 | fish_history 2 | fishd.* 3 | fish_read_history 4 | fish_variables 5 | /functions/* 6 | 7 | # These files are managed by fisher, so let's ignore them 8 | /conf.d/* 9 | /completions/* 10 | 11 | # Local 12 | /local/local.fish 13 | 14 | # Allow some locally-managed configuration 15 | !/conf.d/[0-9][0-9]_*.fish 16 | !/conf.d/archived 17 | 18 | # Excempted functions 19 | !/functions/update-settings.fish 20 | !/functions/ls!.fish 21 | !/functions/install-fisher.fish 22 | !/functions/gg.fish 23 | !/functions/_min*.fish 24 | !/functions/fish_greeting.fish 25 | !/functions/update-abbreviations.fish 26 | !/functions/update-abbreviations-*.fish 27 | !/functions/fish_title.fish 28 | !/functions/windows_where.fish 29 | !/functions/rg.fish 30 | 31 | # Some things like Volta insist on this file 32 | /config.fish 33 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | format: 2 | fish_indent -w conf.d/*.fish functions/*.fish 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rico's fish files 2 | ![](https://raw.githubusercontent.com/rstacruz/fishfiles/gh-pages/screenshot.png) 3 | 4 | Requires fish 2.6+. 5 | 6 | ```bash 7 | brew install fish # macOS 8 | sudo pacman -S fish # Arch Linux 9 | ``` 10 | 11 | Clone: 12 | 13 | ```bash 14 | mkdir -p ~/.config 15 | git clone https://github.com/rstacruz/fishfiles.git ~/.config/fish 16 | arsiten 17 | ``` 18 | 19 | In a new shell: 20 | 21 | ```bash 22 | install-fisher 23 | fisher update 24 | update-settings 25 | arsoeinarst 26 | ``` 27 | -------------------------------------------------------------------------------- /_archive/fish_greeting_rsc.fish: -------------------------------------------------------------------------------- 1 | function show_battery 2 | set -l hilite cyan 3 | set -l mute brblack 4 | 5 | if type -q upower; and grep -v icrosoft /proc/version >/dev/null 6 | set -l batt (upower -e /org/freedesktop/UPower/devices | grep battery | head -n 1) 7 | set -l perc (upower -i $batt | awk '/percentage:/ {print $2}') 8 | set -l state (upower -i $batt | awk '/state:/ {print $2}') 9 | if test "$state" = "discharging" 10 | set -l left (upower -i $batt | awk '/time to empty:/ {print $4, $5}') 11 | echo (set_color $hilite)" $perc"(set_color $mute)" · $left left" 12 | else if test "$state" = "fully-charged" 13 | echo (set_color $hilite)" 100%" 14 | else 15 | echo (set_color $mute)"Battery ($state): $perc" 16 | end 17 | else if type -q pmset 18 | set -l perc (pmset -g batt | grep -Eo "\d+%") 19 | set -l state (pmset -g batt | grep -Eo "\d+%; .*;" | cut -d';' -f2 | xargs) 20 | echo (set_color $mute)"Battery ($state): $perc" 21 | end 22 | 23 | set_color normal 24 | end 25 | 26 | function get_os 27 | if test -d /run/WSL 28 | echo 'Windows WSL 2' $suffix 29 | else 30 | echo (uname -r) $suffix 31 | end 32 | end 33 | 34 | function get_hostname 35 | if type -q hostname 36 | hostname 37 | else if test -f /etc/hostname 38 | cat /etc/hostname 39 | else 40 | echo 'Unknown' 41 | end 42 | end 43 | 44 | function print_env 45 | echo (set_color brblack)(get_os) '@' (get_hostname)(set_color normal) 46 | end 47 | 48 | function fish_greeting_rsc 49 | if test -n "$MIN_PROMPT" 50 | clear 51 | return 52 | end 53 | 54 | set -l hilite cyan 55 | set -l mute brblack 56 | set -l date (date "+%A, %b %e") 57 | set -l time (date "+%I:%M %p") 58 | set -l ind " " 59 | if type -q toilet 60 | echo -ne "\033[s" 61 | echo "" 62 | set_color $hilite 63 | date +" %I:%M %p " | toilet -f future --gay 64 | set ind "\033[30C" 65 | echo -ne "\033[4A" 66 | end 67 | echo "" 68 | echo -e $ind(set_color $hilite)"$date"(set_color normal) 69 | echo -e $ind(print_env) 70 | echo -e $ind(show_battery) 71 | echo "" 72 | 73 | if test -f $HOME/.motd 74 | cat $HOME/.motd 75 | echo "" 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /bin/256-colors: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # https://misc.flogisoft.com/bash/tip_colors_and_formatting 3 | 4 | # This program is free software. It comes without any warranty, to 5 | # the extent permitted by applicable law. You can redistribute it 6 | # and/or modify it under the terms of the Do What The Fuck You Want 7 | # To Public License, Version 2, as published by Sam Hocevar. See 8 | # http://sam.zoy.org/wtfpl/COPYING for more details. 9 | 10 | ( 11 | for fgbg in 38 48 ; do # Foreground / Background 12 | for color in {0..255} ; do # Colors 13 | # Display the color 14 | printf "\e[${fgbg};5;%sm %3s \e[0m" $color $color 15 | # Display 6 colors per lines 16 | if [ $((($color + 1) % 6)) == 4 ] ; then 17 | echo # New line 18 | fi 19 | done 20 | echo # New line 21 | done 22 | ) | less -R 23 | -------------------------------------------------------------------------------- /bin/freespc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo "" 3 | echo "Before:" 4 | df -h / 5 | 6 | echo "" 7 | echo "Cleaning ~/.cache..." 8 | rm -rf ~/.cache/yay 9 | rm -rf ~/.cache/yarn 10 | rm -rf ~/.cache/paru 11 | rm -rf ~/.cache/mozilla 12 | rm -rf ~/.cache/electron 13 | rm -rf ~/.cache/google-chrome 14 | rm -rf ~/.cache/chromium 15 | rm -rf ~/.cache/epiphoany 16 | rm -rf ~/.cache/thumbnails 17 | rm -rf ~/.cache/trarcker3 18 | rm -rf ~/.cache/gnome-software 19 | rm -rf ~/.cache/ms-playwright 20 | rm -rf ~/.cache/cliphist 21 | rm -rf ~/.cache/node 22 | rm -rf ~/.cache/node-gyp 23 | rm -rf ~/.cache/plasmashell 24 | 25 | echo "" 26 | echo "Running 'docker system prune':" 27 | docker system prune 28 | 29 | echo "" 30 | echo "Cleaning pacman cache:" 31 | sudo paccache -r 32 | 33 | echo "" 34 | echo "After:" 35 | df -h / 36 | -------------------------------------------------------------------------------- /bin/git-churn: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # https://github.com/garybernhardt/dotfiles/blob/main/bin/git-churn 3 | # 4 | # Written by Corey Haines 5 | # Scriptified by Gary Bernhardt 6 | # 7 | # Put this anywhere on your $PATH (~/bin is recommended). Then git will see it 8 | # and you'll be able to do `git churn`. 9 | # 10 | # Churn means "frequency of change". You'll get an output like this: 11 | # 12 | # $ git churn 13 | # 1 file1 14 | # 22 file2 15 | # 333 file3 16 | # 17 | # This means that file1 changed one time, file2 changes 22 times, and file3 18 | # changes 333 times. 19 | # 20 | # Show churn for whole repo: 21 | # $ git churn 22 | # 23 | # Show churn for specific directories: 24 | # $ git churn app lib 25 | # 26 | # Show churn for a time range: 27 | # $ git churn --since='1 month ago' 28 | # 29 | # (These are all standard arguments to `git log`.) 30 | 31 | set -e 32 | git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -n 33 | 34 | -------------------------------------------------------------------------------- /bin/git-clean-merge-tool-artifacts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | list_files() { 3 | find . \ 4 | -name '*_BACKUP_*' -or \ 5 | -name '*_BASE_*' -or \ 6 | -name '*_LOCAL_*' -or \ 7 | -name '*_REMOTE_*' -or \ 8 | -name '*.orig' 9 | } 10 | 11 | files=$(list_files) 12 | if [[ -z "$files" ]]; then 13 | echo "Nothing to do" 14 | exit 15 | fi 16 | 17 | echo "$files" 18 | echo -ne "Continue? [yn] " 19 | read answer 20 | 21 | if [[ "$answer" == "y" ]]; then 22 | list_files | xargs rm 23 | fi 24 | -------------------------------------------------------------------------------- /bin/git-fastsync: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Commits, pulls and pushes in one go. 3 | set -eou pipefail 4 | 5 | # global options 6 | interactive='' 7 | dry_run='' 8 | use_amend='' 9 | no_commit='' 10 | commit_only='' 11 | watch_mode='' 12 | edit_mode='' 13 | watch_mode_wait_time='10' 14 | debounce_action_pid='' 15 | 16 | # Progress indicator helpers 17 | check="\033[32m✓" 18 | cross="\033[31m✗" 19 | reset="\033[0m" 20 | rewind="\033[4D\033[K\r" # Cursor back, erase in line, start 21 | 22 | show_help() { 23 | echo "Usage: git-fastsync [options]" 24 | echo "Commits, pulls and pushes in one go." 25 | echo "" 26 | echo "Options:" 27 | echo " -i, --interactive Prompt for what to do" 28 | echo " -n, --dry-run Simulation mode" 29 | echo " --commit-only Don't push and pull" 30 | echo " -A, --amend Amend the last commit" 31 | echo " -w, --watch Rerun on file changes" 32 | echo " --edit Commit using editor" 33 | echo " -W, --wait-for Wait time for watch mode, implies -w" 34 | echo "" 35 | echo " -h, --help Show this help message and exit" 36 | } 37 | 38 | main() { 39 | set_options_from_argv "$@" 40 | 41 | do_fastsync 42 | 43 | if [[ "$watch_mode" == "1" ]]; then 44 | prog_info "Watching for changes with ${watch_mode_wait_time}sec delay" 45 | prog_info "Press ctrl-c to stop" 46 | monitor_for_changes | while read -r _update; do 47 | debounced_do_fastsync 48 | done 49 | fi 50 | } 51 | 52 | monitor_for_changes() { 53 | inotifywait --quiet --event modify,delete,create --monitor --recursive . --exclude "\\.git" 54 | } 55 | 56 | debounced_do_fastsync() { 57 | # Check if running already 58 | if test -n "${debounce_action_pid}" && ps -p "${debounce_action_pid}" >/dev/null; then 59 | kill "${debounce_action_pid}" 60 | fi 61 | 62 | # Wait N seconds then trigger a run 63 | ( 64 | sleep "$watch_mode_wait_time" 65 | do_fastsync 66 | ) & 67 | 68 | debounce_action_pid="${!}" 69 | } 70 | 71 | do_fastsync() { 72 | if is_merge_ongoing; then 73 | prog_err "ERR: merge is ongoing. Resolve this merge before continuing." 74 | exit 1 75 | fi 76 | 77 | if is_rebase_ongoing; then 78 | prog_err "ERR: rebase is ongoing. Resolve this rebase before continuing." 79 | exit 1 80 | fi 81 | 82 | branch="$(git rev-parse --abbrev-ref HEAD)" 83 | if [[ "$branch" == "HEAD" ]]; then 84 | prog_err "ERR: not on a branch" 85 | exit 1 86 | fi 87 | 88 | commit_if_dirty 89 | if [[ "$commit_only" == '1' ]]; then return; fi 90 | 91 | if [[ "$use_amend" == '1' ]]; then 92 | push_updates '1' 93 | else 94 | prog_start 'Pull' 95 | _git fetch 96 | local upstream 97 | upstream="$(get_upstream_reference)" 98 | 99 | if [[ -n "$upstream" ]] && has_remote_branch "$upstream"; then 100 | prog_ok 101 | pull_changes "$upstream" 102 | else 103 | prog_ok 104 | fi 105 | 106 | push_updates 107 | fi 108 | } 109 | 110 | set_options_from_argv() { 111 | while true; do 112 | case "${1:-}" in 113 | -h | --help) 114 | show_help 115 | exit 116 | ;; 117 | -w | --watch) 118 | watch_mode='1' 119 | shift 1 120 | ;; 121 | --edit) 122 | edit_mode='1' 123 | shift 1 124 | ;; 125 | -W | --wait-for) 126 | watch_mode='1' 127 | watch_mode_wait_time="$2" 128 | shift 2 129 | ;; 130 | -i | --interactive) 131 | interactive='1' 132 | shift 1 133 | ;; 134 | --commit-only) 135 | commit_only='1' 136 | shift 1 137 | ;; 138 | -A | --amend) 139 | use_amend='1' 140 | shift 1 141 | ;; 142 | -n | --dry-run) 143 | dry_run='1' 144 | shift 1 145 | ;; 146 | *) break ;; 147 | esac 148 | done 149 | } 150 | 151 | # Runs an interactive prompt 152 | interactive_prompt() { 153 | while true; do 154 | echo -ne "\033[2K\r" 155 | if [[ "$verbose" == "" ]]; then 156 | echo -ne " [Enter] sync now, [d] show diff, [?] more options: " 157 | else 158 | echo -e 'Options:' 159 | echo ' [enter] sync now' 160 | echo ' [c] commit only' 161 | echo ' [m] change message' 162 | echo ' [A] amend' 163 | echo ' [d] show diff' 164 | echo ' [q] quit' 165 | echo -n '> ' 166 | fi 167 | read -n1 input 168 | 169 | case "$input" in 170 | 'c' | '') # Continue 171 | break ;; 172 | d) # Diff 173 | verbose='1' 174 | clear 175 | git diff HEAD 176 | echo '' 177 | ;; 178 | q) # Quit 179 | exit 1 ;; 180 | A) # Amend 181 | use_amend='1' 182 | break 183 | ;; 184 | c) # Commit-only 185 | commit_only='1' 186 | break 187 | ;; 188 | '?') # Verbose 189 | verbose='1' ;; 190 | m) # Commit message 191 | echo '' 192 | echo '' 193 | echo -n 'Commit msg: ' 194 | read -r message 195 | break 196 | ;; 197 | *) ;; 198 | esac 199 | done 200 | echo '' 201 | } 202 | 203 | commit_if_dirty() { 204 | local message='' 205 | local input='' 206 | local verbose='' 207 | 208 | if [[ "$(git status -s | wc -l | xargs)" == "0" ]]; then 209 | prog_info 'No changes to commit' 210 | no_commit='1' 211 | return 212 | fi 213 | 214 | # Show status 215 | if [[ "$watch_mode" != "1" ]]; then 216 | prog_info "Local changes in $(pwd):" 217 | git status -s 218 | echo '' 219 | fi 220 | 221 | if [[ "$interactive" == '1' ]]; then 222 | message="$(get_default_message || echo 'Update')" 223 | prog_info "Commit msg: '$message'" 224 | interactive_prompt 225 | fi 226 | 227 | _git add --all . 228 | if [[ -z "$message" ]]; then 229 | message="$(get_default_message || echo 'Update')" 230 | fi 231 | 232 | if [[ "$edit_mode" == '1' ]]; then 233 | if [[ "$use_amend" == '1' ]]; then 234 | git commit --amend -v 235 | else 236 | git commit -v 237 | fi 238 | else 239 | if [[ "$use_amend" == '1' ]]; then 240 | prog_info "Amend commit: ‘${message}’" 241 | _git commit --amend -C HEAD 242 | else 243 | prog_info "Commit: ‘${message}’" 244 | _git commit -m "$message" 245 | fi 246 | fi 247 | } 248 | 249 | # Generate a default commit message 250 | get_default_message() { 251 | local message='' 252 | local count='' 253 | message="$(git status -s | head -n 1 | xargs)" 254 | count="$(git status -s | wc -l | xargs)" 255 | message="$( 256 | echo "$message" | 257 | sed 's/^M /Update /' | 258 | sed 's/^R /Rename /' | 259 | sed 's/^D /Delete /' | 260 | sed 's/^A /Add /' 261 | )" 262 | 263 | if [[ -z "$message" ]]; then return 1; fi 264 | 265 | # append count 266 | if [[ "$count" != '1' ]]; then 267 | message="$message (+$((count - 1)) more changes)" 268 | fi 269 | 270 | echo "$message" 271 | } 272 | 273 | # Pull changes 274 | pull_changes() { 275 | local upstream="$1" 276 | 277 | if ! _git rebase --quiet --autostash "$upstream"; then 278 | prog_err "Failed to pull" 279 | _git rebase --abort 280 | exit 1 281 | fi 282 | } 283 | 284 | # Push if there are any changes 285 | push_updates() { 286 | local message='' 287 | local force="${1:-}" 288 | 289 | if [[ "$dry_run" == '1' ]] || is_push_needed; then 290 | if [[ "$force" == '1' ]]; then 291 | prog_start 'Force-push' 292 | _git push --quiet --no-progress --force-with-lease 293 | message="$(git log -1 --pretty='format:%s')" 294 | prog_ok 295 | else 296 | prog_start 'Push' 297 | _git push --quiet --no-progress 298 | message="$(git log -1 --pretty='format:%s')" 299 | prog_ok 300 | fi 301 | fi 302 | } 303 | 304 | is_merge_ongoing() { 305 | test -f "$(git rev-parse --git-dir)/MERGE_HEAD" 306 | } 307 | 308 | is_rebase_ongoing() { 309 | test -f "$(git rev-parse --git-dir)/rebase-merge" 310 | } 311 | 312 | has_remote_branch() { 313 | git branch -a | grep -q "remotes/$(get_upstream_reference)" 314 | } 315 | 316 | is_push_needed() { 317 | git status --branch -s | head -n 1 | grep -q ahead 318 | } 319 | 320 | # eg, origin/main 321 | # Returns blank if not available 322 | get_upstream_reference() { 323 | git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo '' 324 | } 325 | 326 | # Runs a Git action. In dry run mode, it only prints 327 | _git() { 328 | if [[ "$dry_run" == '1' ]]; then 329 | echo -e "\n\033[32m$ git $*\033[0m" 330 | else 331 | git "$@" >/dev/null 332 | fi 333 | } 334 | 335 | prog_start() { echo -ne "${rewind}$*... "; } 336 | prog_ok() { echo -e "\033[4D ${check} ${reset}"; } 337 | prog_err() { echo -e "\n${reset}$* ${cross}${reset}"; } 338 | prog_info() { 339 | prog_start "$*" 340 | prog_ok 341 | } 342 | 343 | main "$@" 344 | -------------------------------------------------------------------------------- /bin/git-list-by-recency: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # https://stackoverflow.com/a/62303500 3 | git log --pretty="format:" --name-only 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEAD | awk NF | tac 4 | 5 | # https://stackoverflow.com/a/51762492 6 | # while read FILE; do 7 | # git log --pretty="%ad $FILE" --date=iso8601-strict -1 -- "$FILE" 8 | # done < <(git ls-files) 9 | -------------------------------------------------------------------------------- /bin/git-mergeto: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Merge the current branch into another branch 3 | # 4 | # git mergeto master 5 | 6 | branch=${1:-master} 7 | src=$(git rev-parse --abbrev-ref HEAD) 8 | 9 | echo -en "Merge $src → $branch? [yn] " 10 | read reply 11 | if [[ "$reply" == "n" ]]; then exit 1; fi 12 | 13 | git checkout "$branch" \ 14 | && git pull \ 15 | && git merge --no-ff "$src" \ 16 | && git branch -d "$src" 17 | -------------------------------------------------------------------------------- /bin/git-recent-files: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # List files that were modified `n` days ago. 3 | 4 | days=${1:-3} 5 | gitrevision="HEAD...HEAD@{${days} days ago}" 6 | 7 | git log \ 8 | --all -M -C --name-only \ 9 | --format='format:' \ 10 | "$gitrevision" \ 11 | | sort | grep -v '^$' | uniq -c \ 12 | | sort \ 13 | | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' \ 14 | | sed '1 d' \ 15 | | sort -rn \ 16 | | less -R 17 | -------------------------------------------------------------------------------- /bin/git-squash-all: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Squashes all commits ahead of a branch into one commit. 3 | # 4 | # git-squash-all main 5 | # 6 | # ...resets the current branch to what's in `main`, then brings back the files 7 | # from the current branch. This allows creating a new commit to squash all 8 | # changes down to one commit. 9 | # 10 | set -eou pipefail 11 | 12 | print_help() { 13 | echo 'Usage:' 14 | echo ' git-squash-all ' 15 | echo '' 16 | echo 'Arguments:' 17 | echo ' The commitish intended to be merged into' 18 | echo '' 19 | echo 'Options:' 20 | echo ' -c, --commit Run git-commit afterwards' 21 | echo '' 22 | echo 'Examples:' 23 | echo ' git-squash-all main' 24 | echo ' git-squash-all HEAD~4 # squash the last 3 commits' 25 | echo '' 26 | } 27 | 28 | main() { 29 | local run_commit_after='' 30 | local mainbranch='' 31 | 32 | while [[ -n "${1:-}" ]]; do 33 | case "${1:-}" in 34 | -c | --commit) 35 | run_commit_after='1' 36 | shift 37 | ;; 38 | -h | --help) 39 | print_help 40 | exit 41 | ;; 42 | *) 43 | if [[ -z "$mainbranch" ]]; then 44 | mainbranch="${1:-}" 45 | fi 46 | shift 47 | ;; 48 | esac 49 | done 50 | 51 | if [[ -z "$mainbranch" ]]; then 52 | echo "Usage: $0 " >&1 53 | exit 1 54 | fi 55 | 56 | local commit="" 57 | commit="$(git rev-parse HEAD)" 58 | if [[ -z "$commit" ]]; then 59 | echo "Error: can't find a git commit." 60 | exit 1 61 | fi 62 | 63 | if git_is_dirty; then 64 | echo "Error: local changes are found. Consider stashing them first" 65 | exit 1 66 | fi 67 | 68 | git reset --hard "$mainbranch" >/dev/null 69 | git checkout "$commit" -- . 70 | 71 | if ! git_is_dirty; then 72 | echo "No changes found :)" 73 | elif [[ -n "$run_commit_after" ]]; then 74 | exec git commit 75 | else 76 | echo "Changes on top of $mainbranch:" 77 | git status -s 78 | echo "" 79 | echo "Try commiting now :)" 80 | fi 81 | } 82 | 83 | git_is_dirty() { 84 | local count="" 85 | count="$(git status -s 2>/dev/null | wc -c)" 86 | [[ "$count" -ne 0 ]] 87 | } 88 | 89 | main "$@" 90 | -------------------------------------------------------------------------------- /bin/kill-all: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | killflags="" 4 | killcmd="kill" 5 | 6 | while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in 7 | -s | --simulate ) 8 | killcmd="echo kill" 9 | ;; 10 | -9 ) 11 | killflags="-9" 12 | ;; 13 | esac; shift; done 14 | if [[ "$1" == '--' ]]; then shift; fi 15 | 16 | ps aux | grep "$1" | grep -v grep | grep -v $$ 17 | ps aux | grep "$1" | grep -v grep | grep -v $$ | awk '{print $2}' | xargs $killcmd $killflags 18 | -------------------------------------------------------------------------------- /bin/pacman-latest: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Print last installed pacman packages 3 | cat /var/log/pacman.log \ 4 | | awk '/installed/ { print $4 }' \ 5 | | grep -E "$(pacman -Qeq | xargs | tr ' ' '|')" 6 | -------------------------------------------------------------------------------- /bin/pacman-packages: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # https://www.reddit.com/r/archlinux/comments/aldmdn/-/efddbnp 3 | comm -23 <(pacman -Qeq | sort) <(pacman -Qgq xorg base base-devel | sort) 4 | -------------------------------------------------------------------------------- /bin/wall: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Sets a wallpaper 3 | 4 | file="$1" 5 | 6 | if [[ -z "$file" ]]; then 7 | echo "Usage: $0 " 8 | exit 1 9 | fi 10 | 11 | if [[ -n "$SWAYSOCK" ]]; then 12 | # sway 13 | target="$HOME/.config/wallpaper.jpg" 14 | cp "$file" "$target" 15 | swaymsg output '*' background "$target" fill 16 | elif [[ -f ~/.fehbg ]]; then 17 | # feh on x? 18 | feh --bg-fill "$file" 19 | fi 20 | -------------------------------------------------------------------------------- /conf.d/10_auto_ls.fish: -------------------------------------------------------------------------------- 1 | function __autols_hook --description "Auto ls" --on-event fish_prompt 2 | if test "$NO_AUTO_LS" != "" 3 | return 4 | end 5 | 6 | if test "$__autols_last" != (pwd) -a -n "$__autols_last" 7 | ls! 8 | end 9 | 10 | set -g __autols_last (pwd) 11 | end 12 | -------------------------------------------------------------------------------- /conf.d/10_mise.fish: -------------------------------------------------------------------------------- 1 | begin 2 | if type -q $HOME/.local/bin/mise 3 | if status is-interactive 4 | $HOME/.local/bin/mise activate fish | source 5 | else 6 | $HOME/.local/bin/mise activate fish --shims | source 7 | end 8 | 9 | abbr mnode 'mise x -- node' 10 | abbr mnpm 'mise x -- npm' 11 | abbr mnvim 'mise x -- nvim' 12 | abbr myarn 'mise x -- yarn' 13 | abbr mpnpm 'mise x -- pnpm' 14 | abbr mbun 'mise x -- bun' 15 | abbr mruby 'mise x -- ruby' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /conf.d/20_done_customization.fish: -------------------------------------------------------------------------------- 1 | # $message ("path/ ls") 2 | # $exit_status 3 | # $wd (working dir) 4 | # $humanized_duration 5 | 6 | set __done_notification_command "rsc_done_notification \$exit_status \$title \$message" 7 | 8 | set __done_min_cmd_duration 500 9 | 10 | function rsc_done_notification 11 | set -l exit_status $argv[1] 12 | set -l title $argv[2] 13 | set -l message $argv[3] 14 | 15 | if type -q terminal-notifier # https://github.com/julienXX/terminal-notifier 16 | terminal-notifier -message "$message" -title "$title" -sender "$sender" -activate "$__done_initial_window_id" 17 | 18 | else if type -q osascript # AppleScript 19 | osascript -e "display notification \"$message\" with title \"$title\"" 20 | 21 | else if type -q notify-send # Linux notify-send 22 | set -l urgency 23 | if test $exit_status -ne 0 24 | set urgency "--urgency=critical" 25 | end 26 | notify-send $urgency --icon=terminal --app-name=fish "$title" "$message" 27 | 28 | else # anything else 29 | # echo -e "\a" # bell sound 30 | end 31 | 32 | # if test $exit_status -ne 0 33 | # rsc_fail_sound 34 | # else 35 | # rsc_done_sound 36 | # end 37 | end 38 | 39 | # function rsc_done_sound 40 | # play_sound_file "$HOME/.config/fish/sounds/stairs.ogg" 41 | # end 42 | 43 | # function rsc_fail_sound 44 | # play_sound_file "$HOME/.config/fish/sounds/unsure.ogg" 45 | # end 46 | 47 | # function play_sound_file 48 | # if type -q paplay 49 | # paplay $argv[1] ^/dev/null & disown 50 | # else if type -q afplay 51 | # afplay $argv[1] ^/dev/null & disown 52 | # end 53 | # end 54 | -------------------------------------------------------------------------------- /conf.d/20_wal_sequences.fish: -------------------------------------------------------------------------------- 1 | # https://github.com/dylanaraps/pywal/wiki/Getting-Started#applying-the-theme-to-new-terminals 2 | function use_wal 3 | test -e ~/.cache/wal/sequences # Has to exist 4 | and test -z "$DISABLE_WAL" # Not be disabled 5 | and test -z "$SSH_TTY" # Not via ssh 6 | and test "$TERM_PROGRAM" != vscode 7 | and test "$TERM" = foot 8 | end 9 | 10 | function load_wal 11 | if use_wal 12 | cat ~/.cache/wal/sequences & 13 | end 14 | end 15 | 16 | # Use `pkill -USR1 -f load_wal` to reload the theme, 17 | # or pywal with `wal -e --theme github -l` 18 | trap load_wal SIGUSR1 19 | load_wal 20 | -------------------------------------------------------------------------------- /conf.d/60_volta.fish: -------------------------------------------------------------------------------- 1 | # Integration for Volta (https://volta.sh/) 2 | # After installing Volta, you'll then be able to use 3 | # Volta with this 4 | 5 | begin 6 | if test -d "$HOME/.volta" 7 | set -gx VOLTA_HOME "$HOME/.volta" 8 | set -gx VOLTA_FEATURE_PNPM 1 9 | string match -r ".volta" "$PATH" >/dev/null; or set -gx PATH "$VOLTA_HOME/bin" $PATH 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /conf.d/90_shell.fish: -------------------------------------------------------------------------------- 1 | if test $SHELL = sh 2 | # Not sure why this happens in ArchWSL but here we go 3 | set -gx SHELL (which fish) 4 | end 5 | -------------------------------------------------------------------------------- /conf.d/90_ssh-agent.fish: -------------------------------------------------------------------------------- 1 | if set -q XDG_RUNTIME_DIR 2 | if ! pgrep -u "$USER" ssh-agent >/dev/null 3 | ssh-agent -c >"$XDG_RUNTIME_DIR/ssh-agent.env.fish" 4 | end 5 | 6 | if test -z "$SSH_AUTH_SOCK" 7 | if test -f "$XDG_RUNTIME_DIR/ssh-agent.env.fish" 8 | eval (cat "$XDG_RUNTIME_DIR/ssh-agent.env.fish") >/dev/null 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /conf.d/90_update_abbreviations.fish: -------------------------------------------------------------------------------- 1 | update-abbreviations & 2 | -------------------------------------------------------------------------------- /conf.d/archived/60_pyenv.fish: -------------------------------------------------------------------------------- 1 | if type -q pyenv 2 | status --is-interactive; and source (pyenv init -|psub) 3 | end 4 | -------------------------------------------------------------------------------- /conf.d/archived/60_rbenv.fish: -------------------------------------------------------------------------------- 1 | if ! status --is-interactive 2 | exit 3 | end 4 | 5 | if ! type -q rbenv 6 | exit 7 | end 8 | 9 | # Run 'rbenv init', but skip rehash, its pretty slow. 10 | # source (rbenv init - | sed 's/command rbenv rehash/#&/' | psub) 11 | 12 | # Even cheaper 13 | set -gx PATH "$HOME/.rbenv/shims" $PATH 14 | set -gx RBENV_SHELL fish 15 | 16 | function rbenv 17 | set command $argv[1] 18 | set -e argv[1] 19 | 20 | switch "$command" 21 | case rehash shell 22 | source (rbenv "sh-$command" $argv|psub) 23 | case '*' 24 | command rbenv "$command" $argv 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /conf.d/archived/90_wsl_x_server.fish: -------------------------------------------------------------------------------- 1 | if test -f /mnt/c/Windows/explorer.exe 2 | if ! set -q DISPLAY 3 | export DISPLAY=:0 4 | export LIBGL_ALWAYS_INDIRECT=1 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /etc/add_profiling.fish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env fish 2 | # Add timestamp printing 3 | 4 | function main -a cmd 5 | if test "$cmd" = "go" 6 | disable 7 | enable 8 | fish -i -c 'if test -n "$lastts"; echo ""(math ('(datecmd)') - $lastts)ms; end' 9 | disable 10 | else if test "$cmd" = "on" 11 | disable 12 | enable 13 | echo "Enabled. ✓ Use '"(status filename)" off' to disable." 14 | else if test "$cmd" = "off" 15 | disable 16 | echo "Disabled ✓" 17 | else 18 | echo "Usage: "(status filename)" {on|off}" 19 | end 20 | end 21 | 22 | function datecmd 23 | if type -q gdate 24 | echo "gdate +'%s%3N'" 25 | else 26 | echo "date +'%s%3N'" 27 | end 28 | end 29 | 30 | 31 | function enable 32 | cd $HOME/.config/fish/conf.d 33 | for fn in *.fish 34 | echo '# for profiling' > $fn.tmp 35 | echo 'if test -n "$lastts"; echo ""(math ('(datecmd)') - $lastts)ms; end # for profiling' >> $fn.tmp 36 | echo 'printf "%-30s" (basename (status -f)) # for profiling' >> $fn.tmp 37 | echo 'set lastts ('(datecmd)') # for profiling' >> $fn.tmp 38 | cat $fn >> $fn.tmp 39 | mv $fn.tmp $fn 40 | end 41 | end 42 | 43 | function disable 44 | cd $HOME/.config/fish/conf.d 45 | for fn in *.fish 46 | grep -v "# for profiling" $fn > $fn.tmp 47 | mv $fn.tmp $fn 48 | end 49 | end 50 | 51 | 52 | main "$argv[1]" 53 | -------------------------------------------------------------------------------- /etc/colors.fish: -------------------------------------------------------------------------------- 1 | set -U fish_color_error red '--italic' 2 | set -U fish_color_escape 'yellow' 3 | set -U fish_color_operator 'yellow' 4 | set -U fish_color_param 'brcyan' 5 | set -U fish_color_quote 'brblue' 6 | set -U fish_color_redirection 'yellow' 7 | set -U fish_color_status 'brcyan' 8 | set -U fish_color_autosuggestion 'brblack' 9 | set -U fish_color_end 'brcyan' 10 | set -U fish_color_user 'brcyan' 11 | set -U fish_color_command '--bold' 12 | set -U fish_color_comment 'brcyan' 13 | -------------------------------------------------------------------------------- /fish_plugins: -------------------------------------------------------------------------------- 1 | jorgebucaran/fisher 2 | rstacruz/fish-npm-global 3 | jethrokuan/z 4 | patrickf1/fzf.fish 5 | joseluisq/gitnow 6 | nickeb96/puffer-fish 7 | ilancosman/tide@v6 8 | -------------------------------------------------------------------------------- /fish_plugins.disabled: -------------------------------------------------------------------------------- 1 | acomagu/fish-async-prompt 2 | rstacruz/fish-theme-r20 3 | -------------------------------------------------------------------------------- /functions/fish_greeting.fish: -------------------------------------------------------------------------------- 1 | function fish_greeting 2 | #fish_greeting_time 3 | end 4 | 5 | function fish_greeting_time 6 | set -l date1 (date "+%a") 7 | set -l date2 (date "+%b %e") 8 | set -l time (date "+%I:%M %p") 9 | set -l cdir (basename (pwd)) 10 | set -l msg '' 11 | 12 | if ! test -z $VIMRUNTIME 13 | set msg ' (vim)' 14 | end 15 | 16 | # echo -ne '\033K\r' 17 | echo -ne '\n' 18 | echo -e (set_color brblack)'╭─────────┄┌─────╮' 19 | echo -e (set_color brblack)'│ '(set_color blue)$time(set_color brblack)' │ '(set_color green)$date1(set_color brblack)' │ '(set_color reset)$date2(set_color blue)$msg(set_color reset) 20 | echo -e (set_color brblack)'╰──────────┘┄────╯' 21 | # echo -e (set_color brblack)'┌────────────┐───────┬──────────┐' 22 | # echo -e (set_color brblack)'│ '(set_color blue)$time(set_color brblack)' │ '(set_color reset)$date1(set_color brblack)' │ '(set_color reset)$date2(set_color brblack)' │ '(set_color blue)$msg(set_color reset) 23 | # echo -e (set_color brblack)'└────────────└───────┘──────────┘' 24 | end 25 | -------------------------------------------------------------------------------- /functions/fish_title.fish: -------------------------------------------------------------------------------- 1 | # https://superuser.com/questions/83626/how-do-i-set-the-title-of-terminal-app-with-the-fish-shell#639763 2 | function fish_title 3 | if [ $_ = fish ] 4 | # echo (prompt_pwd) 5 | echo (basename (pwd)) 6 | else 7 | echo (basename (pwd)) › $_ 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /functions/gg.fish: -------------------------------------------------------------------------------- 1 | function gg -d "Search via ripgrep/git grep" 2 | if type -q rg 3 | rg -p $argv | less -R 4 | else if type -q ag 5 | ag --pager 'less -R' $argv 6 | else 7 | git grep $argv 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /functions/install-fisher.fish: -------------------------------------------------------------------------------- 1 | function install-fisher 2 | cd $HOME/.config/fish 3 | # https://github.com/jorgebucaran/fisher 4 | curl -sL https://git.io/fisher | source 5 | and fisher install jorgebucaran/fisher 6 | and git checkout fish_plugins 7 | and fisher update 8 | and fish -c update-settings 9 | and exec fish 10 | end 11 | -------------------------------------------------------------------------------- /functions/ls!.fish: -------------------------------------------------------------------------------- 1 | function ls! --description "Auto notes" # --on-event fish_prompt 2 | if type -q exa 3 | exa --icons --group-directories-first $argv 4 | else 5 | ls $argv 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /functions/rg.fish: -------------------------------------------------------------------------------- 1 | # Via https://github.com/BurntSushi/ripgrep/issues/86#issuecomment-386998224 2 | function rg 3 | if isatty stdout 4 | command rg -p $argv | less -RMFXK 5 | else 6 | command rg $argv 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /functions/update-abbreviations.fish: -------------------------------------------------------------------------------- 1 | function update-abbreviations 2 | if type -q flatpak 3 | abbr fp flatpak 4 | abbr fps "flatpak search" 5 | abbr fpi "flatpak install" 6 | end 7 | 8 | if type -q helix 9 | abbr hx helix 10 | end 11 | 12 | if type -q bun 13 | abbr brun "bun run" # br is taken by broot 14 | end 15 | 16 | if type -q aichat 17 | abbr ac aichat 18 | abbr ar 'aichat -r' # Select a role (`ar reword`) 19 | end 20 | 21 | if type -q nerdctl 22 | abbr nd nerdctl 23 | abbr ndc nerdctl compose 24 | end 25 | 26 | if type -q deno 27 | abbr dt 'deno task' 28 | abbr dr 'deno run -A' 29 | end 30 | 31 | if type -q hyprctl 32 | abbr hyp hyprctl 33 | abbr hypd hyprctl dispatch 34 | end 35 | 36 | if type -q git 37 | # echo "✓ git (g, ad, com, cout, ...)" 38 | abbr g git 39 | 40 | # Most common commands 41 | abbr ad 'git add --all .; git status -s' 42 | abbr st 'git status' 43 | abbr co 'git checkout' 44 | abbr cob 'git checkout -b' 45 | abbr com 'git commit -v' 46 | abbr dif 'git diff' 47 | abbr dic 'git diff --cached' 48 | 49 | # abbr push 'git push' 50 | # abbr pull 'git pull' 51 | abbr PUSH 'git push --set-upstream origin (git rev-parse --abbrev-ref HEAD) --force-with-lease' 52 | abbr PULL 'git fetch; and git reset --hard origin/(git rev-parse --abbrev-ref HEAD)' 53 | abbr pur 'git pull --rebase' 54 | 55 | # A little less common 56 | abbr amend 'git commit --amend -v' 57 | abbr fetch 'git fetch' 58 | abbr merge 'git fetch && git merge' 59 | abbr rebase 'git rebase' 60 | abbr stash 'git stash' 61 | 62 | # Macros 63 | abbr gcd 'cd (git rev-parse --show-toplevel)' 64 | # abbr g, 'git status -s | grep -E "^[DRAM]"; git commit -m (read -p \'echo "Commit: "\')' 65 | # abbr g. 'git add --all .; and git commit -m Update' 66 | 67 | # fastsync 68 | abbr gf 'git fastsync' 69 | abbr g. 'git fastsync --edit' 70 | abbr g, 'git fastsync --edit' 71 | end 72 | 73 | if type -q aria2c 74 | # echo "✓ Aria2 (aria5, aria16)" 75 | abbr aria5 "aria2c -x5 -k1M (read)" 76 | 77 | # Split mode (extra aggressive) 78 | abbr aria16 "aria2c -x16 -j16 -s16 -k1M (read)" 79 | end 80 | 81 | if type -q docker-compose 82 | # echo "✓ Docker (dc)" 83 | abbr dc docker-compose 84 | end 85 | 86 | if type -q systemctl 87 | # echo "✓ systemctl (sys)" 88 | abbr sys 'sudo systemctl' 89 | end 90 | 91 | if type -q pacman 92 | # echo "✓ pacman (syu, rns)" 93 | abbr syu 'sudo pacman -Sy --needed --noconfirm archlinux-keyring && sudo pacman -Su' 94 | abbr rns 'sudo pacman -Rns' 95 | # abbr pacman-packages "pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S" 96 | end 97 | 98 | if type -q tig 99 | # echo "✓ tig (tigs)" 100 | abbr tigs 'tig status' 101 | end 102 | 103 | if type -q lazygit 104 | # echo "✓ lazygit (lg, s)" 105 | abbr s lazygit 106 | abbr ad 'git add --all .; lazygit status' 107 | end 108 | 109 | if type -q exa 110 | # echo "✓ exa (l, ls, lah, lah)" 111 | abbr l 'ls!' 112 | abbr ls 'ls!' 113 | abbr la 'ls! -la' 114 | abbr lah 'ls! -lah' 115 | abbr lat 'ls! --tree --color=always | less -RFX' 116 | end 117 | 118 | if type -q npm 119 | abbr nr 'npm run' 120 | abbr nx 'npm exec' 121 | abbr pn pnpm 122 | end 123 | 124 | if type -q yarn 125 | # echo "✓ yarn (y, yt, yd, yb)" 126 | abbr y yarn 127 | abbr yt 'yarn test' 128 | abbr yd 'yarn dev' 129 | abbr yb 'yarn build' 130 | abbr yui 'yarn upgrade-interactive --latest' 131 | end 132 | 133 | if type -q swaymsg 134 | # echo "✓ Sway" 135 | abbr so sway-outputs 136 | abbr sm swaymsg 137 | end 138 | 139 | if type -q ruby 140 | abbr be 'bundle exec' 141 | if type -q nodemon 142 | abbr arspec 'nodemon -e rb,haml,slim,erb -x bin/rspec -- --fail-fast --order defined' # auto-rspec for Rails apps 143 | else if type -q watchexec 144 | abbr arspec 'watchexec -e rb,haml,slim,erb -- bin/rspec --fail-fast --order defined' # auto-rspec for Rails apps 145 | end 146 | end 147 | 148 | if type -q yay 149 | # echo "✓ yay (yas)" 150 | abbr yas 'yay -S --needed' 151 | abbr yar 'yay -Rns' 152 | end 153 | 154 | if type -q pkg # Termux 155 | abbr yas 'pkg search' 156 | abbr yay 'pkg install' 157 | end 158 | 159 | if type -q brew # Homebrew 160 | abbr yas 'brew install' 161 | abbr yay 'brew search' 162 | abbr yar 'brew uninstall' 163 | end 164 | 165 | if type -q tmux 166 | # echo "✓ tmux (ta)" 167 | abbr ta 'tmux new -A -s' 168 | end 169 | 170 | if type -q rg 171 | # echo "✓ ripgrep (gg)" 172 | abbr gg rg 173 | end 174 | 175 | if type -q gh 176 | # echo "✓ gh (pr, issue, run)" 177 | abbr issue 'gh issue' 178 | abbr issues 'gh issue list' 179 | abbr run 'gh run' 180 | abbr runs 'gh run list' 181 | abbr pr 'gh pr' 182 | # abbr prs 'gh pr list' 183 | abbr prc 'gh pr checkout' 184 | abbr prv 'gh pr view --web' 185 | abbr prw 'gh pr create --web' 186 | end 187 | 188 | if type -q dconf 189 | abbr dark-mode "gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'" 190 | abbr light-mode "gsettings set org.gnome.desktop.interface color-scheme 'default'" 191 | end 192 | 193 | if test -n "$VSCODE_INJECTION" 194 | abbr e 'code (git rev-parse --show-toplevel)' 195 | else if type -q nvim 196 | # echo "✓ Neovim" 197 | abbr e nvim 198 | abbr E "nvim +\"lua require('persistence').load()\"" 199 | # ^ resume session 200 | end 201 | 202 | # These are great when using `appendWindowsPath = false` in WSL. It makes 203 | # common utilities available even if windows PATH appending is turned off 204 | if test -f /mnt/c/Windows/System32/where.exe 205 | if test -f /mnt/c/Windows/explorer.exe 206 | # echo "✓ Windows (explorer)" 207 | abbr explorer /mnt/c/Windows/explorer.exe 208 | abbr cmd /mnt/c/Windows/System32/cmd.exe 209 | abbr pwsh /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe 210 | abbr wsl /mnt/c/Windows/System32/wsl.exe 211 | end 212 | 213 | set winget_path (windows_where winget) 214 | if test -n "$winget_path" 215 | # echo "✓ Windows: winget.exe (winget, wg, ws, wi, wu, wx)" 216 | abbr winget $winget_path 217 | abbr wg $winget_path 218 | abbr ws "$winget_path search" 219 | abbr wi "$winget_path install -e --id" 220 | abbr wu "$winget_path upgrade" 221 | abbr wx "$winget_path uninstall -e --id" 222 | end 223 | 224 | set win_code_path (windows_where code) 225 | if test -n "$win_code_path" 226 | # echo "✓ Windows: VSCode (code)" 227 | abbr code "$win_code_path" 228 | end 229 | 230 | set win_git_path (windows_where git) 231 | if test -n "$win_git_path" 232 | # echo "✓ Windows: Git (wingit)" 233 | abbr wingit "$win_git_path" 234 | end 235 | end 236 | 237 | if test -e ~/Documents/Vaults/Notes 238 | abbr N 'cd ~/Documents/Vaults/Notes && nvim' 239 | end 240 | 241 | if test -e ~/Documents/Vaults/Extranotes 242 | abbr X 'cd ~/Documents/Vaults/Extranotes && nvim' 243 | end 244 | 245 | update-abbreviations-clipboard 246 | update-abbreviations-utils 247 | end 248 | 249 | function update-abbreviations-clipboard 250 | if type -q pbcopy # MacOS 251 | abbr copy pbcopy 252 | abbr paste pbpaste 253 | else if type -q termux-clipboard-set # Termux 254 | abbr copy termux-clipboard-set 255 | abbr paste termux-clipboard-get 256 | else if test -n "$WAYLAND_DISPLAY" && type -q wl-paste # Wayland 257 | abbr copy wl-copy 258 | abbr paste wl-paste 259 | else if type -q Powershell.exe 260 | abbr copy "Powershell.exe Set-Clipboard" 261 | abbr paste "Powershell.exe Get-Clipboard" 262 | else if test -n "$DISPLAY" 263 | if type -q xsel 264 | abbr copy xsel -b 265 | abbr paste xsel -b 266 | else if type -q xclip 267 | abbr copy xclip 268 | abbr paste xclip -o 269 | end 270 | end 271 | end 272 | 273 | function update-abbreviations-utils 274 | # echo "✓ fish (1, 2, :q, :cq)" 275 | # push/pop 276 | abbr 1 prevd 277 | abbr 2 nextd 278 | 279 | # exit 280 | abbr :q exit 281 | abbr :cq exit 282 | 283 | abbr j z 284 | abbr , z 285 | end 286 | -------------------------------------------------------------------------------- /functions/update-settings.fish: -------------------------------------------------------------------------------- 1 | function update-settings --description "Update environment variables and more" 2 | update-abbreviations 3 | update-bin-paths 4 | update-editor 5 | update-ls-colors 6 | update-other-settings 7 | end 8 | 9 | function update-bin-paths --description "Update PATH variable" 10 | if test -d $HOME/.config/fish/bin 11 | fish_add_path --universal $HOME/.config/fish/bin 12 | end 13 | if test -d $HOME/bin 14 | fish_add_path --universal $HOME/bin 15 | end 16 | if test -d $HOME/go/bin 17 | fish_add_path --universal $HOME/go/bin 18 | end 19 | if test -d $HOME/Library/Python/3.8/bin 20 | fish_add_path --universal $HOME/Library/Python/3.8/bin 21 | end 22 | if test -d /opt/homebrew/bin 23 | fish_add_path --universal /opt/homebrew/bin 24 | end 25 | if test -d /opt/homebrew/sbin 26 | fish_add_path --universal /opt/homebrew/sbin 27 | end 28 | if test -d /mnt/c/Windows; and test -d $HOME/bin/wsl 29 | fish_add_path --universal $HOME/bin/wsl 30 | end 31 | if test -d $HOME/.cargo/bin # rust 32 | fish_add_path --universal $HOME/.cargo/bin 33 | end 34 | if test -d $HOME/.local/bin # pip 35 | fish_add_path --universal $HOME/.local/bin 36 | end 37 | end 38 | 39 | function update-editor --description "Update EDITOR variable" 40 | if type -q nvim 41 | set --universal --export EDITOR nvim 42 | else if type -q vim 43 | set --universal --export EDITOR vim 44 | end 45 | end 46 | 47 | function update-ls-colors --description "Update LS_COLORS variable" 48 | # Update LS_COLORS in WSL to prevent unreadable directories 49 | # https://github.com/Microsoft/vscode/issues/7556 50 | if test -f /mnt/c/Windows/explorer.exe 51 | set --universal --export LS_COLORS 'ow=01;36;40' 52 | end 53 | end 54 | 55 | function update-other-settings 56 | set --universal tide_character_icon "›" 57 | end 58 | -------------------------------------------------------------------------------- /functions/windows_where.fish: -------------------------------------------------------------------------------- 1 | function windows_where --description "where.exe in WSL" 2 | /mnt/c/Windows/System32/where.exe $argv[1] | 3 | tr -d '\015' | # dos2unix 4 | head -n 1 | 5 | string replace --all '\\' / | 6 | string replace 'C:' /mnt/c 7 | end 8 | -------------------------------------------------------------------------------- /sounds/long-chime-sound.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/fishfiles/d0daf826176fcca6bad26da75ab4219c43502e83/sounds/long-chime-sound.ogg -------------------------------------------------------------------------------- /sounds/oringz-w447.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/fishfiles/d0daf826176fcca6bad26da75ab4219c43502e83/sounds/oringz-w447.ogg -------------------------------------------------------------------------------- /sounds/stairs.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/fishfiles/d0daf826176fcca6bad26da75ab4219c43502e83/sounds/stairs.ogg -------------------------------------------------------------------------------- /sounds/unsure.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/fishfiles/d0daf826176fcca6bad26da75ab4219c43502e83/sounds/unsure.ogg --------------------------------------------------------------------------------