vitorpy's Dotfiles

Migrate to chezmoi: add fish and ghostty configs

+1418
+184
private_dot_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 install devDependencies" "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 "link" -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
+7
private_dot_config/fish/completions/fisher.fish
··· 1 + complete --command fisher --exclusive --long help --description "Print help" 2 + complete --command fisher --exclusive --long version --description "Print version" 3 + complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" 4 + complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" 5 + complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" 6 + complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" 7 + complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"
+8
private_dot_config/fish/completions/fzf_configure_bindings.fish
··· 1 + complete fzf_configure_bindings --no-files 2 + complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h" 3 + complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory" 4 + complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log" 5 + complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status" 6 + complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history" 7 + complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes" 8 + complete fzf_configure_bindings --long variables --description "Change the key binding for Search Variables" --condition "not __fish_seen_argument --variables"
+28
private_dot_config/fish/conf.d/fzf.fish
··· 1 + # fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup 2 + if not status is-interactive && test "$CI" != true 3 + exit 4 + end 5 + 6 + # Because of scoping rules, to capture the shell variables exactly as they are, we must read 7 + # them before even executing _fzf_search_variables. We use psub to store the 8 + # variables' info in temporary files and pass in the filenames as arguments. 9 + # This variable is global so that it can be referenced by fzf_configure_bindings and in tests 10 + set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' 11 + 12 + 13 + # Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings 14 + fzf_configure_bindings 15 + 16 + # Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased 17 + function _fzf_uninstall --on-event fzf_uninstall 18 + _fzf_uninstall_bindings 19 + 20 + set --erase _fzf_search_vars_command 21 + functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings 22 + complete --erase fzf_configure_bindings 23 + 24 + set_color cyan 25 + echo "fzf.fish uninstalled." 26 + echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." 27 + set_color normal 28 + end
+28
private_dot_config/fish/conf.d/nvm.fish
··· 1 + set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist 2 + set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share 3 + set --global nvm_data $XDG_DATA_HOME/nvm 4 + 5 + function _nvm_install --on-event nvm_install 6 + test ! -d $nvm_data && command mkdir -p $nvm_data 7 + echo "Downloading the Node distribution index..." 2>/dev/null 8 + _nvm_index_update 9 + end 10 + 11 + function _nvm_update --on-event nvm_update 12 + set --query --universal nvm_data && set --erase --universal nvm_data 13 + set --query --universal nvm_mirror && set --erase --universal nvm_mirror 14 + set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist 15 + end 16 + 17 + function _nvm_uninstall --on-event nvm_uninstall 18 + command rm -rf $nvm_data 19 + 20 + set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version 21 + 22 + set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source 23 + functions --erase (functions --all | string match --entire --regex -- "^_nvm_") 24 + end 25 + 26 + if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version 27 + nvm use --silent $nvm_default_version 28 + end
+7
private_dot_config/fish/conf.d/omf.fish
··· 1 + # Path to Oh My Fish install. 2 + set -q XDG_DATA_HOME 3 + and set -gx OMF_PATH "$XDG_DATA_HOME/omf" 4 + or set -gx OMF_PATH "$HOME/.local/share/omf" 5 + 6 + # Load Oh My Fish configuration. 7 + source $OMF_PATH/init.fish
+4
private_dot_config/fish/conf.d/virtualfish-loader.fish
··· 1 + set -g VIRTUALFISH_VERSION 2.5.8 2 + set -g VIRTUALFISH_PYTHON_EXEC /usr/bin/python 3 + source /home/vitorpy/.local/lib/python3.12/site-packages/virtualfish/virtual.fish 4 + emit virtualfish_did_setup_plugins
+51
private_dot_config/fish/config.fish
··· 1 + /home/linuxbrew/.linuxbrew/bin/brew shellenv | source 2 + 3 + fish_add_path /home/vitorpy/.local/bin 4 + 5 + set NODE_OPTIONS --max-old-space-size=8192 6 + 7 + # Created by `pipx` on 2024-04-12 12:49:16 8 + set PATH $PATH /home/vitorpy/.local/bin 9 + set OMAKUB_PATH /home/vitorpy/.local/share/omakub 10 + 11 + # bun 12 + set BUN_INSTALL "$HOME/.bun" 13 + set PATH $BUN_INSTALL/bin $PATH 14 + 15 + # Android SDK 16 + set PATH $PATH /home/vitorpy/Android/Sdk/platform-tools 17 + set PATH $PATH /home/vitorpy/android-studio/bin 18 + 19 + # ANTHROPIC_API_KEY should be set via environment or secure method 20 + 21 + if status is-interactive 22 + set fish_greeting 23 + set EDITOR nvim 24 + set GTK_THEME "Yaru:dark" 25 + set HOMEBREW_NO_ENV_HINTS 26 + set QT_QPA_PLATFORMTHEME gnome 27 + set QT_STYLE_OVERRIDE Adwaita-Dark 28 + set MOZ_ENABLE_WAYLAND 0 29 + 30 + # Commands to run in interactive sessions can go here 31 + starship init fish | source 32 + direnv hook fish | source 33 + end 34 + 35 + export NARGO_HOME="/home/vitorpy/.nargo" 36 + 37 + # NVM Setup 38 + set -x NVM_DIR ~/.nvm 39 + 40 + # Load nvm automatically if it exists 41 + if test -e ~/.nvm/nvm.sh 42 + load_nvm 43 + end 44 + 45 + # pnpm 46 + set -gx PNPM_HOME "/home/vitorpy/.local/share/pnpm" 47 + if not string match -q -- $PNPM_HOME $PATH 48 + set -gx PATH "$PNPM_HOME" $PATH 49 + end 50 + # pnpm end 51 +
+21
private_dot_config/fish/config.fish.backup
··· 1 + /home/linuxbrew/.linuxbrew/bin/brew shellenv | source 2 + 3 + fish_add_path /home/vpb/.local/bin 4 + 5 + if status is-interactive 6 + set fish_greeting 7 + set EDITOR nvim 8 + 9 + # Commands to run in interactive sessions can go here 10 + starship init fish | source 11 + direnv hook fish | source 12 + nvm use latest 13 + end 14 + 15 + 16 + # Created by `pipx` on 2024-04-12 12:49:16 17 + set PATH $PATH /home/vitorpy/.local/bin 18 + 19 + # bun 20 + set --export BUN_INSTALL "$HOME/.bun" 21 + set --export PATH $BUN_INSTALL/bin $PATH
+4
private_dot_config/fish/fish_plugins
··· 1 + jorgebucaran/fisher 2 + edc/bass 3 + jorgebucaran/nvm.fish 4 + patrickf1/fzf.fish
+39
private_dot_config/fish/fish_variables
··· 1 + # This file contains fish universal variable definitions. 2 + # VERSION: 3.0 3 + SETUVAR --export PYENV_ROOT:/home/vitorpy/\x2epyenv 4 + SETUVAR __fish_initialized:3800 5 + SETUVAR _fisher_edc_2F_bass_files:\x7e/\x2econfig/fish/functions/__bass\x2epy\x1e\x7e/\x2econfig/fish/functions/bass\x2efish 6 + SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish 7 + SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:\x7e/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_list\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e\x7e/\x2econfig/fish/functions/nvm\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e\x7e/\x2econfig/fish/completions/nvm\x2efish 8 + SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish 9 + SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eedc/bass\x1ejorgebucaran/nvm\x2efish\x1epatrickf1/fzf\x2efish 10 + SETUVAR _fisher_upgraded_to_4_4:\x1d 11 + SETUVAR fish_color_autosuggestion:555\x1ebrblack 12 + SETUVAR fish_color_cancel:\x2dr 13 + SETUVAR fish_color_command:blue 14 + SETUVAR fish_color_comment:red 15 + SETUVAR fish_color_cwd:green 16 + SETUVAR fish_color_cwd_root:red 17 + SETUVAR fish_color_end:green 18 + SETUVAR fish_color_error:brred 19 + SETUVAR fish_color_escape:brcyan 20 + SETUVAR fish_color_history_current:\x2d\x2dbold 21 + SETUVAR fish_color_host:normal 22 + SETUVAR fish_color_host_remote:yellow 23 + SETUVAR fish_color_normal:normal 24 + SETUVAR fish_color_operator:brcyan 25 + SETUVAR fish_color_param:cyan 26 + SETUVAR fish_color_quote:yellow 27 + SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold 28 + SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack 29 + SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack 30 + SETUVAR fish_color_status:red 31 + SETUVAR fish_color_user:brgreen 32 + SETUVAR fish_color_valid_path:\x2d\x2dunderline 33 + SETUVAR fish_key_bindings:fish_default_key_bindings 34 + SETUVAR fish_pager_color_completion:normal 35 + SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di 36 + SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline 37 + SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan 38 + SETUVAR fish_pager_color_selected_background:\x2dr 39 + SETUVAR fish_user_paths:/home/vitorpy/\x2elocal/bin\x1e/home/vitorpy/\x2ejuliaup/bin\x1e/home/vitorpy/\x2epyenv/bin\x1e/home/vitorpy/\x2eavm/bin\x1e/home/vitorpy/\x2elocal/share/solana/install/active_release/bin\x1e/home/vitorpy/\x2ecargo/bin\x1e/home/vpb/\x2elocal/bin\x1e/home/vpb/\x2ervm/bin\x1e/home/vpb/\x2epyenv/bin\x1e/home/vpb/\x2efoundry/bin\x1e/home/vpb/\x2ecargo/bin\x1e/home/vpb/\x2elocal/share/solana/install/active_release/bin\x1e/home/vpb/\x2econfig/\x2efoundry/bin
+140
private_dot_config/fish/functions/__bass.py
··· 1 + """ 2 + To be used with a companion fish function like this: 3 + 4 + function refish 5 + set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x 6 + end 7 + 8 + """ 9 + 10 + from __future__ import print_function 11 + 12 + import json 13 + import os 14 + import signal 15 + import subprocess 16 + import sys 17 + import traceback 18 + 19 + 20 + BASH = 'bash' 21 + 22 + FISH_READONLY = [ 23 + 'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version', 24 + 'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode' 25 + ] 26 + 27 + IGNORED = [ 28 + 'PS1', 'XPC_SERVICE_NAME' 29 + ] 30 + 31 + def ignored(name): 32 + if name == 'PWD': # this is read only, but has special handling 33 + return False 34 + # ignore other read only variables 35 + if name in FISH_READONLY: 36 + return True 37 + if name in IGNORED or name.startswith("BASH_FUNC"): 38 + return True 39 + if name.startswith('%'): 40 + return True 41 + return False 42 + 43 + def escape(string): 44 + # use json.dumps to reliably escape quotes and backslashes 45 + return json.dumps(string).replace(r'$', r'\$') 46 + 47 + def escape_identifier(word): 48 + return escape(word.replace('?', '\\?')) 49 + 50 + def comment(string): 51 + return '\n'.join(['# ' + line for line in string.split('\n')]) 52 + 53 + def gen_script(): 54 + # Use the following instead of /usr/bin/env to read environment so we can 55 + # deal with multi-line environment variables (and other odd cases). 56 + env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable) 57 + args = [BASH, '-c', env_reader] 58 + output = subprocess.check_output(args, universal_newlines=True) 59 + old_env = output.strip() 60 + 61 + pipe_r, pipe_w = os.pipe() 62 + if sys.version_info >= (3, 4): 63 + os.set_inheritable(pipe_w, True) 64 + command = 'eval $1 && ({}; alias) >&{}'.format( 65 + env_reader, 66 + pipe_w 67 + ) 68 + args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])] 69 + p = subprocess.Popen(args, universal_newlines=True, close_fds=False) 70 + os.close(pipe_w) 71 + with os.fdopen(pipe_r) as f: 72 + new_env = f.readline() 73 + alias_str = f.read() 74 + if p.wait() != 0: 75 + raise subprocess.CalledProcessError( 76 + returncode=p.returncode, 77 + cmd=' '.join(sys.argv[1:]), 78 + output=new_env + alias_str 79 + ) 80 + new_env = new_env.strip() 81 + 82 + old_env = json.loads(old_env) 83 + new_env = json.loads(new_env) 84 + 85 + script_lines = [] 86 + 87 + for k, v in new_env.items(): 88 + if ignored(k): 89 + continue 90 + v1 = old_env.get(k) 91 + if not v1: 92 + script_lines.append(comment('adding %s=%s' % (k, v))) 93 + elif v1 != v: 94 + script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v))) 95 + # process special variables 96 + if k == 'PWD': 97 + script_lines.append('cd %s' % escape(v)) 98 + continue 99 + else: 100 + continue 101 + if k == 'PATH': 102 + value = ' '.join([escape(directory) 103 + for directory in v.split(':')]) 104 + else: 105 + value = escape(v) 106 + script_lines.append('set -g -x %s %s' % (k, value)) 107 + 108 + for var in set(old_env.keys()) - set(new_env.keys()): 109 + script_lines.append(comment('removing %s' % var)) 110 + script_lines.append('set -e %s' % var) 111 + 112 + script = '\n'.join(script_lines) 113 + 114 + alias_lines = [] 115 + for line in alias_str.splitlines(): 116 + _, rest = line.split(None, 1) 117 + k, v = rest.split("=", 1) 118 + alias_lines.append("alias " + escape_identifier(k) + "=" + v) 119 + alias = '\n'.join(alias_lines) 120 + 121 + return script + '\n' + alias 122 + 123 + script_file = os.fdopen(3, 'w') 124 + 125 + if not sys.argv[1:]: 126 + print('__bass_usage', file=script_file, end='') 127 + sys.exit(0) 128 + 129 + try: 130 + script = gen_script() 131 + except subprocess.CalledProcessError as e: 132 + sys.exit(e.returncode) 133 + except Exception: 134 + print('Bass internal error!', file=sys.stderr) 135 + raise # traceback will output to stderr 136 + except KeyboardInterrupt: 137 + signal.signal(signal.SIGINT, signal.SIG_DFL) 138 + os.kill(os.getpid(), signal.SIGINT) 139 + else: 140 + script_file.write(script)
+43
private_dot_config/fish/functions/_fzf_configure_bindings_help.fish
··· 1 + function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings." 2 + echo "\ 3 + USAGE: 4 + fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...] 5 + 6 + DESCRIPTION 7 + fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it 8 + previously installed. It installs bindings for both default and insert modes. fzf.fish executes 9 + it without options on fish startup to install the out-of-the-box key bindings. 10 + 11 + By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding 12 + can be configured using a namesake corresponding option: 13 + COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION 14 + Search Directory | Ctrl+Alt+F (F for file) | --directory 15 + Search Git Log | Ctrl+Alt+L (L for log) | --git_log 16 + Search Git Status | Ctrl+Alt+S (S for status) | --git_status 17 + Search History | Ctrl+R (R for reverse) | --history 18 + Search Processes | Ctrl+Alt+P (P for process) | --processes 19 + Search Variables | Ctrl+V (V for variable) | --variables 20 + Override a command's binding by specifying its corresponding option with the desired key 21 + sequence. Disable a command's binding by specifying its corresponding option with no value. 22 + 23 + Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly 24 + executed multiple times. Once the desired fzf_configure_bindings command has been found, add it 25 + to your config.fish in order to persist the customized bindings. 26 + 27 + In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an 28 + equals sign between an option's name and value. However, it does not validate key sequences. 29 + 30 + Pass -h or --help to print this help message and exit. 31 + 32 + EXAMPLES 33 + Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V 34 + \$ fzf_configure_bindings --directory=\cf --variables=\e\cv 35 + Default bindings but disable Search History 36 + \$ fzf_configure_bindings --history= 37 + An agglomeration of different options 38 + \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes= 39 + 40 + SEE Also 41 + To learn more about fish key bindings, see bind(1) and fish_key_reader(1). 42 + " 43 + end
+15
private_dot_config/fish/functions/_fzf_extract_var_info.fish
··· 1 + # helper function for _fzf_search_variables 2 + function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output." 3 + # Extract only the lines about the variable, all of which begin with either 4 + # $variable_name: ...or... $variable_name[ 5 + string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output | 6 + 7 + # Strip the variable name prefix, including ": " for scope info lines 8 + string replace --regex "^\\\$$variable_name(?:: )?" '' | 9 + 10 + # Distill the lines of values, replacing... 11 + # [1]: |value| 12 + # ...with... 13 + # [1] value 14 + string replace --regex ": \|(.*)\|" ' $1' 15 + end
+49
private_dot_config/fish/functions/_fzf_preview_changed_file.fish
··· 1 + # helper for _fzf_search_git_status 2 + # arg should be a line from git status --short, e.g. 3 + # MM functions/_fzf_preview_changed_file.fish 4 + # D README.md 5 + # R LICENSE -> "New License" 6 + function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file." 7 + # remove quotes because they'll be interpreted literally by git diff 8 + # no need to requote when referencing $path because fish does not perform word splitting 9 + # https://fishshell.com/docs/current/fish_for_bash_users.html 10 + set -f path (string unescape (string sub --start 4 $path_status)) 11 + # first letter of short format shows index, second letter shows working tree 12 + # https://git-scm.com/docs/git-status/2.35.0#_short_format 13 + set -f index_status (string sub --length 1 $path_status) 14 + set -f working_tree_status (string sub --start 2 --length 1 $path_status) 15 + 16 + set -f diff_opts --color=always 17 + 18 + if test $index_status = '?' 19 + _fzf_report_diff_type Untracked 20 + _fzf_preview_file $path 21 + else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU 22 + # Unmerged statuses taken directly from git status help's short format table 23 + # Unmerged statuses are mutually exclusive with other statuses, so if we see 24 + # these, then safe to assume the path is unmerged 25 + _fzf_report_diff_type Unmerged 26 + git diff $diff_opts -- $path 27 + else 28 + if test $index_status != ' ' 29 + _fzf_report_diff_type Staged 30 + 31 + # renames are only detected in the index, never working tree, so only need to test for it here 32 + # https://stackoverflow.com/questions/73954214 33 + if test $index_status = R 34 + # diff the post-rename path with the original path, otherwise the diff will show the entire file as being added 35 + set -f orig_and_new_path (string split --max 1 -- ' -> ' $path) 36 + git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2] 37 + # path currently has the form of "original -> current", so we need to correct it before it's used below 38 + set path $orig_and_new_path[2] 39 + else 40 + git diff --staged $diff_opts -- $path 41 + end 42 + end 43 + 44 + if test $working_tree_status != ' ' 45 + _fzf_report_diff_type Unstaged 46 + git diff $diff_opts -- $path 47 + end 48 + end 49 + end
+43
private_dot_config/fish/functions/_fzf_preview_file.fish
··· 1 + # helper function for _fzf_search_directory and _fzf_search_git_status 2 + function _fzf_preview_file --description "Print a preview for the given file based on its file type." 3 + # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file 4 + # as one argument, we collect all the arguments into one single variable and treat that as the path 5 + set -f file_path $argv 6 + 7 + if test -L "$file_path" # symlink 8 + # notify user and recurse on the target of the symlink, which can be any of these file types 9 + set -l target_path (realpath "$file_path") 10 + 11 + set_color yellow 12 + echo "'$file_path' is a symlink to '$target_path'." 13 + set_color normal 14 + 15 + _fzf_preview_file "$target_path" 16 + else if test -f "$file_path" # regular file 17 + if set --query fzf_preview_file_cmd 18 + # need to escape quotes to make sure eval receives file_path as a single arg 19 + eval "$fzf_preview_file_cmd '$file_path'" 20 + else 21 + bat --style=numbers --color=always "$file_path" 22 + end 23 + else if test -d "$file_path" # directory 24 + if set --query fzf_preview_dir_cmd 25 + # see above 26 + eval "$fzf_preview_dir_cmd '$file_path'" 27 + else 28 + # -A list hidden files as well, except for . and .. 29 + # -F helps classify files by appending symbols after the file name 30 + command ls -A -F "$file_path" 31 + end 32 + else if test -c "$file_path" 33 + _fzf_report_file_type "$file_path" "character device file" 34 + else if test -b "$file_path" 35 + _fzf_report_file_type "$file_path" "block device file" 36 + else if test -S "$file_path" 37 + _fzf_report_file_type "$file_path" socket 38 + else if test -p "$file_path" 39 + _fzf_report_file_type "$file_path" "named pipe" 40 + else 41 + echo "$file_path doesn't exist." >&2 42 + end 43 + end
+18
private_dot_config/fish/functions/_fzf_report_diff_type.fish
··· 1 + # helper for _fzf_preview_changed_file 2 + # prints out something like 3 + # ╭────────╮ 4 + # │ Staged │ 5 + # ╰────────╯ 6 + function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch." 7 + # number of "-" to draw is the length of the string to box + 2 for padding 8 + set -f repeat_count (math 2 + (string length $diff_type)) 9 + set -f line (string repeat --count $repeat_count ─) 10 + set -f top_border ╭$line╮ 11 + set -f btm_border ╰$line╯ 12 + 13 + set_color yellow 14 + echo $top_border 15 + echo "│ $diff_type │" 16 + echo $btm_border 17 + set_color normal 18 + end
+6
private_dot_config/fish/functions/_fzf_report_file_type.fish
··· 1 + # helper function for _fzf_preview_file 2 + function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file." 3 + set_color red 4 + echo "Cannot preview '$file_path': it is a $file_type." 5 + set_color normal 6 + end
+33
private_dot_config/fish/functions/_fzf_search_directory.fish
··· 1 + function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths." 2 + # Directly use fd binary to avoid output buffering delay caused by a fd alias, if any. 3 + # Debian-based distros install fd as fdfind and the fd package is something else, so 4 + # check for fdfind first. Fall back to "fd" for a clear error message. 5 + set -f fd_cmd (command -v fdfind || command -v fd || echo "fd") 6 + set -f --append fd_cmd --color=always $fzf_fd_opts 7 + 8 + set -f fzf_arguments --multi --ansi $fzf_directory_opts 9 + set -f token (commandline --current-token) 10 + # expand any variables or leading tilde (~) in the token 11 + set -f expanded_token (eval echo -- $token) 12 + # unescape token because it's already quoted so backslashes will mess up the path 13 + set -f unescaped_exp_token (string unescape -- $expanded_token) 14 + 15 + # If the current token is a directory and has a trailing slash, 16 + # then use it as fd's base directory. 17 + if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token" 18 + set --append fd_cmd --base-directory=$unescaped_exp_token 19 + # use the directory name as fzf's prompt to indicate the search is limited to that directory 20 + set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}" 21 + set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) 22 + else 23 + set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}' 24 + set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) 25 + end 26 + 27 + 28 + if test $status -eq 0 29 + commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ') 30 + end 31 + 32 + commandline --function repaint 33 + end
+36
private_dot_config/fish/functions/_fzf_search_git_log.fish
··· 1 + function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash." 2 + if not git rev-parse --git-dir >/dev/null 2>&1 3 + echo '_fzf_search_git_log: Not in a git repository.' >&2 4 + else 5 + if not set --query fzf_git_log_format 6 + # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below 7 + set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' 8 + end 9 + 10 + set -f preview_cmd 'git show --color=always --stat --patch {1}' 11 + if set --query fzf_diff_highlighter 12 + set preview_cmd "$preview_cmd | $fzf_diff_highlighter" 13 + end 14 + 15 + set -f selected_log_lines ( 16 + git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \ 17 + _fzf_wrapper --ansi \ 18 + --multi \ 19 + --scheme=history \ 20 + --prompt="Git Log> " \ 21 + --preview=$preview_cmd \ 22 + --query=(commandline --current-token) \ 23 + $fzf_git_log_opts 24 + ) 25 + if test $status -eq 0 26 + for line in $selected_log_lines 27 + set -f abbreviated_commit_hash (string split --field 1 " " $line) 28 + set -f full_commit_hash (git rev-parse $abbreviated_commit_hash) 29 + set -f --append commit_hashes $full_commit_hash 30 + end 31 + commandline --current-token --replace (string join ' ' $commit_hashes) 32 + end 33 + end 34 + 35 + commandline --function repaint 36 + end
+41
private_dot_config/fish/functions/_fzf_search_git_status.fish
··· 1 + function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths." 2 + if not git rev-parse --git-dir >/dev/null 2>&1 3 + echo '_fzf_search_git_status: Not in a git repository.' >&2 4 + else 5 + set -f preview_cmd '_fzf_preview_changed_file {}' 6 + if set --query fzf_diff_highlighter 7 + set preview_cmd "$preview_cmd | $fzf_diff_highlighter" 8 + end 9 + 10 + set -f selected_paths ( 11 + # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe 12 + git -c color.status=always status --short | 13 + _fzf_wrapper --ansi \ 14 + --multi \ 15 + --prompt="Git Status> " \ 16 + --query=(commandline --current-token) \ 17 + --preview=$preview_cmd \ 18 + --nth="2.." \ 19 + $fzf_git_status_opts 20 + ) 21 + if test $status -eq 0 22 + # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle 23 + # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") 24 + set -f cleaned_paths 25 + 26 + for path in $selected_paths 27 + if test (string sub --length 1 $path) = R 28 + # path has been renamed and looks like "R LICENSE -> LICENSE.md" 29 + # extract the path to use from after the arrow 30 + set --append cleaned_paths (string split -- "-> " $path)[-1] 31 + else 32 + set --append cleaned_paths (string sub --start=4 $path) 33 + end 34 + end 35 + 36 + commandline --current-token --replace -- (string join ' ' $cleaned_paths) 37 + end 38 + end 39 + 40 + commandline --function repaint 41 + end
+39
private_dot_config/fish/functions/_fzf_search_history.fish
··· 1 + function _fzf_search_history --description "Search command history. Replace the command line with the selected command." 2 + # history merge incorporates history changes from other fish sessions 3 + # it errors out if called in private mode 4 + if test -z "$fish_private_mode" 5 + builtin history merge 6 + end 7 + 8 + if not set --query fzf_history_time_format 9 + # Reference https://devhints.io/strftime to understand strftime format symbols 10 + set -f fzf_history_time_format "%m-%d %H:%M:%S" 11 + end 12 + 13 + # Delinate time from command in history entries using the vertical box drawing char (U+2502). 14 + # Then, to get raw command from history entries, delete everything up to it. The ? on regex is 15 + # necessary to make regex non-greedy so it won't match into commands containing the char. 16 + set -f time_prefix_regex '^.*? │ ' 17 + # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line 18 + set -f commands_selected ( 19 + builtin history --null --show-time="$fzf_history_time_format │ " | 20 + _fzf_wrapper --read0 \ 21 + --print0 \ 22 + --multi \ 23 + --scheme=history \ 24 + --prompt="History> " \ 25 + --query=(commandline) \ 26 + --preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \ 27 + --preview-window="bottom:3:wrap" \ 28 + $fzf_history_opts | 29 + string split0 | 30 + # remove timestamps from commands selected 31 + string replace --regex $time_prefix_regex '' 32 + ) 33 + 34 + if test $status -eq 0 35 + commandline --replace -- $commands_selected 36 + end 37 + 38 + commandline --function repaint 39 + end
+32
private_dot_config/fish/functions/_fzf_search_processes.fish
··· 1 + function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process." 2 + # Directly use ps command because it is often aliased to a different command entirely 3 + # or with options that dirty the search results and preview output 4 + set -f ps_cmd (command -v ps || echo "ps") 5 + # use all caps to be consistent with ps default format 6 + # snake_case because ps doesn't seem to allow spaces in the field names 7 + set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command') 8 + set -f processes_selected ( 9 + $ps_cmd -A -opid,command | \ 10 + _fzf_wrapper --multi \ 11 + --prompt="Processes> " \ 12 + --query (commandline --current-token) \ 13 + --ansi \ 14 + # first line outputted by ps is a header, so we need to mark it as so 15 + --header-lines=1 \ 16 + # ps uses exit code 1 if the process was not found, in which case show an message explaining so 17 + --preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ 18 + --preview-window="bottom:4:wrap" \ 19 + $fzf_processes_opts 20 + ) 21 + 22 + if test $status -eq 0 23 + for process in $processes_selected 24 + set -f --append pids_selected (string split --no-empty --field=1 -- " " $process) 25 + end 26 + 27 + # string join to replace the newlines outputted by string split with spaces 28 + commandline --current-token --replace -- (string join ' ' $pids_selected) 29 + end 30 + 31 + commandline --function repaint 32 + end
+47
private_dot_config/fish/functions/_fzf_search_variables.fish
··· 1 + # This function expects the following two arguments: 2 + # argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables 3 + # argument 2 = output of (set --names | psub), i.e. a file with all variable names 4 + function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable." 5 + if test -z "$set_names_output" 6 + printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2 7 + 8 + commandline --function repaint 9 + return 22 # 22 means invalid argument in POSIX 10 + end 11 + 12 + # Exclude the history variable from being piped into fzf because 13 + # 1. it's not included in $set_names_output 14 + # 2. it tends to be a very large value => increases computation time 15 + # 3._fzf_search_history is a much better way to examine history anyway 16 + set -f all_variable_names (string match --invert history <$set_names_output) 17 + 18 + set -f current_token (commandline --current-token) 19 + # Use the current token to pre-populate fzf's query. If the current token begins 20 + # with a $, remove it from the query so that it will better match the variable names 21 + set -f cleaned_curr_token (string replace -- '$' '' $current_token) 22 + 23 + set -f variable_names_selected ( 24 + printf '%s\n' $all_variable_names | 25 + _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \ 26 + --prompt="Variables> " \ 27 + --preview-window="wrap" \ 28 + --multi \ 29 + --query=$cleaned_curr_token \ 30 + $fzf_variables_opts 31 + ) 32 + 33 + if test $status -eq 0 34 + # If the current token begins with a $, do not overwrite the $ when 35 + # replacing the current token with the selected variable. 36 + # Uses brace expansion to prepend $ to each variable name. 37 + commandline --current-token --replace ( 38 + if string match --quiet -- '$*' $current_token 39 + string join " " \${$variable_names_selected} 40 + else 41 + string join " " $variable_names_selected 42 + end 43 + ) 44 + end 45 + 46 + commandline --function repaint 47 + end
+21
private_dot_config/fish/functions/_fzf_wrapper.fish
··· 1 + function _fzf_wrapper --description "Prepares some environment variables before executing fzf." 2 + # Make sure fzf uses fish to execute preview commands, some of which 3 + # are autoloaded fish functions so don't exist in other shells. 4 + # Use --function so that it doesn't clobber SHELL outside this function. 5 + set -f --export SHELL (command --search fish) 6 + 7 + # If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults. 8 + # See https://github.com/junegunn/fzf#environment-variables 9 + set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE 10 + if test $status -eq 2 11 + # cycle allows jumping between the first and last results, making scrolling faster 12 + # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env 13 + # border shows where the fzf window begins and ends 14 + # height=90% leaves space to see the current command and some scrollback, maintaining context of work 15 + # preview-window=wrap wraps long lines in the preview window, making reading easier 16 + # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >) 17 + set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"' 18 + end 19 + 20 + fzf $argv 21 + end
+20
private_dot_config/fish/functions/_nvm_index_update.fish
··· 1 + function _nvm_index_update 2 + test ! -d $nvm_data && command mkdir -p $nvm_data 3 + 4 + set --local index $nvm_data/.index 5 + 6 + if not command curl --location --silent $nvm_mirror/index.tab >$index.temp 7 + command rm -f $index.temp 8 + echo "nvm: Can't update index, host unavailable: \"$nvm_mirror\"" >&2 9 + return 1 10 + end 11 + 12 + command awk -v OFS=\t ' 13 + /v0.9.12/ { exit } # Unsupported 14 + NR > 1 { 15 + print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "") 16 + } 17 + ' $index.temp >$index 18 + 19 + command rm -f $index.temp 20 + end
+11
private_dot_config/fish/functions/_nvm_list.fish
··· 1 + function _nvm_list 2 + set --local versions $nvm_data/* 3 + set --query versions[1] && 4 + string match --entire --regex -- (string match --regex -- "v\d.+" $versions | 5 + string escape --style=regex | 6 + string join "|" 7 + ) <$nvm_data/.index 8 + 9 + command --all node | 10 + string match --quiet --invert --regex -- "^$nvm_data" && echo system 11 + end
+4
private_dot_config/fish/functions/_nvm_version_activate.fish
··· 1 + function _nvm_version_activate --argument-names ver 2 + set --global --export nvm_current_version $ver 3 + set --prepend PATH $nvm_data/$ver/bin 4 + end
+5
private_dot_config/fish/functions/_nvm_version_deactivate.fish
··· 1 + function _nvm_version_deactivate --argument-names ver 2 + test "$nvm_current_version" = "$ver" && set --erase nvm_current_version 3 + set --local index (contains --index -- $nvm_data/$ver/bin $PATH) && 4 + set --erase PATH[$index] 5 + end
+29
private_dot_config/fish/functions/bass.fish
··· 1 + function bass 2 + set -l bash_args $argv 3 + set -l bass_debug 4 + if test "$bash_args[1]_" = '-d_' 5 + set bass_debug true 6 + set -e bash_args[1] 7 + end 8 + 9 + set -l script_file (mktemp) 10 + if command -v python3 >/dev/null 2>&1 11 + command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file 12 + else 13 + command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file 14 + end 15 + set -l bass_status $status 16 + if test $bass_status -ne 0 17 + return $bass_status 18 + end 19 + 20 + if test -n "$bass_debug" 21 + cat $script_file 22 + end 23 + source $script_file 24 + command rm $script_file 25 + end 26 + 27 + function __bass_usage 28 + echo "Usage: bass [-d] <bash-command>" 29 + end
+4
private_dot_config/fish/functions/cat.fish
··· 1 + function cat --wraps=bat --description 'alias cat=bat' 2 + bat $argv 3 + 4 + end
+240
private_dot_config/fish/functions/fisher.fish
··· 1 + function fisher --argument-names cmd --description "A plugin manager for Fish" 2 + set --query fisher_path || set --local fisher_path $__fish_config_dir 3 + set --local fisher_version 4.4.4 4 + set --local fish_plugins $__fish_config_dir/fish_plugins 5 + 6 + switch "$cmd" 7 + case -v --version 8 + echo "fisher, version $fisher_version" 9 + case "" -h --help 10 + echo "Usage: fisher install <plugins...> Install plugins" 11 + echo " fisher remove <plugins...> Remove installed plugins" 12 + echo " fisher update <plugins...> Update installed plugins" 13 + echo " fisher update Update all installed plugins" 14 + echo " fisher list [<regex>] List installed plugins matching regex" 15 + echo "Options:" 16 + echo " -v, --version Print version" 17 + echo " -h, --help Print this help message" 18 + echo "Variables:" 19 + echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ 20 + case ls list 21 + string match --entire --regex -- "$argv[2]" $_fisher_plugins 22 + case install update remove 23 + isatty || read --local --null --array stdin && set --append argv $stdin 24 + 25 + set --local install_plugins 26 + set --local update_plugins 27 + set --local remove_plugins 28 + set --local arg_plugins $argv[2..-1] 29 + set --local old_plugins $_fisher_plugins 30 + set --local new_plugins 31 + 32 + test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins) 33 + 34 + if ! set --query argv[2] 35 + if test "$cmd" != update 36 + echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 37 + else if ! set --query file_plugins 38 + echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 39 + end 40 + set arg_plugins $file_plugins 41 + end 42 + 43 + for plugin in $arg_plugins 44 + set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin) 45 + contains -- "$plugin" $new_plugins || set --append new_plugins $plugin 46 + end 47 + 48 + if set --query argv[2] 49 + for plugin in $new_plugins 50 + if contains -- "$plugin" $old_plugins 51 + test "$cmd" = remove && 52 + set --append remove_plugins $plugin || 53 + set --append update_plugins $plugin 54 + else if test "$cmd" = install 55 + set --append install_plugins $plugin 56 + else 57 + echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1 58 + end 59 + end 60 + else 61 + for plugin in $new_plugins 62 + contains -- "$plugin" $old_plugins && 63 + set --append update_plugins $plugin || 64 + set --append install_plugins $plugin 65 + end 66 + 67 + for plugin in $old_plugins 68 + contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin 69 + end 70 + end 71 + 72 + set --local pid_list 73 + set --local source_plugins 74 + set --local fetch_plugins $update_plugins $install_plugins 75 + set --local fish_path (status fish-path) 76 + 77 + echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal) 78 + 79 + for plugin in $fetch_plugins 80 + set --local source (command mktemp -d) 81 + set --append source_plugins $source 82 + 83 + command mkdir -p $source/{completions,conf.d,themes,functions} 84 + 85 + $fish_path --command " 86 + if test -e $plugin 87 + command cp -Rf $plugin/* $source 88 + else 89 + set temp (command mktemp -d) 90 + set repo (string split -- \@ $plugin) || set repo[2] HEAD 91 + 92 + if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) 93 + set name (string split -- / \$path)[-1] 94 + set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz 95 + else 96 + set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] 97 + end 98 + 99 + echo Fetching (set_color --underline)\$url(set_color normal) 100 + 101 + if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null 102 + command cp -Rf \$temp/*/* $source 103 + else 104 + echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 105 + command rm -rf $source 106 + end 107 + 108 + command rm -rf \$temp 109 + end 110 + 111 + set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files 112 + " & 113 + 114 + set --append pid_list (jobs --last --pid) 115 + end 116 + 117 + wait $pid_list 2>/dev/null 118 + 119 + for plugin in $fetch_plugins 120 + if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source 121 + if set --local index (contains --index -- "$plugin" $install_plugins) 122 + set --erase install_plugins[$index] 123 + else 124 + set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)] 125 + end 126 + end 127 + end 128 + 129 + for plugin in $update_plugins $remove_plugins 130 + if set --local index (contains --index -- "$plugin" $_fisher_plugins) 131 + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files 132 + 133 + if contains -- "$plugin" $remove_plugins 134 + for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var) 135 + emit {$name}_uninstall 136 + end 137 + printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ 138 + set --erase _fisher_plugins[$index] 139 + end 140 + 141 + command rm -rf (string replace -- \~ ~ $$plugin_files_var) 142 + 143 + functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var) 144 + 145 + for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var) 146 + complete --erase --command $name 147 + end 148 + 149 + set --erase $plugin_files_var 150 + end 151 + end 152 + 153 + if set --query update_plugins[1] || set --query install_plugins[1] 154 + command mkdir -p $fisher_path/{functions,themes,conf.d,completions} 155 + end 156 + 157 + for plugin in $update_plugins $install_plugins 158 + set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] 159 + set --local files $source/{functions,themes,conf.d,completions}/* 160 + 161 + if set --local index (contains --index -- $plugin $install_plugins) 162 + set --local user_files $fisher_path/{functions,themes,conf.d,completions}/* 163 + set --local conflict_files 164 + 165 + for file in (string replace -- $source/ $fisher_path/ $files) 166 + contains -- $file $user_files && set --append conflict_files $file 167 + end 168 + 169 + if set --query conflict_files[1] && set --erase install_plugins[$index] 170 + echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2 171 + continue 172 + end 173 + end 174 + 175 + for file in (string replace -- $source/ "" $files) 176 + command cp -RLf $source/$file $fisher_path/$file 177 + end 178 + 179 + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files 180 + 181 + set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~) 182 + 183 + contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin 184 + contains -- $plugin $install_plugins && set --local event install || set --local event update 185 + 186 + printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ 187 + 188 + for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) 189 + source $file 190 + if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file) 191 + emit {$name}_$event 192 + end 193 + end 194 + end 195 + 196 + command rm -rf $source_plugins 197 + 198 + if set --query _fisher_plugins[1] 199 + set --local commit_plugins 200 + 201 + for plugin in $file_plugins 202 + contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin 203 + end 204 + 205 + for plugin in $_fisher_plugins 206 + contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin 207 + end 208 + 209 + printf "%s\n" $commit_plugins >$fish_plugins 210 + else 211 + set --erase _fisher_plugins 212 + command rm -f $fish_plugins 213 + end 214 + 215 + set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins) 216 + 217 + test "$total" != "0 0 0" && echo (string join ", " ( 218 + test $total[1] = 0 || echo "Installed $total[1]") ( 219 + test $total[2] = 0 || echo "Updated $total[2]") ( 220 + test $total[3] = 0 || echo "Removed $total[3]") 221 + ) plugin/s 222 + case \* 223 + echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1 224 + end 225 + end 226 + 227 + if ! set --query _fisher_upgraded_to_4_4 228 + set --universal _fisher_upgraded_to_4_4 229 + if functions --query _fisher_list 230 + set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share 231 + command rm -rf $XDG_DATA_HOME/fisher 232 + functions --erase _fisher_{list,plugin_parse} 233 + fisher update >/dev/null 2>/dev/null 234 + else 235 + for var in (set --names | string match --entire --regex '^_fisher_.+_files$') 236 + set $var (string replace -- ~ \~ $$var) 237 + end 238 + functions --erase _fisher_fish_postexec 239 + end 240 + end
+46
private_dot_config/fish/functions/fzf_configure_bindings.fish
··· 1 + # Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect 2 + # https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1 3 + function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options." 4 + # no need to install bindings if not in interactive mode or running tests 5 + status is-interactive || test "$CI" = true; or return 6 + 7 + set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?' 8 + argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null 9 + if test $status -ne 0 10 + echo "Invalid option or a positional argument was provided." >&2 11 + _fzf_configure_bindings_help 12 + return 22 13 + else if set --query _flag_help 14 + _fzf_configure_bindings_help 15 + return 16 + else 17 + # Initialize with default key sequences and then override or disable them based on flags 18 + # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables 19 + set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape 20 + set --query _flag_directory && set key_sequences[1] "$_flag_directory" 21 + set --query _flag_git_log && set key_sequences[2] "$_flag_git_log" 22 + set --query _flag_git_status && set key_sequences[3] "$_flag_git_status" 23 + set --query _flag_history && set key_sequences[4] "$_flag_history" 24 + set --query _flag_processes && set key_sequences[5] "$_flag_processes" 25 + set --query _flag_variables && set key_sequences[6] "$_flag_variables" 26 + 27 + # If fzf bindings already exists, uninstall it first for a clean slate 28 + if functions --query _fzf_uninstall_bindings 29 + _fzf_uninstall_bindings 30 + end 31 + 32 + for mode in default insert 33 + test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory 34 + test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log 35 + test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status 36 + test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history 37 + test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes 38 + test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command" 39 + end 40 + 41 + function _fzf_uninstall_bindings --inherit-variable key_sequences 42 + bind --erase -- $key_sequences 43 + bind --erase --mode insert -- $key_sequences 44 + end 45 + end 46 + end
+4
private_dot_config/fish/functions/icat.fish
··· 1 + function icat --description 'alias icat=kitten icat' 2 + kitten icat $argv 3 + 4 + end
+3
private_dot_config/fish/functions/load_nvm.fish
··· 1 + function load_nvm 2 + bass source ~/.nvm/nvm.sh 3 + end
+4
private_dot_config/fish/functions/ls.fish
··· 1 + function ls --wraps=lsd --description 'alias ls=lsd' 2 + lsd $argv 3 + 4 + end
+4
private_dot_config/fish/functions/mosh.fish
··· 1 + function mosh --wraps='TERM=xterm-256color /usr/bin/mosh' --description 'alias mosh=TERM=xterm-256color /usr/bin/mosh' 2 + TERM=xterm-256color /usr/bin/mosh $argv 3 + 4 + end
+3
private_dot_config/fish/functions/nvm.fish
··· 1 + function nvm 2 + bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv 3 + end
+40
private_dot_config/fish/functions/rvm.fish
··· 1 + function rvm --description='Ruby enVironment Manager' 2 + # run RVM and capture the resulting environment 3 + set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX) 4 + # This finds where RVM's root directory is and sources scripts/rvm from within it. Then loads RVM in a clean environment and dumps the environment variables it generates out for us to use. 5 + bash -c 'PATH=$GEM_HOME/bin:$PATH;RVMA=$(which rvm);RVMB=$(whereis rvm | sed "s/rvm://");source $(if test $RVMA;then echo $RVMA | sed "s/\/bin\//\/scripts\//";elif test $RVMB; then echo $RVMB | sed "s/rvm/rvm\/scripts\/rvm/"; else echo ~/.rvm/scripts/rvm; fi); rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv 6 + 7 + # apply rvm_* and *PATH variables from the captured environment 8 + and eval (grep -E '^rvm|^PATH|^GEM_PATH|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/s/:/" "/g; s/^/set -xg /; s/=/ "/; s/$/" ;/; s/(//; s/)//') 9 + # needed under fish >= 2.2.0 10 + and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g') 11 + 12 + # clean up 13 + rm -f $env_file 14 + end 15 + 16 + function __handle_rvmrc_stuff --on-variable PWD 17 + # Source a .rvmrc file in a directory after changing to it, if it exists. 18 + # To disable this feature, set rvm_project_rvmrc=0 in $HOME/.rvmrc 19 + if test "$rvm_project_rvmrc" != 0 20 + set -l cwd $PWD 21 + while true 22 + if contains $cwd "" $HOME "/" 23 + if test "$rvm_project_rvmrc_default" = 1 24 + rvm default 1>/dev/null 2>&1 25 + end 26 + break 27 + else 28 + if test -e .rvmrc -o -e .ruby-version -o -e .ruby-gemset -o -e Gemfile 29 + eval "rvm reload" > /dev/null 30 + eval "rvm rvmrc load" >/dev/null 31 + break 32 + else 33 + set cwd (dirname "$cwd") 34 + end 35 + end 36 + end 37 + 38 + set -e cwd 39 + end 40 + end
+4
private_dot_config/fish/functions/ssh.fish
··· 1 + function ssh --wraps='TERM=xterm-256color /usr/bin/ssh' --description 'alias ssh=TERM=xterm-256color /usr/bin/ssh' 2 + TERM=xterm-256color /usr/bin/ssh $argv 3 + 4 + end
+4
private_dot_config/fish/functions/turbo.fish
··· 1 + function turbo --wraps='npx turbo@latest' --description 'alias turbo=npx turbo@latest' 2 + npx turbo@latest $argv 3 + 4 + end
+4
private_dot_config/fish/functions/vim.fish
··· 1 + function vim --wraps=nvim --description 'alias vim=nvim' 2 + nvim $argv 3 + 4 + end
private_dot_config/fish/themes/.keep

