# Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later # ────── Borrowed and modified from CachyOS config ───────── # ╭──────────────────────────────────────────────────────────╮ # │ Provides PATH additions, bang-bang helpers, │ # │ and history/backup utilities │ # ╰──────────────────────────────────────────────────────────╯ ## Environment setup # Apply .profile: use this to put fish compatible .profile stuff in if test -f ~/.fish_profile source ~/.fish_profile end # Add ~/.local/bin to PATH if test -d ~/.local/bin if not contains -- ~/.local/bin $PATH set -p PATH ~/.local/bin end end # Add depot_tools to PATH if test -d ~/Applications/depot_tools if not contains -- ~/Applications/depot_tools $PATH set -p PATH ~/Applications/depot_tools end end ## Functions # Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang function __history_previous_command switch (commandline -t) case "!" commandline -t $history[1] commandline -f repaint case "*" commandline -i ! end end function __history_previous_command_arguments switch (commandline -t) case "!" commandline -t "" commandline -f history-token-search-backward case "*" commandline -i '$' end end if [ "$fish_key_bindings" = fish_vi_key_bindings ] bind -Minsert ! __history_previous_command bind -Minsert '$' __history_previous_command_arguments else bind ! __history_previous_command bind '$' __history_previous_command_arguments end # Fish command history function history builtin history --show-time='%F %T ' end function backup --argument filename cp $filename $filename.bak end