···11+# This is terribly complicated
22+# It's because:
33+# 1. bun run has to have dynamic completions
44+# 2. there are global options
55+# 3. bun {install add remove} gets special options
66+# 4. I don't know how to write fish completions well
77+# Contributions very welcome!!
88+99+function __fish__get_bun_bins
1010+ string split ' ' (bun getcompletes b)
1111+end
1212+1313+function __fish__get_bun_scripts
1414+ set -lx SHELL bash
1515+ set -lx MAX_DESCRIPTION_LEN 40
1616+ string trim (string split '\n' (string split '\t' (bun getcompletes z)))
1717+end
1818+1919+function __fish__get_bun_packages
2020+ if test (commandline -ct) != ""
2121+ set -lx SHELL fish
2222+ string split ' ' (bun getcompletes a (commandline -ct))
2323+ end
2424+end
2525+2626+function __history_completions
2727+ set -l tokens (commandline --current-process --tokenize)
2828+ history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | string replace -r \^$tokens[2]\\s\* "" | string split ' '
2929+end
3030+3131+function __fish__get_bun_bun_js_files
3232+ string split ' ' (bun getcompletes j)
3333+end
3434+3535+set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
3636+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"
3737+3838+set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x
3939+set -l bun_builtin_cmds_accepting_flags create help bun upgrade discord run init link unlink pm x
4040+4141+function __bun_complete_bins_scripts --inherit-variable bun_builtin_cmds_without_run -d "Emit bun completions for bins and scripts"
4242+ # Do nothing if we already have a builtin subcommand,
4343+ # or any subcommand other than "run".
4444+ if __fish_seen_subcommand_from $bun_builtin_cmds_without_run
4545+ or not __fish_use_subcommand && not __fish_seen_subcommand_from run
4646+ return
4747+ end
4848+ # Do we already have a bin or script subcommand?
4949+ set -l bins (__fish__get_bun_bins)
5050+ if __fish_seen_subcommand_from $bins
5151+ return
5252+ end
5353+ # Scripts have descriptions appended with a tab separator.
5454+ # Strip off descriptions for the purposes of subcommand testing.
5555+ set -l scripts (__fish__get_bun_scripts)
5656+ if __fish_seen_subcommand_from (string split \t -f 1 -- $scripts)
5757+ return
5858+ end
5959+ # Emit scripts.
6060+ for script in $scripts
6161+ echo $script
6262+ end
6363+ # Emit binaries and JS files (but only if we're doing `bun run`).
6464+ if __fish_seen_subcommand_from run
6565+ for bin in $bins
6666+ echo "$bin"\t"package bin"
6767+ end
6868+ for file in (__fish__get_bun_bun_js_files)
6969+ echo "$file"\t"Bun.js"
7070+ end
7171+ end
7272+end
7373+7474+7575+# Clear existing completions
7676+complete -e -c bun
7777+7878+# Dynamically emit scripts and binaries
7979+complete -c bun -f -a "(__bun_complete_bins_scripts)"
8080+8181+# Complete flags if we have no subcommand or a flag-friendly one.
8282+set -l flag_applies "__fish_use_subcommand; or __fish_seen_subcommand_from $bun_builtin_cmds_accepting_flags"
8383+complete -c bun \
8484+ -n $flag_applies --no-files -s 'u' -l 'origin' -r -d 'Server URL. Rewrites import paths'
8585+complete -c bun \
8686+ -n $flag_applies --no-files -s 'p' -l 'port' -r -d 'Port number to start server from'
8787+complete -c bun \
8888+ -n $flag_applies --no-files -s 'd' -l 'define' -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"'
8989+complete -c bun \
9090+ -n $flag_applies --no-files -s 'e' -l 'external' -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react'
9191+complete -c bun \
9292+ -n $flag_applies --no-files -l 'use' -r -d 'Use a framework (ex: next)'
9393+complete -c bun \
9494+ -n $flag_applies --no-files -l 'hot' -r -d 'Enable hot reloading in Bun\'s JavaScript runtime'
9595+9696+# Complete dev and create as first subcommand.
9797+complete -c bun \
9898+ -n "__fish_use_subcommand" -a 'dev' -d 'Start dev server'
9999+complete -c bun \
100100+ -n "__fish_use_subcommand" -a 'create' -f -d 'Create a new project from a template'
101101+102102+# Complete "next" and "react" if we've seen "create".
103103+complete -c bun \
104104+ -n "__fish_seen_subcommand_from create" -a 'next' -d 'new Next.js project'
105105+106106+complete -c bun \
107107+ -n "__fish_seen_subcommand_from create" -a 'react' -d 'new React project'
108108+109109+# Complete "upgrade" as first subcommand.
110110+complete -c bun \
111111+ -n "__fish_use_subcommand" -a 'upgrade' -d 'Upgrade bun to the latest version' -x
112112+# Complete "-h/--help" unconditionally.
113113+complete -c bun \
114114+ -s "h" -l "help" -d 'See all commands and flags' -x
115115+116116+# Complete "-v/--version" if we have no subcommand.
117117+complete -c bun \
118118+ -n "not __fish_use_subcommand" -l "version" -s "v" -d 'Bun\'s version' -x
119119+120120+# Complete additional subcommands.
121121+complete -c bun \
122122+ -n "__fish_use_subcommand" -a 'discord' -d 'Open bun\'s Discord server' -x
123123+124124+125125+complete -c bun \
126126+ -n "__fish_use_subcommand" -a 'bun' -d 'Generate a new bundle'
127127+128128+129129+complete -c bun \
130130+ -n "__fish_seen_subcommand_from bun" -F -d 'Bundle this'
131131+132132+complete -c bun \
133133+ -n "__fish_seen_subcommand_from create; and __fish_seen_subcommand_from react next" -F -d "Create in directory"
134134+135135+136136+complete -c bun \
137137+ -n "__fish_use_subcommand" -a 'init' -F -d 'Start an empty Bun project'
138138+139139+complete -c bun \
140140+ -n "__fish_use_subcommand" -a 'install' -f -d 'Install packages from package.json'
141141+142142+complete -c bun \
143143+ -n "__fish_use_subcommand" -a 'add' -F -d 'Add a package to package.json'
144144+145145+complete -c bun \
146146+ -n "__fish_use_subcommand" -a 'remove' -F -d 'Remove a package from package.json'
147147+148148+149149+for i in (seq (count $bun_install_boolean_flags))
150150+ complete -c bun \
151151+ -n "__fish_seen_subcommand_from install add remove" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]"
152152+end
153153+154154+complete -c bun \
155155+ -n "__fish_seen_subcommand_from install add remove" -l 'cwd' -d 'Change working directory'
156156+157157+complete -c bun \
158158+ -n "__fish_seen_subcommand_from install add remove" -l 'cache-dir' -d 'Choose a cache directory (default: $HOME/.bun/install/cache)'
159159+160160+complete -c bun \
161161+ -n "__fish_seen_subcommand_from add" -d 'Popular' -a '(__fish__get_bun_packages)'
162162+163163+complete -c bun \
164164+ -n "__fish_seen_subcommand_from add" -d 'History' -a '(__history_completions)'
165165+166166+complete -c bun \
167167+ -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
168168+169169+complete -c bun \
170170+ -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
171171+172172+# Add built-in subcommands with descriptions.
173173+complete -c bun -n "__fish_use_subcommand" -a "create" -f -d "Create a new project from a template"
174174+complete -c bun -n "__fish_use_subcommand" -a "build bun" --require-parameter -F -d "Transpile and bundle one or more files"
175175+complete -c bun -n "__fish_use_subcommand" -a "upgrade" -d "Upgrade Bun"
176176+complete -c bun -n "__fish_use_subcommand" -a "run" -d "Run a script or package binary"
177177+complete -c bun -n "__fish_use_subcommand" -a "install" -d "Install dependencies from package.json" -f
178178+complete -c bun -n "__fish_use_subcommand" -a "remove" -d "Remove a dependency from package.json" -f
179179+complete -c bun -n "__fish_use_subcommand" -a "add" -d "Add a dependency to package.json" -f
180180+complete -c bun -n "__fish_use_subcommand" -a "init" -d "Initialize a Bun project in this directory" -f
181181+complete -c bun -n "__fish_use_subcommand" -a "link" -d "Register or link a local npm package" -f
182182+complete -c bun -n "__fish_use_subcommand" -a "link" -d "Unregister a local npm package" -f
183183+complete -c bun -n "__fish_use_subcommand" -a "pm" -d "Additional package management utilities" -f
184184+complete -c bun -n "__fish_use_subcommand" -a "x" -d "Execute a package binary, installing if needed" -f
···11+complete fzf_configure_bindings --no-files
22+complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h"
33+complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory"
44+complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log"
55+complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status"
66+complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history"
77+complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes"
88+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
···11+# 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
22+if not status is-interactive && test "$CI" != true
33+ exit
44+end
55+66+# Because of scoping rules, to capture the shell variables exactly as they are, we must read
77+# them before even executing _fzf_search_variables. We use psub to store the
88+# variables' info in temporary files and pass in the filenames as arguments.
99+# This variable is global so that it can be referenced by fzf_configure_bindings and in tests
1010+set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)'
1111+1212+1313+# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings
1414+fzf_configure_bindings
1515+1616+# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased
1717+function _fzf_uninstall --on-event fzf_uninstall
1818+ _fzf_uninstall_bindings
1919+2020+ set --erase _fzf_search_vars_command
2121+ functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings
2222+ complete --erase fzf_configure_bindings
2323+2424+ set_color cyan
2525+ echo "fzf.fish uninstalled."
2626+ echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings."
2727+ set_color normal
2828+end
+28
private_dot_config/fish/conf.d/nvm.fish
···11+set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
22+set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
33+set --global nvm_data $XDG_DATA_HOME/nvm
44+55+function _nvm_install --on-event nvm_install
66+ test ! -d $nvm_data && command mkdir -p $nvm_data
77+ echo "Downloading the Node distribution index..." 2>/dev/null
88+ _nvm_index_update
99+end
1010+1111+function _nvm_update --on-event nvm_update
1212+ set --query --universal nvm_data && set --erase --universal nvm_data
1313+ set --query --universal nvm_mirror && set --erase --universal nvm_mirror
1414+ set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
1515+end
1616+1717+function _nvm_uninstall --on-event nvm_uninstall
1818+ command rm -rf $nvm_data
1919+2020+ set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
2121+2222+ set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source
2323+ functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
2424+end
2525+2626+if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
2727+ nvm use --silent $nvm_default_version
2828+end
+7
private_dot_config/fish/conf.d/omf.fish
···11+# Path to Oh My Fish install.
22+set -q XDG_DATA_HOME
33+ and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
44+ or set -gx OMF_PATH "$HOME/.local/share/omf"
55+66+# Load Oh My Fish configuration.
77+source $OMF_PATH/init.fish
···11+/home/linuxbrew/.linuxbrew/bin/brew shellenv | source
22+33+fish_add_path /home/vitorpy/.local/bin
44+55+set NODE_OPTIONS --max-old-space-size=8192
66+77+# Created by `pipx` on 2024-04-12 12:49:16
88+set PATH $PATH /home/vitorpy/.local/bin
99+set OMAKUB_PATH /home/vitorpy/.local/share/omakub
1010+1111+# bun
1212+set BUN_INSTALL "$HOME/.bun"
1313+set PATH $BUN_INSTALL/bin $PATH
1414+1515+# Android SDK
1616+set PATH $PATH /home/vitorpy/Android/Sdk/platform-tools
1717+set PATH $PATH /home/vitorpy/android-studio/bin
1818+1919+# ANTHROPIC_API_KEY should be set via environment or secure method
2020+2121+if status is-interactive
2222+ set fish_greeting
2323+ set EDITOR nvim
2424+ set GTK_THEME "Yaru:dark"
2525+ set HOMEBREW_NO_ENV_HINTS
2626+ set QT_QPA_PLATFORMTHEME gnome
2727+ set QT_STYLE_OVERRIDE Adwaita-Dark
2828+ set MOZ_ENABLE_WAYLAND 0
2929+3030+ # Commands to run in interactive sessions can go here
3131+ starship init fish | source
3232+ direnv hook fish | source
3333+end
3434+3535+export NARGO_HOME="/home/vitorpy/.nargo"
3636+3737+# NVM Setup
3838+set -x NVM_DIR ~/.nvm
3939+4040+# Load nvm automatically if it exists
4141+if test -e ~/.nvm/nvm.sh
4242+ load_nvm
4343+end
4444+4545+# pnpm
4646+set -gx PNPM_HOME "/home/vitorpy/.local/share/pnpm"
4747+if not string match -q -- $PNPM_HOME $PATH
4848+ set -gx PATH "$PNPM_HOME" $PATH
4949+end
5050+# pnpm end
5151+
+21
private_dot_config/fish/config.fish.backup
···11+/home/linuxbrew/.linuxbrew/bin/brew shellenv | source
22+33+fish_add_path /home/vpb/.local/bin
44+55+if status is-interactive
66+ set fish_greeting
77+ set EDITOR nvim
88+99+ # Commands to run in interactive sessions can go here
1010+ starship init fish | source
1111+ direnv hook fish | source
1212+ nvm use latest
1313+end
1414+1515+1616+# Created by `pipx` on 2024-04-12 12:49:16
1717+set PATH $PATH /home/vitorpy/.local/bin
1818+1919+# bun
2020+set --export BUN_INSTALL "$HOME/.bun"
2121+set --export PATH $BUN_INSTALL/bin $PATH
···11+function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
22+ echo "\
33+USAGE:
44+ fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...]
55+66+DESCRIPTION
77+ fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it
88+ previously installed. It installs bindings for both default and insert modes. fzf.fish executes
99+ it without options on fish startup to install the out-of-the-box key bindings.
1010+1111+ By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding
1212+ can be configured using a namesake corresponding option:
1313+ COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
1414+ Search Directory | Ctrl+Alt+F (F for file) | --directory
1515+ Search Git Log | Ctrl+Alt+L (L for log) | --git_log
1616+ Search Git Status | Ctrl+Alt+S (S for status) | --git_status
1717+ Search History | Ctrl+R (R for reverse) | --history
1818+ Search Processes | Ctrl+Alt+P (P for process) | --processes
1919+ Search Variables | Ctrl+V (V for variable) | --variables
2020+ Override a command's binding by specifying its corresponding option with the desired key
2121+ sequence. Disable a command's binding by specifying its corresponding option with no value.
2222+2323+ Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
2424+ executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
2525+ to your config.fish in order to persist the customized bindings.
2626+2727+ In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
2828+ equals sign between an option's name and value. However, it does not validate key sequences.
2929+3030+ Pass -h or --help to print this help message and exit.
3131+3232+EXAMPLES
3333+ Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V
3434+ \$ fzf_configure_bindings --directory=\cf --variables=\e\cv
3535+ Default bindings but disable Search History
3636+ \$ fzf_configure_bindings --history=
3737+ An agglomeration of different options
3838+ \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
3939+4040+SEE Also
4141+ To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
4242+"
4343+end
···11+# helper function for _fzf_search_variables
22+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."
33+ # Extract only the lines about the variable, all of which begin with either
44+ # $variable_name: ...or... $variable_name[
55+ string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output |
66+77+ # Strip the variable name prefix, including ": " for scope info lines
88+ string replace --regex "^\\\$$variable_name(?:: )?" '' |
99+1010+ # Distill the lines of values, replacing...
1111+ # [1]: |value|
1212+ # ...with...
1313+ # [1] value
1414+ string replace --regex ": \|(.*)\|" ' $1'
1515+end
···11+# helper for _fzf_search_git_status
22+# arg should be a line from git status --short, e.g.
33+# MM functions/_fzf_preview_changed_file.fish
44+# D README.md
55+# R LICENSE -> "New License"
66+function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file."
77+ # remove quotes because they'll be interpreted literally by git diff
88+ # no need to requote when referencing $path because fish does not perform word splitting
99+ # https://fishshell.com/docs/current/fish_for_bash_users.html
1010+ set -f path (string unescape (string sub --start 4 $path_status))
1111+ # first letter of short format shows index, second letter shows working tree
1212+ # https://git-scm.com/docs/git-status/2.35.0#_short_format
1313+ set -f index_status (string sub --length 1 $path_status)
1414+ set -f working_tree_status (string sub --start 2 --length 1 $path_status)
1515+1616+ set -f diff_opts --color=always
1717+1818+ if test $index_status = '?'
1919+ _fzf_report_diff_type Untracked
2020+ _fzf_preview_file $path
2121+ else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU
2222+ # Unmerged statuses taken directly from git status help's short format table
2323+ # Unmerged statuses are mutually exclusive with other statuses, so if we see
2424+ # these, then safe to assume the path is unmerged
2525+ _fzf_report_diff_type Unmerged
2626+ git diff $diff_opts -- $path
2727+ else
2828+ if test $index_status != ' '
2929+ _fzf_report_diff_type Staged
3030+3131+ # renames are only detected in the index, never working tree, so only need to test for it here
3232+ # https://stackoverflow.com/questions/73954214
3333+ if test $index_status = R
3434+ # diff the post-rename path with the original path, otherwise the diff will show the entire file as being added
3535+ set -f orig_and_new_path (string split --max 1 -- ' -> ' $path)
3636+ git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2]
3737+ # path currently has the form of "original -> current", so we need to correct it before it's used below
3838+ set path $orig_and_new_path[2]
3939+ else
4040+ git diff --staged $diff_opts -- $path
4141+ end
4242+ end
4343+4444+ if test $working_tree_status != ' '
4545+ _fzf_report_diff_type Unstaged
4646+ git diff $diff_opts -- $path
4747+ end
4848+ end
4949+end
···11+# helper function for _fzf_search_directory and _fzf_search_git_status
22+function _fzf_preview_file --description "Print a preview for the given file based on its file type."
33+ # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file
44+ # as one argument, we collect all the arguments into one single variable and treat that as the path
55+ set -f file_path $argv
66+77+ if test -L "$file_path" # symlink
88+ # notify user and recurse on the target of the symlink, which can be any of these file types
99+ set -l target_path (realpath "$file_path")
1010+1111+ set_color yellow
1212+ echo "'$file_path' is a symlink to '$target_path'."
1313+ set_color normal
1414+1515+ _fzf_preview_file "$target_path"
1616+ else if test -f "$file_path" # regular file
1717+ if set --query fzf_preview_file_cmd
1818+ # need to escape quotes to make sure eval receives file_path as a single arg
1919+ eval "$fzf_preview_file_cmd '$file_path'"
2020+ else
2121+ bat --style=numbers --color=always "$file_path"
2222+ end
2323+ else if test -d "$file_path" # directory
2424+ if set --query fzf_preview_dir_cmd
2525+ # see above
2626+ eval "$fzf_preview_dir_cmd '$file_path'"
2727+ else
2828+ # -A list hidden files as well, except for . and ..
2929+ # -F helps classify files by appending symbols after the file name
3030+ command ls -A -F "$file_path"
3131+ end
3232+ else if test -c "$file_path"
3333+ _fzf_report_file_type "$file_path" "character device file"
3434+ else if test -b "$file_path"
3535+ _fzf_report_file_type "$file_path" "block device file"
3636+ else if test -S "$file_path"
3737+ _fzf_report_file_type "$file_path" socket
3838+ else if test -p "$file_path"
3939+ _fzf_report_file_type "$file_path" "named pipe"
4040+ else
4141+ echo "$file_path doesn't exist." >&2
4242+ end
4343+end
···11+# helper for _fzf_preview_changed_file
22+# prints out something like
33+# ╭────────╮
44+# │ Staged │
55+# ╰────────╯
66+function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch."
77+ # number of "-" to draw is the length of the string to box + 2 for padding
88+ set -f repeat_count (math 2 + (string length $diff_type))
99+ set -f line (string repeat --count $repeat_count ─)
1010+ set -f top_border ╭$line╮
1111+ set -f btm_border ╰$line╯
1212+1313+ set_color yellow
1414+ echo $top_border
1515+ echo "│ $diff_type │"
1616+ echo $btm_border
1717+ set_color normal
1818+end
···11+# helper function for _fzf_preview_file
22+function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file."
33+ set_color red
44+ echo "Cannot preview '$file_path': it is a $file_type."
55+ set_color normal
66+end
···11+function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths."
22+ # Directly use fd binary to avoid output buffering delay caused by a fd alias, if any.
33+ # Debian-based distros install fd as fdfind and the fd package is something else, so
44+ # check for fdfind first. Fall back to "fd" for a clear error message.
55+ set -f fd_cmd (command -v fdfind || command -v fd || echo "fd")
66+ set -f --append fd_cmd --color=always $fzf_fd_opts
77+88+ set -f fzf_arguments --multi --ansi $fzf_directory_opts
99+ set -f token (commandline --current-token)
1010+ # expand any variables or leading tilde (~) in the token
1111+ set -f expanded_token (eval echo -- $token)
1212+ # unescape token because it's already quoted so backslashes will mess up the path
1313+ set -f unescaped_exp_token (string unescape -- $expanded_token)
1414+1515+ # If the current token is a directory and has a trailing slash,
1616+ # then use it as fd's base directory.
1717+ if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token"
1818+ set --append fd_cmd --base-directory=$unescaped_exp_token
1919+ # use the directory name as fzf's prompt to indicate the search is limited to that directory
2020+ set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}"
2121+ set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
2222+ else
2323+ set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}'
2424+ set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
2525+ end
2626+2727+2828+ if test $status -eq 0
2929+ commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ')
3030+ end
3131+3232+ commandline --function repaint
3333+end
···11+function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash."
22+ if not git rev-parse --git-dir >/dev/null 2>&1
33+ echo '_fzf_search_git_log: Not in a git repository.' >&2
44+ else
55+ if not set --query fzf_git_log_format
66+ # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below
77+ 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)'
88+ end
99+1010+ set -f preview_cmd 'git show --color=always --stat --patch {1}'
1111+ if set --query fzf_diff_highlighter
1212+ set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
1313+ end
1414+1515+ set -f selected_log_lines (
1616+ git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \
1717+ _fzf_wrapper --ansi \
1818+ --multi \
1919+ --scheme=history \
2020+ --prompt="Git Log> " \
2121+ --preview=$preview_cmd \
2222+ --query=(commandline --current-token) \
2323+ $fzf_git_log_opts
2424+ )
2525+ if test $status -eq 0
2626+ for line in $selected_log_lines
2727+ set -f abbreviated_commit_hash (string split --field 1 " " $line)
2828+ set -f full_commit_hash (git rev-parse $abbreviated_commit_hash)
2929+ set -f --append commit_hashes $full_commit_hash
3030+ end
3131+ commandline --current-token --replace (string join ' ' $commit_hashes)
3232+ end
3333+ end
3434+3535+ commandline --function repaint
3636+end
···11+function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths."
22+ if not git rev-parse --git-dir >/dev/null 2>&1
33+ echo '_fzf_search_git_status: Not in a git repository.' >&2
44+ else
55+ set -f preview_cmd '_fzf_preview_changed_file {}'
66+ if set --query fzf_diff_highlighter
77+ set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
88+ end
99+1010+ set -f selected_paths (
1111+ # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe
1212+ git -c color.status=always status --short |
1313+ _fzf_wrapper --ansi \
1414+ --multi \
1515+ --prompt="Git Status> " \
1616+ --query=(commandline --current-token) \
1717+ --preview=$preview_cmd \
1818+ --nth="2.." \
1919+ $fzf_git_status_opts
2020+ )
2121+ if test $status -eq 0
2222+ # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle
2323+ # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping")
2424+ set -f cleaned_paths
2525+2626+ for path in $selected_paths
2727+ if test (string sub --length 1 $path) = R
2828+ # path has been renamed and looks like "R LICENSE -> LICENSE.md"
2929+ # extract the path to use from after the arrow
3030+ set --append cleaned_paths (string split -- "-> " $path)[-1]
3131+ else
3232+ set --append cleaned_paths (string sub --start=4 $path)
3333+ end
3434+ end
3535+3636+ commandline --current-token --replace -- (string join ' ' $cleaned_paths)
3737+ end
3838+ end
3939+4040+ commandline --function repaint
4141+end
···11+function _fzf_search_history --description "Search command history. Replace the command line with the selected command."
22+ # history merge incorporates history changes from other fish sessions
33+ # it errors out if called in private mode
44+ if test -z "$fish_private_mode"
55+ builtin history merge
66+ end
77+88+ if not set --query fzf_history_time_format
99+ # Reference https://devhints.io/strftime to understand strftime format symbols
1010+ set -f fzf_history_time_format "%m-%d %H:%M:%S"
1111+ end
1212+1313+ # Delinate time from command in history entries using the vertical box drawing char (U+2502).
1414+ # Then, to get raw command from history entries, delete everything up to it. The ? on regex is
1515+ # necessary to make regex non-greedy so it won't match into commands containing the char.
1616+ set -f time_prefix_regex '^.*? │ '
1717+ # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line
1818+ set -f commands_selected (
1919+ builtin history --null --show-time="$fzf_history_time_format │ " |
2020+ _fzf_wrapper --read0 \
2121+ --print0 \
2222+ --multi \
2323+ --scheme=history \
2424+ --prompt="History> " \
2525+ --query=(commandline) \
2626+ --preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \
2727+ --preview-window="bottom:3:wrap" \
2828+ $fzf_history_opts |
2929+ string split0 |
3030+ # remove timestamps from commands selected
3131+ string replace --regex $time_prefix_regex ''
3232+ )
3333+3434+ if test $status -eq 0
3535+ commandline --replace -- $commands_selected
3636+ end
3737+3838+ commandline --function repaint
3939+end
···11+function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process."
22+ # Directly use ps command because it is often aliased to a different command entirely
33+ # or with options that dirty the search results and preview output
44+ set -f ps_cmd (command -v ps || echo "ps")
55+ # use all caps to be consistent with ps default format
66+ # snake_case because ps doesn't seem to allow spaces in the field names
77+ set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command')
88+ set -f processes_selected (
99+ $ps_cmd -A -opid,command | \
1010+ _fzf_wrapper --multi \
1111+ --prompt="Processes> " \
1212+ --query (commandline --current-token) \
1313+ --ansi \
1414+ # first line outputted by ps is a header, so we need to mark it as so
1515+ --header-lines=1 \
1616+ # ps uses exit code 1 if the process was not found, in which case show an message explaining so
1717+ --preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \
1818+ --preview-window="bottom:4:wrap" \
1919+ $fzf_processes_opts
2020+ )
2121+2222+ if test $status -eq 0
2323+ for process in $processes_selected
2424+ set -f --append pids_selected (string split --no-empty --field=1 -- " " $process)
2525+ end
2626+2727+ # string join to replace the newlines outputted by string split with spaces
2828+ commandline --current-token --replace -- (string join ' ' $pids_selected)
2929+ end
3030+3131+ commandline --function repaint
3232+end
···11+# This function expects the following two arguments:
22+# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables
33+# argument 2 = output of (set --names | psub), i.e. a file with all variable names
44+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."
55+ if test -z "$set_names_output"
66+ printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2
77+88+ commandline --function repaint
99+ return 22 # 22 means invalid argument in POSIX
1010+ end
1111+1212+ # Exclude the history variable from being piped into fzf because
1313+ # 1. it's not included in $set_names_output
1414+ # 2. it tends to be a very large value => increases computation time
1515+ # 3._fzf_search_history is a much better way to examine history anyway
1616+ set -f all_variable_names (string match --invert history <$set_names_output)
1717+1818+ set -f current_token (commandline --current-token)
1919+ # Use the current token to pre-populate fzf's query. If the current token begins
2020+ # with a $, remove it from the query so that it will better match the variable names
2121+ set -f cleaned_curr_token (string replace -- '$' '' $current_token)
2222+2323+ set -f variable_names_selected (
2424+ printf '%s\n' $all_variable_names |
2525+ _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \
2626+ --prompt="Variables> " \
2727+ --preview-window="wrap" \
2828+ --multi \
2929+ --query=$cleaned_curr_token \
3030+ $fzf_variables_opts
3131+ )
3232+3333+ if test $status -eq 0
3434+ # If the current token begins with a $, do not overwrite the $ when
3535+ # replacing the current token with the selected variable.
3636+ # Uses brace expansion to prepend $ to each variable name.
3737+ commandline --current-token --replace (
3838+ if string match --quiet -- '$*' $current_token
3939+ string join " " \${$variable_names_selected}
4040+ else
4141+ string join " " $variable_names_selected
4242+ end
4343+ )
4444+ end
4545+4646+ commandline --function repaint
4747+end
···11+function _fzf_wrapper --description "Prepares some environment variables before executing fzf."
22+ # Make sure fzf uses fish to execute preview commands, some of which
33+ # are autoloaded fish functions so don't exist in other shells.
44+ # Use --function so that it doesn't clobber SHELL outside this function.
55+ set -f --export SHELL (command --search fish)
66+77+ # If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults.
88+ # See https://github.com/junegunn/fzf#environment-variables
99+ set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE
1010+ if test $status -eq 2
1111+ # cycle allows jumping between the first and last results, making scrolling faster
1212+ # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env
1313+ # border shows where the fzf window begins and ends
1414+ # height=90% leaves space to see the current command and some scrollback, maintaining context of work
1515+ # preview-window=wrap wraps long lines in the preview window, making reading easier
1616+ # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >)
1717+ set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'
1818+ end
1919+2020+ fzf $argv
2121+end
···11+function _nvm_version_deactivate --argument-names ver
22+ test "$nvm_current_version" = "$ver" && set --erase nvm_current_version
33+ set --local index (contains --index -- $nvm_data/$ver/bin $PATH) &&
44+ set --erase PATH[$index]
55+end
+29
private_dot_config/fish/functions/bass.fish
···11+function bass
22+ set -l bash_args $argv
33+ set -l bass_debug
44+ if test "$bash_args[1]_" = '-d_'
55+ set bass_debug true
66+ set -e bash_args[1]
77+ end
88+99+ set -l script_file (mktemp)
1010+ if command -v python3 >/dev/null 2>&1
1111+ command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
1212+ else
1313+ command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
1414+ end
1515+ set -l bass_status $status
1616+ if test $bass_status -ne 0
1717+ return $bass_status
1818+ end
1919+2020+ if test -n "$bass_debug"
2121+ cat $script_file
2222+ end
2323+ source $script_file
2424+ command rm $script_file
2525+end
2626+2727+function __bass_usage
2828+ echo "Usage: bass [-d] <bash-command>"
2929+end
+4
private_dot_config/fish/functions/cat.fish
···11+function cat --wraps=bat --description 'alias cat=bat'
22+ bat $argv
33+44+end
+240
private_dot_config/fish/functions/fisher.fish
···11+function fisher --argument-names cmd --description "A plugin manager for Fish"
22+ set --query fisher_path || set --local fisher_path $__fish_config_dir
33+ set --local fisher_version 4.4.4
44+ set --local fish_plugins $__fish_config_dir/fish_plugins
55+66+ switch "$cmd"
77+ case -v --version
88+ echo "fisher, version $fisher_version"
99+ case "" -h --help
1010+ echo "Usage: fisher install <plugins...> Install plugins"
1111+ echo " fisher remove <plugins...> Remove installed plugins"
1212+ echo " fisher update <plugins...> Update installed plugins"
1313+ echo " fisher update Update all installed plugins"
1414+ echo " fisher list [<regex>] List installed plugins matching regex"
1515+ echo "Options:"
1616+ echo " -v, --version Print version"
1717+ echo " -h, --help Print this help message"
1818+ echo "Variables:"
1919+ echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
2020+ case ls list
2121+ string match --entire --regex -- "$argv[2]" $_fisher_plugins
2222+ case install update remove
2323+ isatty || read --local --null --array stdin && set --append argv $stdin
2424+2525+ set --local install_plugins
2626+ set --local update_plugins
2727+ set --local remove_plugins
2828+ set --local arg_plugins $argv[2..-1]
2929+ set --local old_plugins $_fisher_plugins
3030+ set --local new_plugins
3131+3232+ test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
3333+3434+ if ! set --query argv[2]
3535+ if test "$cmd" != update
3636+ echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
3737+ else if ! set --query file_plugins
3838+ echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
3939+ end
4040+ set arg_plugins $file_plugins
4141+ end
4242+4343+ for plugin in $arg_plugins
4444+ set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
4545+ contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
4646+ end
4747+4848+ if set --query argv[2]
4949+ for plugin in $new_plugins
5050+ if contains -- "$plugin" $old_plugins
5151+ test "$cmd" = remove &&
5252+ set --append remove_plugins $plugin ||
5353+ set --append update_plugins $plugin
5454+ else if test "$cmd" = install
5555+ set --append install_plugins $plugin
5656+ else
5757+ echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
5858+ end
5959+ end
6060+ else
6161+ for plugin in $new_plugins
6262+ contains -- "$plugin" $old_plugins &&
6363+ set --append update_plugins $plugin ||
6464+ set --append install_plugins $plugin
6565+ end
6666+6767+ for plugin in $old_plugins
6868+ contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
6969+ end
7070+ end
7171+7272+ set --local pid_list
7373+ set --local source_plugins
7474+ set --local fetch_plugins $update_plugins $install_plugins
7575+ set --local fish_path (status fish-path)
7676+7777+ echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
7878+7979+ for plugin in $fetch_plugins
8080+ set --local source (command mktemp -d)
8181+ set --append source_plugins $source
8282+8383+ command mkdir -p $source/{completions,conf.d,themes,functions}
8484+8585+ $fish_path --command "
8686+ if test -e $plugin
8787+ command cp -Rf $plugin/* $source
8888+ else
8989+ set temp (command mktemp -d)
9090+ set repo (string split -- \@ $plugin) || set repo[2] HEAD
9191+9292+ if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
9393+ set name (string split -- / \$path)[-1]
9494+ set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
9595+ else
9696+ set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
9797+ end
9898+9999+ echo Fetching (set_color --underline)\$url(set_color normal)
100100+101101+ if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
102102+ command cp -Rf \$temp/*/* $source
103103+ else
104104+ echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
105105+ command rm -rf $source
106106+ end
107107+108108+ command rm -rf \$temp
109109+ end
110110+111111+ set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
112112+ " &
113113+114114+ set --append pid_list (jobs --last --pid)
115115+ end
116116+117117+ wait $pid_list 2>/dev/null
118118+119119+ for plugin in $fetch_plugins
120120+ if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
121121+ if set --local index (contains --index -- "$plugin" $install_plugins)
122122+ set --erase install_plugins[$index]
123123+ else
124124+ set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
125125+ end
126126+ end
127127+ end
128128+129129+ for plugin in $update_plugins $remove_plugins
130130+ if set --local index (contains --index -- "$plugin" $_fisher_plugins)
131131+ set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
132132+133133+ if contains -- "$plugin" $remove_plugins
134134+ for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
135135+ emit {$name}_uninstall
136136+ end
137137+ printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
138138+ set --erase _fisher_plugins[$index]
139139+ end
140140+141141+ command rm -rf (string replace -- \~ ~ $$plugin_files_var)
142142+143143+ functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
144144+145145+ for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
146146+ complete --erase --command $name
147147+ end
148148+149149+ set --erase $plugin_files_var
150150+ end
151151+ end
152152+153153+ if set --query update_plugins[1] || set --query install_plugins[1]
154154+ command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
155155+ end
156156+157157+ for plugin in $update_plugins $install_plugins
158158+ set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
159159+ set --local files $source/{functions,themes,conf.d,completions}/*
160160+161161+ if set --local index (contains --index -- $plugin $install_plugins)
162162+ set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
163163+ set --local conflict_files
164164+165165+ for file in (string replace -- $source/ $fisher_path/ $files)
166166+ contains -- $file $user_files && set --append conflict_files $file
167167+ end
168168+169169+ if set --query conflict_files[1] && set --erase install_plugins[$index]
170170+ echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
171171+ continue
172172+ end
173173+ end
174174+175175+ for file in (string replace -- $source/ "" $files)
176176+ command cp -RLf $source/$file $fisher_path/$file
177177+ end
178178+179179+ set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
180180+181181+ set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
182182+183183+ contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
184184+ contains -- $plugin $install_plugins && set --local event install || set --local event update
185185+186186+ printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
187187+188188+ for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
189189+ source $file
190190+ if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
191191+ emit {$name}_$event
192192+ end
193193+ end
194194+ end
195195+196196+ command rm -rf $source_plugins
197197+198198+ if set --query _fisher_plugins[1]
199199+ set --local commit_plugins
200200+201201+ for plugin in $file_plugins
202202+ contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
203203+ end
204204+205205+ for plugin in $_fisher_plugins
206206+ contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
207207+ end
208208+209209+ printf "%s\n" $commit_plugins >$fish_plugins
210210+ else
211211+ set --erase _fisher_plugins
212212+ command rm -f $fish_plugins
213213+ end
214214+215215+ set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
216216+217217+ test "$total" != "0 0 0" && echo (string join ", " (
218218+ test $total[1] = 0 || echo "Installed $total[1]") (
219219+ test $total[2] = 0 || echo "Updated $total[2]") (
220220+ test $total[3] = 0 || echo "Removed $total[3]")
221221+ ) plugin/s
222222+ case \*
223223+ echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
224224+ end
225225+end
226226+227227+if ! set --query _fisher_upgraded_to_4_4
228228+ set --universal _fisher_upgraded_to_4_4
229229+ if functions --query _fisher_list
230230+ set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
231231+ command rm -rf $XDG_DATA_HOME/fisher
232232+ functions --erase _fisher_{list,plugin_parse}
233233+ fisher update >/dev/null 2>/dev/null
234234+ else
235235+ for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
236236+ set $var (string replace -- ~ \~ $$var)
237237+ end
238238+ functions --erase _fisher_fish_postexec
239239+ end
240240+end
···11+# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect
22+# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1
33+function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options."
44+ # no need to install bindings if not in interactive mode or running tests
55+ status is-interactive || test "$CI" = true; or return
66+77+ set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?'
88+ argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
99+ if test $status -ne 0
1010+ echo "Invalid option or a positional argument was provided." >&2
1111+ _fzf_configure_bindings_help
1212+ return 22
1313+ else if set --query _flag_help
1414+ _fzf_configure_bindings_help
1515+ return
1616+ else
1717+ # Initialize with default key sequences and then override or disable them based on flags
1818+ # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
1919+ set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape
2020+ set --query _flag_directory && set key_sequences[1] "$_flag_directory"
2121+ set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
2222+ set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
2323+ set --query _flag_history && set key_sequences[4] "$_flag_history"
2424+ set --query _flag_processes && set key_sequences[5] "$_flag_processes"
2525+ set --query _flag_variables && set key_sequences[6] "$_flag_variables"
2626+2727+ # If fzf bindings already exists, uninstall it first for a clean slate
2828+ if functions --query _fzf_uninstall_bindings
2929+ _fzf_uninstall_bindings
3030+ end
3131+3232+ for mode in default insert
3333+ test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory
3434+ test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
3535+ test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
3636+ test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
3737+ test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
3838+ test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
3939+ end
4040+4141+ function _fzf_uninstall_bindings --inherit-variable key_sequences
4242+ bind --erase -- $key_sequences
4343+ bind --erase --mode insert -- $key_sequences
4444+ end
4545+ end
4646+end
···11+function rvm --description='Ruby enVironment Manager'
22+ # run RVM and capture the resulting environment
33+ set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX)
44+ # 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.
55+ 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
66+77+ # apply rvm_* and *PATH variables from the captured environment
88+ 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/)//')
99+ # needed under fish >= 2.2.0
1010+ and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
1111+1212+ # clean up
1313+ rm -f $env_file
1414+end
1515+1616+function __handle_rvmrc_stuff --on-variable PWD
1717+ # Source a .rvmrc file in a directory after changing to it, if it exists.
1818+ # To disable this feature, set rvm_project_rvmrc=0 in $HOME/.rvmrc
1919+ if test "$rvm_project_rvmrc" != 0
2020+ set -l cwd $PWD
2121+ while true
2222+ if contains $cwd "" $HOME "/"
2323+ if test "$rvm_project_rvmrc_default" = 1
2424+ rvm default 1>/dev/null 2>&1
2525+ end
2626+ break
2727+ else
2828+ if test -e .rvmrc -o -e .ruby-version -o -e .ruby-gemset -o -e Gemfile
2929+ eval "rvm reload" > /dev/null
3030+ eval "rvm rvmrc load" >/dev/null
3131+ break
3232+ else
3333+ set cwd (dirname "$cwd")
3434+ end
3535+ end
3636+ end
3737+3838+ set -e cwd
3939+ end
4040+end
···11+function vim --wraps=nvim --description 'alias vim=nvim'
22+ nvim $argv
33+44+end
private_dot_config/fish/themes/.keep
This is a binary file and will not be displayed.
+45
private_dot_config/ghostty/config
···11+# This is the configuration file for Ghostty.
22+#
33+# This template file has been automatically created at the following
44+# path since Ghostty couldn't find any existing config files on your system:
55+#
66+# /home/vitorpy/.config/ghostty/config
77+#
88+# The template does not set any default options, since Ghostty ships
99+# with sensible defaults for all options. Users should only need to set
1010+# options that they want to change from the default.
1111+#
1212+# Run `ghostty +show-config --default --docs` to view a list of
1313+# all available config options and their default values.
1414+#
1515+# Additionally, each config option is also explained in detail
1616+# on Ghostty's website, at https://ghostty.org/docs/config.
1717+1818+# Config syntax crash course
1919+# ==========================
2020+# # The config file consists of simple key-value pairs,
2121+# # separated by equals signs.
2222+font-family = BerkeleyMono Nerd Font
2323+# window-padding-x = 2
2424+#
2525+# # Spacing around the equals sign does not matter.
2626+# # All of these are identical:
2727+# key=value
2828+# key= value
2929+# key =value
3030+# key = value
3131+#
3232+# # Any line beginning with a # is a comment. It's not possible to put
3333+# # a comment after a config option, since it would be interpreted as a
3434+# # part of the value. For example, this will have a value of "#123abc":
3535+# background = #123abc
3636+#
3737+# # Empty values are used to reset config keys to default.
3838+# key =
3939+#
4040+# # Some config options have unique syntaxes for their value,
4141+# # which is explained in the docs for that config option.
4242+# # Just for example:
4343+# resize-overlay-duration = 4s 200ms
4444+theme = Zenburn
4545+keybind = shift+enter=text:\x1b\r