This is a binary file and will not be displayed.

+45
private_dot_config/ghostty/config
··· 1 + # This is the configuration file for Ghostty. 2 + # 3 + # This template file has been automatically created at the following 4 + # path since Ghostty couldn't find any existing config files on your system: 5 + # 6 + # /home/vitorpy/.config/ghostty/config 7 + # 8 + # The template does not set any default options, since Ghostty ships 9 + # with sensible defaults for all options. Users should only need to set 10 + # options that they want to change from the default. 11 + # 12 + # Run `ghostty +show-config --default --docs` to view a list of 13 + # all available config options and their default values. 14 + # 15 + # Additionally, each config option is also explained in detail 16 + # on Ghostty's website, at https://ghostty.org/docs/config. 17 + 18 + # Config syntax crash course 19 + # ========================== 20 + # # The config file consists of simple key-value pairs, 21 + # # separated by equals signs. 22 + font-family = BerkeleyMono Nerd Font 23 + # window-padding-x = 2 24 + # 25 + # # Spacing around the equals sign does not matter. 26 + # # All of these are identical: 27 + # key=value 28 + # key= value 29 + # key =value 30 + # key = value 31 + # 32 + # # Any line beginning with a # is a comment. It's not possible to put 33 + # # a comment after a config option, since it would be interpreted as a 34 + # # part of the value. For example, this will have a value of "#123abc": 35 + # background = #123abc 36 + # 37 + # # Empty values are used to reset config keys to default. 38 + # key = 39 + # 40 + # # Some config options have unique syntaxes for their value, 41 + # # which is explained in the docs for that config option. 42 + # # Just for example: 43 + # resize-overlay-duration = 4s 200ms 44 + theme = Zenburn 45 + keybind = shift+enter=text:\x1b\r