From d8eb4fad8a1828f61f9c34a30a93cbf97a92f12a Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Sun, 1 Jan 2023 22:19:47 -0500 Subject: [PATCH] cleanup fish --- config/fish/completions/fisher.fish | 7 - .../completions/fzf_configure_bindings.fish | 7 - config/fish/completions/nvm.fish | 21 -- config/fish/conf.d/fish-ssh-agent.fish | 7 - config/fish/conf.d/fzf.fish | 28 -- config/fish/conf.d/hydro.fish | 136 ---------- config/fish/conf.d/nvm.fish | 28 -- config/fish/config.fish | 4 +- config/fish/fish_plugins | 6 - config/fish/fish_variables | 54 ---- .../functions/__ssh_agent_is_started.fish | 14 - config/fish/functions/__ssh_agent_start.fish | 5 - .../_fzf_configure_bindings_help.fish | 43 ---- .../fish/functions/_fzf_extract_var_info.fish | 15 -- .../functions/_fzf_preview_changed_file.fish | 38 --- config/fish/functions/_fzf_preview_file.fish | 43 ---- .../fish/functions/_fzf_report_diff_type.fish | 16 -- .../fish/functions/_fzf_report_file_type.fish | 6 - .../fish/functions/_fzf_search_directory.fish | 44 ---- .../fish/functions/_fzf_search_git_log.fish | 28 -- .../functions/_fzf_search_git_status.fish | 34 --- .../fish/functions/_fzf_search_history.fish | 30 --- .../fish/functions/_fzf_search_processes.fish | 28 -- .../fish/functions/_fzf_search_variables.fish | 46 ---- config/fish/functions/_fzf_wrapper.fish | 20 -- config/fish/functions/_nvm_index_update.fish | 20 -- config/fish/functions/_nvm_list.fish | 11 - .../fish/functions/_nvm_version_activate.fish | 4 - .../functions/_nvm_version_deactivate.fish | 5 - config/fish/functions/cless.fish | 10 - config/fish/functions/dots.fish | 3 - config/fish/functions/fish_mode_prompt.fish | 21 -- config/fish/functions/fish_prompt.fish | 3 - .../functions/fish_user_key_bindings.fish | 3 - config/fish/functions/fisher.fish | 240 ------------------ .../functions/fzf_configure_bindings.fish | 46 ---- config/fish/functions/fzf_key_bindings.fish | 1 - config/fish/functions/man.fish | 21 -- config/fish/functions/nvm.fish | 230 ----------------- config/nvim/init.vim | 5 +- gitconfig | 2 +- hosts/ts-tl-mbp/default.nix | 43 +++- 42 files changed, 35 insertions(+), 1341 deletions(-) delete mode 100644 config/fish/completions/fisher.fish delete mode 100644 config/fish/completions/fzf_configure_bindings.fish delete mode 100644 config/fish/completions/nvm.fish delete mode 100644 config/fish/conf.d/fish-ssh-agent.fish delete mode 100644 config/fish/conf.d/fzf.fish delete mode 100644 config/fish/conf.d/hydro.fish delete mode 100644 config/fish/conf.d/nvm.fish delete mode 100644 config/fish/fish_plugins delete mode 100644 config/fish/fish_variables delete mode 100644 config/fish/functions/__ssh_agent_is_started.fish delete mode 100644 config/fish/functions/__ssh_agent_start.fish delete mode 100644 config/fish/functions/_fzf_configure_bindings_help.fish delete mode 100644 config/fish/functions/_fzf_extract_var_info.fish delete mode 100644 config/fish/functions/_fzf_preview_changed_file.fish delete mode 100644 config/fish/functions/_fzf_preview_file.fish delete mode 100644 config/fish/functions/_fzf_report_diff_type.fish delete mode 100644 config/fish/functions/_fzf_report_file_type.fish delete mode 100644 config/fish/functions/_fzf_search_directory.fish delete mode 100644 config/fish/functions/_fzf_search_git_log.fish delete mode 100644 config/fish/functions/_fzf_search_git_status.fish delete mode 100644 config/fish/functions/_fzf_search_history.fish delete mode 100644 config/fish/functions/_fzf_search_processes.fish delete mode 100644 config/fish/functions/_fzf_search_variables.fish delete mode 100644 config/fish/functions/_fzf_wrapper.fish delete mode 100644 config/fish/functions/_nvm_index_update.fish delete mode 100644 config/fish/functions/_nvm_list.fish delete mode 100644 config/fish/functions/_nvm_version_activate.fish delete mode 100644 config/fish/functions/_nvm_version_deactivate.fish delete mode 100644 config/fish/functions/cless.fish delete mode 100644 config/fish/functions/dots.fish delete mode 100644 config/fish/functions/fish_mode_prompt.fish delete mode 100644 config/fish/functions/fish_prompt.fish delete mode 100644 config/fish/functions/fish_user_key_bindings.fish delete mode 100644 config/fish/functions/fisher.fish delete mode 100644 config/fish/functions/fzf_configure_bindings.fish delete mode 120000 config/fish/functions/fzf_key_bindings.fish delete mode 100644 config/fish/functions/man.fish delete mode 100644 config/fish/functions/nvm.fish diff --git a/config/fish/completions/fisher.fish b/config/fish/completions/fisher.fish deleted file mode 100644 index 6d23ce4..0000000 --- a/config/fish/completions/fisher.fish +++ /dev/null @@ -1,7 +0,0 @@ -complete --command fisher --exclusive --long help --description "Print help" -complete --command fisher --exclusive --long version --description "Print version" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" -complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)" diff --git a/config/fish/completions/fzf_configure_bindings.fish b/config/fish/completions/fzf_configure_bindings.fish deleted file mode 100644 index a78fd54..0000000 --- a/config/fish/completions/fzf_configure_bindings.fish +++ /dev/null @@ -1,7 +0,0 @@ -complete fzf_configure_bindings --no-files -complete fzf_configure_bindings --long help --short h --description "Print help" -complete fzf_configure_bindings --long directory --description "Change the key binding for searching directory" -complete fzf_configure_bindings --long git_log --description "Change the key binding for searching git log" -complete fzf_configure_bindings --long git_status --description "Change the key binding for searching git status" -complete fzf_configure_bindings --long history --description "Change the key binding for searching history" -complete fzf_configure_bindings --long variables --description "Change the key binding for searching variables" diff --git a/config/fish/completions/nvm.fish b/config/fish/completions/nvm.fish deleted file mode 100644 index c0ab183..0000000 --- a/config/fish/completions/nvm.fish +++ /dev/null @@ -1,21 +0,0 @@ -complete --command nvm --exclusive -complete --command nvm --exclusive --long version --description "Print version" -complete --command nvm --exclusive --long help --description "Print help" -complete --command nvm --long silent --description "Suppress standard output" - -complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version" -complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate a version in the current shell" -complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed versions" -complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List versions available to install matching optional regex" -complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active version" -complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "( - test -e $nvm_data && string split ' ' <$nvm_data/.index -)" -complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')" -complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall a version" -complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "( - _nvm_list | string split ' ' | string replace system '' -)" -complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use uninstall" --arguments "( - set --query nvm_default_version && echo default -)" diff --git a/config/fish/conf.d/fish-ssh-agent.fish b/config/fish/conf.d/fish-ssh-agent.fish deleted file mode 100644 index 719087a..0000000 --- a/config/fish/conf.d/fish-ssh-agent.fish +++ /dev/null @@ -1,7 +0,0 @@ -if test -z "$SSH_ENV" - set -xg SSH_ENV $HOME/.ssh/environment -end - -if not __ssh_agent_is_started - __ssh_agent_start -end diff --git a/config/fish/conf.d/fzf.fish b/config/fish/conf.d/fzf.fish deleted file mode 100644 index 8156c11..0000000 --- a/config/fish/conf.d/fzf.fish +++ /dev/null @@ -1,28 +0,0 @@ -# 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 -if not status is-interactive && test "$CI" != true - exit -end - -# Because of scoping rules, to capture the shell variables exactly as they are, we must read -# them before even executing _fzf_search_variables. We use psub to store the -# variables' info in temporary files and pass in the filenames as arguments. -# This variable is global so that it can be referenced by fzf_configure_bindings and in tests -set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' - - -# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings -fzf_configure_bindings - -# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased -function _fzf_uninstall --on-event fzf_uninstall - _fzf_uninstall_bindings - - set --erase _fzf_search_vars_command - functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings - complete --erase fzf_configure_bindings - - set_color cyan - echo "fzf.fish uninstalled." - echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." - set_color normal -end diff --git a/config/fish/conf.d/hydro.fish b/config/fish/conf.d/hydro.fish deleted file mode 100644 index 4c272cc..0000000 --- a/config/fish/conf.d/hydro.fish +++ /dev/null @@ -1,136 +0,0 @@ -status is-interactive || exit - -set --global _hydro_git _hydro_git_$fish_pid - -function $_hydro_git --on-variable $_hydro_git - commandline --function repaint -end - -function _hydro_pwd --on-variable PWD --on-variable hydro_ignored_git_paths --on-variable fish_prompt_pwd_dir_length - set --local git_root (command git --no-optional-locks rev-parse --show-toplevel 2>/dev/null) - set --local git_base (string replace --all --regex -- "^.*/" "" "$git_root") - set --local path_sep / - - test "$fish_prompt_pwd_dir_length" = 0 && set path_sep - - if set --query git_root[1] && ! contains -- $git_root $hydro_ignored_git_paths - set --erase _hydro_skip_git_prompt - else - set --global _hydro_skip_git_prompt - end - - set --global _hydro_pwd ( - string replace --ignore-case -- ~ \~ $PWD | - string replace -- "/$git_base/" /:/ | - string replace --regex --all -- "(\.?[^/]{"( - string replace --regex --all -- '^$' 1 "$fish_prompt_pwd_dir_length" - )"})[^/]*/" "\$1$path_sep" | - string replace -- : "$git_base" | - string replace --regex -- '([^/]+)$' "\x1b[1m\$1\x1b[22m" | - string replace --regex --all -- '(?!^/$)/|^$' "\x1b[2m/\x1b[22m" - ) -end - -function _hydro_postexec --on-event fish_postexec - set --local last_status $pipestatus - set --global _hydro_status "$_hydro_newline$_hydro_color_prompt$hydro_symbol_prompt" - - for code in $last_status - if test $code -ne 0 - set --global _hydro_status "$_hydro_color_error| "(echo $last_status)" $_hydro_newline$_hydro_color_prompt$_hydro_color_error$hydro_symbol_prompt" - break - end - end - - test "$CMD_DURATION" -lt 1000 && set _hydro_cmd_duration && return - - set --local secs (math --scale=1 $CMD_DURATION/1000 % 60) - set --local mins (math --scale=0 $CMD_DURATION/60000 % 60) - set --local hours (math --scale=0 $CMD_DURATION/3600000) - - set --local out - - test $hours -gt 0 && set --local --append out $hours"h" - test $mins -gt 0 && set --local --append out $mins"m" - test $secs -gt 0 && set --local --append out $secs"s" - - set --global _hydro_cmd_duration "$out " -end - -function _hydro_prompt --on-event fish_prompt - set --query _hydro_status || set --global _hydro_status "$_hydro_newline$_hydro_color_prompt$hydro_symbol_prompt" - set --query _hydro_pwd || _hydro_pwd - - command kill $_hydro_last_pid 2>/dev/null - - set --query _hydro_skip_git_prompt && set $_hydro_git && return - - fish --private --command " - set branch ( - command git symbolic-ref --short HEAD 2>/dev/null || - command git describe --tags --exact-match HEAD 2>/dev/null || - command git rev-parse --short HEAD 2>/dev/null | - string replace --regex -- '(.+)' '@\$1' - ) - - test -z \"\$$_hydro_git\" && set --universal $_hydro_git \"\$branch \" - - ! command git diff-index --quiet HEAD 2>/dev/null || - count (command git ls-files --others --exclude-standard) >/dev/null && set info \"$hydro_symbol_git_dirty\" - - for fetch in $hydro_fetch false - command git rev-list --count --left-right @{upstream}...@ 2>/dev/null | - read behind ahead - - switch \"\$behind \$ahead\" - case \" \" \"0 0\" - case \"0 *\" - set upstream \" $hydro_symbol_git_ahead\$ahead\" - case \"* 0\" - set upstream \" $hydro_symbol_git_behind\$behind\" - case \* - set upstream \" $hydro_symbol_git_ahead\$ahead $hydro_symbol_git_behind\$behind\" - end - - set --universal $_hydro_git \"\$branch\$info\$upstream \" - - test \$fetch = true && command git fetch --no-tags 2>/dev/null - end - " & - - set --global _hydro_last_pid (jobs --last --pid) -end - -function _hydro_fish_exit --on-event fish_exit - set --erase $_hydro_git -end - -function _hydro_uninstall --on-event hydro_uninstall - set --names | - string replace --filter --regex -- "^(_?hydro_)" "set --erase \$1" | - source - functions --erase (functions --all | string match --entire --regex "^_?hydro_") -end - -set --global hydro_color_normal (set_color normal) - -for color in hydro_color_{pwd,git,error,prompt,duration} - function $color --on-variable $color --inherit-variable color - set --query $color && set --global _$color (set_color $$color) - end && $color -end - -function hydro_multiline --on-variable hydro_multiline - if test "$hydro_multiline" = true - set --global _hydro_newline "\n" - else - set --global _hydro_newline "" - end -end && hydro_multiline - -set --query hydro_color_error || set --global hydro_color_error $fish_color_error -set --query hydro_symbol_prompt || set --global hydro_symbol_prompt ❱ -set --query hydro_symbol_git_dirty || set --global hydro_symbol_git_dirty • -set --query hydro_symbol_git_ahead || set --global hydro_symbol_git_ahead ↑ -set --query hydro_symbol_git_behind || set --global hydro_symbol_git_behind ↓ -set --query hydro_multiline || set --global hydro_multiline false diff --git a/config/fish/conf.d/nvm.fish b/config/fish/conf.d/nvm.fish deleted file mode 100644 index 8aab50a..0000000 --- a/config/fish/conf.d/nvm.fish +++ /dev/null @@ -1,28 +0,0 @@ -function _nvm_install --on-event nvm_install - set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist - set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share - set --universal nvm_data $XDG_DATA_HOME/nvm - - test ! -d $nvm_data && command mkdir -p $nvm_data - echo "Downloading the Node distribution index..." 2>/dev/null - _nvm_index_update -end - -function _nvm_update --on-event nvm_update - set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist - set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share - set --universal nvm_data $XDG_DATA_HOME/nvm -end - -function _nvm_uninstall --on-event nvm_uninstall - command rm -rf $nvm_data - - set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version - - set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source - functions --erase (functions --all | string match --entire --regex -- "^_nvm_") -end - -if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version - nvm use --silent $nvm_default_version -end diff --git a/config/fish/config.fish b/config/fish/config.fish index b7a4155..5cf019e 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -12,6 +12,6 @@ if status is-interactive set --universal hydro_color_pwd green set --universal hydro_color_git red - source ~/code/dotfiles/shell_aliases - source ~/code/dotfiles/shell_funcs.fish + # source ~/code/dotfiles/shell_aliases + # source ~/code/dotfiles/shell_funcs.fish end diff --git a/config/fish/fish_plugins b/config/fish/fish_plugins deleted file mode 100644 index 9e5301c..0000000 --- a/config/fish/fish_plugins +++ /dev/null @@ -1,6 +0,0 @@ -jorgebucaran/fisher -jorgebucaran/hydro -danhper/fish-ssh-agent -patrickf1/fzf.fish -patrickf3139/colored-man-pages -jorgebucaran/nvm.fish diff --git a/config/fish/fish_variables b/config/fish/fish_variables deleted file mode 100644 index 8df9d64..0000000 --- a/config/fish/fish_variables +++ /dev/null @@ -1,54 +0,0 @@ -# This file contains fish universal variable definitions. -# VERSION: 3.0 -SETUVAR __fish_initialized:3400 -SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:\x7e/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e\x7e/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish -SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish -SETUVAR _fisher_jorgebucaran_2F_hydro_files:\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/hydro\x2efish -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 -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 -SETUVAR _fisher_patrickf3139_2F_colored_2D_man_2D_pages_files:\x7e/\x2econfig/fish/functions/cless\x2efish\x1e\x7e/\x2econfig/fish/functions/man\x2efish -SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/hydro\x1edanhper/fish\x2dssh\x2dagent\x1epatrickf1/fzf\x2efish\x1epatrickf3139/colored\x2dman\x2dpages\x1ejorgebucaran/nvm\x2efish -SETUVAR _fisher_upgraded_to_4_4:\x1d -SETUVAR _hydro_git_14266:main\u2022\x20 -SETUVAR _hydro_git_40640:main\u2022\x20 -SETUVAR _hydro_git_69626:main\u2022\x20 -SETUVAR _hydro_git_72501:main\u2022\x20\u21911\x20 -SETUVAR _hydro_git_79475:main\u2022\x20 -SETUVAR _hydro_git_8811:main\u2022\x20 -SETUVAR _hydro_git_9276:main\u2022\x20 -SETUVAR _hydro_git_92996:main\u2022\x20 -SETUVAR _hydro_git_93415:main\u2022\x20 -SETUVAR _hydro_git_97138:main\u2022\x20 -SETUVAR fish_color_autosuggestion:555\x1ebrblack -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:005fd7 -SETUVAR fish_color_comment:990000 -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:009900 -SETUVAR fish_color_error:ff0000 -SETUVAR fish_color_escape:00a6b2 -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:00a6b2 -SETUVAR fish_color_param:00afff -SETUVAR fish_color_quote:999900 -SETUVAR fish_color_redirection:00afff -SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:\x1d -SETUVAR fish_pager_color_description:B3A06D\x1eyellow -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_pager_color_selected_background:\x2dr -SETUVAR fish_user_paths:/opt/homebrew/bin\x1e/Users/tyrel\x2esouza/\x2efzf/bin -SETUVAR hydro_color_git:red -SETUVAR hydro_color_pwd:green -SETUVAR nvm_data:/Users/tyrel\x2esouza/\x2elocal/share/nvm -SETUVAR nvm_mirror:https\x3a//nodejs\x2eorg/dist diff --git a/config/fish/functions/__ssh_agent_is_started.fish b/config/fish/functions/__ssh_agent_is_started.fish deleted file mode 100644 index 7d481ee..0000000 --- a/config/fish/functions/__ssh_agent_is_started.fish +++ /dev/null @@ -1,14 +0,0 @@ -function __ssh_agent_is_started -d "check if ssh agent is already started" - if begin; test -f $SSH_ENV; and test -z "$SSH_AGENT_PID"; end - source $SSH_ENV > /dev/null - end - - if begin; test -z "$SSH_AGENT_PID"; and test -z "$SSH_CONNECTION"; end - return 1 - end - - ssh-add -l > /dev/null 2>&1 - if test $status -eq 2 - return 1 - end -end diff --git a/config/fish/functions/__ssh_agent_start.fish b/config/fish/functions/__ssh_agent_start.fish deleted file mode 100644 index 3766fe4..0000000 --- a/config/fish/functions/__ssh_agent_start.fish +++ /dev/null @@ -1,5 +0,0 @@ -function __ssh_agent_start -d "start a new ssh agent" - ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV - chmod 600 $SSH_ENV - source $SSH_ENV > /dev/null -end diff --git a/config/fish/functions/_fzf_configure_bindings_help.fish b/config/fish/functions/_fzf_configure_bindings_help.fish deleted file mode 100644 index 1209e49..0000000 --- a/config/fish/functions/_fzf_configure_bindings_help.fish +++ /dev/null @@ -1,43 +0,0 @@ -function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings." - echo "\ -USAGE: - fzf_configure_bindings [--FEATURE[=KEY_SEQUENCE]...] - -DESCRIPTION - By default, fzf_configure_bindings installs mnemonic key bindings for fzf.fish's features. Each - feature's binding can be customized through a corresponding namesake option: - FEATURE | MNEMONIC KEY SEQUENCE | CORRESPONDING OPTION - Search directory | Ctrl+Alt+F (F for file) | --directory - Search git log | Ctrl+Alt+L (L for log) | --git_log - Search git status | Ctrl+Alt+S (S for status) | --git_status - Search history | Ctrl+R (R for reverse) | --history - Search variables | Ctrl+V (V for variable) | --variables - Search processes | Ctrl+Alt+P (P for process) | --processes - An option with a key sequence value overrides the binding for its feature, while an option - without a value disables the binding. A feature that is not customized retains its default - menomonic binding specified above. Key bindings are installed for default and insert modes. - - In terms of validation, fzf_configure_bindings fails if passed unknown options. Furthermore, it - expects an equals sign between an option's name and value. However, it does not validate key - sequences. Rather, consider using fish_key_reader to manually validate them. - - In terms of experimentation, fzf_configure_bindings erases any bindings it previously installed - before installing new ones so it can be repeatedly executed in the same fish session without - problem. Once the desired fzf_configure_bindings command has been found, add it to config.fish - in order to persist the bindings. - - The -h and --help options print this help message. - -EXAMPLES - Install the default mnemonic bindings - \$ fzf_configure_bindings - Install the default bindings but override git log's binding to Ctrl+G - \$ fzf_configure_bindings --git_log=\cg - Install the default bindings but leave search history unbound - \$ fzf_configure_bindings --history - Alternative style of disabling search history - \$ fzf_configure_bindings --history= - An agglomeration of all the options - \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables --directory --git_log -" -end diff --git a/config/fish/functions/_fzf_extract_var_info.fish b/config/fish/functions/_fzf_extract_var_info.fish deleted file mode 100644 index dd4e952..0000000 --- a/config/fish/functions/_fzf_extract_var_info.fish +++ /dev/null @@ -1,15 +0,0 @@ -# helper function for _fzf_search_variables -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." - # Extract only the lines about the variable, all of which begin with either - # $variable_name: ...or... $variable_name[ - string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output | - - # Strip the variable name prefix, including ": " for scope info lines - string replace --regex "^\\\$$variable_name(?:: )?" '' | - - # Distill the lines of values, replacing... - # [1]: |value| - # ...with... - # [1] value - string replace --regex ": \|(.*)\|" ' $1' -end diff --git a/config/fish/functions/_fzf_preview_changed_file.fish b/config/fish/functions/_fzf_preview_changed_file.fish deleted file mode 100644 index e22139f..0000000 --- a/config/fish/functions/_fzf_preview_changed_file.fish +++ /dev/null @@ -1,38 +0,0 @@ -# helper for _fzf_search_git_status -# arg should be a line from git status --short, e.g. -# MM functions/_fzf_preview_changed_file.fish -# D README.md -# R LICENSE.md -> LICENSE -function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file." - # remove quotes because they'll be interpreted literally by git diff - # no need to requote when referencing $path because fish does not perform word splitting - # https://fishshell.com/docs/current/fish_for_bash_users.html - set -l path (string unescape (string sub --start 4 $path_status)) - # first letter of short format shows index, second letter shows working tree - # https://git-scm.com/docs/git-status/2.35.0#_short_format - set -l index_status (string sub --length 1 $path_status) - set -l working_tree_status (string sub --start 2 --length 1 $path_status) - # no-prefix because the file is always being compared to itself so is unecessary - set diff_opts --color=always --no-prefix - - if test $index_status = '?' - _fzf_report_diff_type Untracked - _fzf_preview_file $path - else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU - # Unmerged statuses taken directly from git status help's short format table - # Unmerged statuses are mutually exclusive with other statuses, so if we see - # these, then safe to assume the path is unmerged - _fzf_report_diff_type Unmerged - git diff $diff_opts -- $path - else - if test $index_status != ' ' - _fzf_report_diff_type Staged - git diff --staged $diff_opts -- $path - end - - if test $working_tree_status != ' ' - _fzf_report_diff_type Unstaged - git diff $diff_opts -- $path - end - end -end diff --git a/config/fish/functions/_fzf_preview_file.fish b/config/fish/functions/_fzf_preview_file.fish deleted file mode 100644 index eaa68d0..0000000 --- a/config/fish/functions/_fzf_preview_file.fish +++ /dev/null @@ -1,43 +0,0 @@ -# helper function for _fzf_search_directory and _fzf_search_git_status -function _fzf_preview_file --description "Print a preview for the given file based on its file type." - # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file - # as one argument, we collect all the arguments into one single variable and treat that as the path - set file_path $argv - - if test -L "$file_path" # symlink - # notify user and recurse on the target of the symlink, which can be any of these file types - set -l target_path (realpath "$file_path") - - set_color yellow - echo "'$file_path' is a symlink to '$target_path'." - set_color normal - - _fzf_preview_file "$target_path" - else if test -f "$file_path" # regular file - if set --query fzf_preview_file_cmd - # need to escape quotes to make sure eval receives file_path as a single arg - eval "$fzf_preview_file_cmd '$file_path'" - else - bat --style=numbers --color=always "$file_path" - end - else if test -d "$file_path" # directory - if set --query fzf_preview_dir_cmd - # see above - eval "$fzf_preview_dir_cmd '$file_path'" - else - # -A list hidden files as well, except for . and .. - # -F helps classify files by appending symbols after the file name - command ls -A -F "$file_path" - end - else if test -c "$file_path" - _fzf_report_file_type "$file_path" "character device file" - else if test -b "$file_path" - _fzf_report_file_type "$file_path" "block device file" - else if test -S "$file_path" - _fzf_report_file_type "$file_path" socket - else if test -p "$file_path" - _fzf_report_file_type "$file_path" "named pipe" - else - echo "$file_path doesn't exist." >&2 - end -end diff --git a/config/fish/functions/_fzf_report_diff_type.fish b/config/fish/functions/_fzf_report_diff_type.fish deleted file mode 100644 index 1edef78..0000000 --- a/config/fish/functions/_fzf_report_diff_type.fish +++ /dev/null @@ -1,16 +0,0 @@ -# helper for _fzf_preview_changed_file -# prints out something like -# +--------+ -# | Staged | -# +--------+ -function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch." - # number of "-" to draw is the length of the string to box + 2 for padding - set repeat_count (math 2 + (string length $diff_type)) - set horizontal_border +(string repeat --count $repeat_count -)+ - - set_color yellow - echo $horizontal_border - echo "| $diff_type |" - echo $horizontal_border - set_color normal -end diff --git a/config/fish/functions/_fzf_report_file_type.fish b/config/fish/functions/_fzf_report_file_type.fish deleted file mode 100644 index 49e02e1..0000000 --- a/config/fish/functions/_fzf_report_file_type.fish +++ /dev/null @@ -1,6 +0,0 @@ -# helper function for _fzf_preview_file -function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file." - set_color red - echo "Cannot preview '$file_path': it is a $file_type." - set_color normal -end diff --git a/config/fish/functions/_fzf_search_directory.fish b/config/fish/functions/_fzf_search_directory.fish deleted file mode 100644 index fee6308..0000000 --- a/config/fish/functions/_fzf_search_directory.fish +++ /dev/null @@ -1,44 +0,0 @@ -function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths." - # --string-cwd-prefix prevents fd >= 8.3.0 from prepending ./ to relative paths - set fd_opts --color=always --strip-cwd-prefix $fzf_fd_opts - - set fzf_arguments --multi --ansi $fzf_dir_opts - set token (commandline --current-token) - # expand any variables or leading tilde (~) in the token - set expanded_token (eval echo -- $token) - # unescape token because it's already quoted so backslashes will mess up the path - set unescaped_exp_token (string unescape -- $expanded_token) - - # If the current token is a directory and has a trailing slash, - # then use it as fd's base directory. - if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token" - set --append fd_opts --base-directory=$unescaped_exp_token - # use the directory name as fzf's prompt to indicate the search is limited to that directory - set --prepend fzf_arguments --prompt="$unescaped_exp_token" --preview="_fzf_preview_file $expanded_token{}" - set file_paths_selected $unescaped_exp_token(fd $fd_opts 2>/dev/null | _fzf_wrapper $fzf_arguments) - else - set --prepend fzf_arguments --query="$unescaped_exp_token" --preview='_fzf_preview_file {}' - set file_paths_selected (fd $fd_opts 2>/dev/null | _fzf_wrapper $fzf_arguments) - end - - - if test $status -eq 0 - # Fish will cd implicitly if a directory name ending in a slash is provided. - # To help the user leverage this feature, we automatically append / to the selected path if - # - only one path was selected, - # - the user was in the middle of inputting the first token, - # - the path is a directory - # Then, the user only needs to hit Enter once more to cd into that directory. - if test (count $file_paths_selected) = 1 - set commandline_tokens (commandline --tokenize) - if test "$commandline_tokens" = "$token" -a -d "$file_paths_selected" \ - -a (fd --version | string replace --regex --all '[^\d]' '') -lt 840 - set file_paths_selected $file_paths_selected/ - end - end - - commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ') - end - - commandline --function repaint -end diff --git a/config/fish/functions/_fzf_search_git_log.fish b/config/fish/functions/_fzf_search_git_log.fish deleted file mode 100644 index 3375c1d..0000000 --- a/config/fish/functions/_fzf_search_git_log.fish +++ /dev/null @@ -1,28 +0,0 @@ -function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash." - if not git rev-parse --git-dir >/dev/null 2>&1 - echo '_fzf_search_git_log: Not in a git repository.' >&2 - else - # see documentation for git format placeholders at https://git-scm.com/docs/git-log#Documentation/git-log.txt-emnem - # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below - set log_fmt_str '%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)' - set selected_log_lines ( - git log --color=always --format=format:$log_fmt_str --date=short | \ - _fzf_wrapper --ansi \ - --multi \ - --tiebreak=index \ - --preview='git show --color=always --stat --patch {1}' \ - --query=(commandline --current-token) \ - $fzf_git_log_opts - ) - if test $status -eq 0 - for line in $selected_log_lines - set abbreviated_commit_hash (string split --field 1 " " $line) - set full_commit_hash (git rev-parse $abbreviated_commit_hash) - set --append commit_hashes $full_commit_hash - end - commandline --current-token --replace (string join ' ' $commit_hashes) - end - end - - commandline --function repaint -end diff --git a/config/fish/functions/_fzf_search_git_status.fish b/config/fish/functions/_fzf_search_git_status.fish deleted file mode 100644 index f8ae375..0000000 --- a/config/fish/functions/_fzf_search_git_status.fish +++ /dev/null @@ -1,34 +0,0 @@ -function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths." - if not git rev-parse --git-dir >/dev/null 2>&1 - echo '_fzf_search_git_status: Not in a git repository.' >&2 - else - set selected_paths ( - # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe - git -c color.status=always status --short | - _fzf_wrapper --ansi \ - --multi \ - --query=(commandline --current-token) \ - --preview='_fzf_preview_changed_file {}' \ - $fzf_git_status_opts - ) - if test $status -eq 0 - # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle - # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") - set cleaned_paths - - for path in $selected_paths - if test (string sub --length 1 $path) = R - # path has been renamed and looks like "R LICENSE -> LICENSE.md" - # extract the path to use from after the arrow - set --append cleaned_paths (string split -- "-> " $path)[-1] - else - set --append cleaned_paths (string sub --start=4 $path) - end - end - - commandline --current-token --replace -- (string join ' ' $cleaned_paths) - end - end - - commandline --function repaint -end diff --git a/config/fish/functions/_fzf_search_history.fish b/config/fish/functions/_fzf_search_history.fish deleted file mode 100644 index d795c5c..0000000 --- a/config/fish/functions/_fzf_search_history.fish +++ /dev/null @@ -1,30 +0,0 @@ -function _fzf_search_history --description "Search command history. Replace the command line with the selected command." - # history merge incorporates history changes from other fish sessions - # it errors out if called in private mode - if test -z "$fish_private_mode" - builtin history merge - end - - # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line - set commands_selected ( - # Reference https://devhints.io/strftime to understand strftime format symbols - builtin history --null --show-time="%m-%d %H:%M:%S │ " | - _fzf_wrapper --read0 \ - --print0 \ - --multi \ - --tiebreak=index \ - --query=(commandline) \ - --preview="echo -- {4..} | fish_indent --ansi" \ - --preview-window="bottom:3:wrap" \ - $fzf_history_opts | - string split0 | - # remove timestamps from commands selected - string replace --regex '^\d\d-\d\d \d\d:\d\d:\d\d │ ' '' - ) - - if test $status -eq 0 - commandline --replace -- $commands_selected - end - - commandline --function repaint -end diff --git a/config/fish/functions/_fzf_search_processes.fish b/config/fish/functions/_fzf_search_processes.fish deleted file mode 100644 index e3ef59f..0000000 --- a/config/fish/functions/_fzf_search_processes.fish +++ /dev/null @@ -1,28 +0,0 @@ -function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process." - # use all caps to be consistent with ps default format - # snake_case because ps doesn't seem to allow spaces in the field names - set ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command') - set processes_selected ( - ps -A -opid,command | \ - _fzf_wrapper --multi \ - --query (commandline --current-token) \ - --ansi \ - # first line outputted by ps is a header, so we need to mark it as so - --header-lines=1 \ - # ps uses exit code 1 if the process was not found, in which case show an message explaining so - --preview="ps -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ - --preview-window="bottom:4:wrap" \ - $fzf_processes_opts - ) - - if test $status -eq 0 - for process in $processes_selected - set --append pids_selected (string split --no-empty --field=1 -- " " $process) - end - - # string join to replace the newlines outputted by string split with spaces - commandline --current-token --replace -- (string join ' ' $pids_selected) - end - - commandline --function repaint -end diff --git a/config/fish/functions/_fzf_search_variables.fish b/config/fish/functions/_fzf_search_variables.fish deleted file mode 100644 index 744f226..0000000 --- a/config/fish/functions/_fzf_search_variables.fish +++ /dev/null @@ -1,46 +0,0 @@ -# This function expects the following two arguments: -# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables -# argument 2 = output of (set --names | psub), i.e. a file with all variable names -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." - if test -z "$set_names_output" - printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2 - - commandline --function repaint - return 22 # 22 means invalid argument in POSIX - end - - # Exclude the history variable from being piped into fzf because - # 1. it's not included in $set_names_output - # 2. it tends to be a very large value => increases computation time - # 3._fzf_search_history is a much better way to examine history anyway - set all_variable_names (string match --invert history <$set_names_output) - - set current_token (commandline --current-token) - # Use the current token to pre-populate fzf's query. If the current token begins - # with a $, remove it from the query so that it will better match the variable names - set cleaned_curr_token (string replace -- '$' '' $current_token) - - set variable_names_selected ( - printf '%s\n' $all_variable_names | - _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \ - --preview-window="wrap" \ - --multi \ - --query=$cleaned_curr_token \ - $fzf_shell_vars_opts - ) - - if test $status -eq 0 - # If the current token begins with a $, do not overwrite the $ when - # replacing the current token with the selected variable. - # Uses brace expansion to prepend $ to each variable name. - commandline --current-token --replace ( - if string match --quiet -- '$*' $current_token - string join " " \${$variable_names_selected} - else - string join " " $variable_names_selected - end - ) - end - - commandline --function repaint -end diff --git a/config/fish/functions/_fzf_wrapper.fish b/config/fish/functions/_fzf_wrapper.fish deleted file mode 100644 index a928701..0000000 --- a/config/fish/functions/_fzf_wrapper.fish +++ /dev/null @@ -1,20 +0,0 @@ -function _fzf_wrapper --description "Prepares some environment variables before executing fzf." - # Make sure fzf uses fish to execute preview commands, some of which - # are autoloaded fish functions so don't exist in other shells. - # Use --local so that it doesn't clobber SHELL outside of this function. - set --local --export SHELL (command --search fish) - - # If FZF_DEFAULT_OPTS is not set, then set some sane defaults. - # See https://github.com/junegunn/fzf#environment-variables - if not set --query FZF_DEFAULT_OPTS - # cycle allows jumping between the first and last results, making scrolling faster - # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env - # border shows where the fzf window begins and ends - # height=90% leaves space to see the current command and some scrollback, maintaining context of work - # preview-window=wrap wraps long lines in the preview window, making reading easier - # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >) - set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"' - end - - fzf $argv -end diff --git a/config/fish/functions/_nvm_index_update.fish b/config/fish/functions/_nvm_index_update.fish deleted file mode 100644 index c1bbe28..0000000 --- a/config/fish/functions/_nvm_index_update.fish +++ /dev/null @@ -1,20 +0,0 @@ -function _nvm_index_update - test ! -d $nvm_data && command mkdir -p $nvm_data - - set --local index $nvm_data/.index - - if not command curl --location --silent $nvm_mirror/index.tab >$index.temp - command rm -f $index.temp - echo "nvm: Can't update index, host unavailable: \"$nvm_mirror\"" >&2 - return 1 - end - - command awk -v OFS=\t ' - /v0.9.12/ { exit } # Unsupported - NR > 1 { - print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "") - } - ' $index.temp >$index - - command rm -f $index.temp -end diff --git a/config/fish/functions/_nvm_list.fish b/config/fish/functions/_nvm_list.fish deleted file mode 100644 index fb5ab0e..0000000 --- a/config/fish/functions/_nvm_list.fish +++ /dev/null @@ -1,11 +0,0 @@ -function _nvm_list - set --local versions $nvm_data/* - set --query versions[1] && - string match --entire --regex -- (string match --regex -- "v\d.+" $versions | - string escape --style=regex | - string join "|" - ) <$nvm_data/.index - - command --all node | - string match --quiet --invert --regex -- "^$nvm_data" && echo system -end diff --git a/config/fish/functions/_nvm_version_activate.fish b/config/fish/functions/_nvm_version_activate.fish deleted file mode 100644 index f7dfef7..0000000 --- a/config/fish/functions/_nvm_version_activate.fish +++ /dev/null @@ -1,4 +0,0 @@ -function _nvm_version_activate --argument-names ver - set --global --export nvm_current_version $ver - set --prepend PATH $nvm_data/$ver/bin -end diff --git a/config/fish/functions/_nvm_version_deactivate.fish b/config/fish/functions/_nvm_version_deactivate.fish deleted file mode 100644 index 24dd36e..0000000 --- a/config/fish/functions/_nvm_version_deactivate.fish +++ /dev/null @@ -1,5 +0,0 @@ -function _nvm_version_deactivate --argument-names ver - test "$nvm_current_version" = "$ver" && set --erase nvm_current_version - set --local index (contains --index -- $nvm_data/$ver/bin $PATH) && - set --erase PATH[$index] -end diff --git a/config/fish/functions/cless.fish b/config/fish/functions/cless.fish deleted file mode 100644 index 7c4f621..0000000 --- a/config/fish/functions/cless.fish +++ /dev/null @@ -1,10 +0,0 @@ -function cless -d "Configure less to colorize styled text using environment variables before executing a command that will use less" - set -x LESS_TERMCAP_md (set_color --bold 0280A5) # start bold - set -x LESS_TERMCAP_me (set_color normal) # end bold - set -x LESS_TERMCAP_us (set_color --underline 5BA502) # start underline - set -x LESS_TERMCAP_ue (set_color normal) # end underline - set -x LESS_TERMCAP_so (set_color --reverse F0CB02) # start standout - set -x LESS_TERMCAP_se (set_color normal) # end standout - - $argv -end diff --git a/config/fish/functions/dots.fish b/config/fish/functions/dots.fish deleted file mode 100644 index b74248b..0000000 --- a/config/fish/functions/dots.fish +++ /dev/null @@ -1,3 +0,0 @@ -function dots - cd ~/code/dotfiles/ -end diff --git a/config/fish/functions/fish_mode_prompt.fish b/config/fish/functions/fish_mode_prompt.fish deleted file mode 100644 index 2b6b28c..0000000 --- a/config/fish/functions/fish_mode_prompt.fish +++ /dev/null @@ -1,21 +0,0 @@ -function fish_mode_prompt - if test "$fish_key_bindings" != fish_default_key_bindings - set --local vi_mode_color - set --local vi_mode_symbol - switch $fish_bind_mode - case default - set vi_mode_color (set_color $fish_color_selection) - set vi_mode_symbol N - case insert - set vi_mode_color (set_color $fish_color_selection) - set vi_mode_symbol I - case replace replace_one - set vi_mode_color (set_color $fish_color_match) - set vi_mode_symbol R - case visual - set vi_mode_color (set_color $fish_color_match) - set vi_mode_symbol V - end - echo -e "$vi_mode_color $vi_mode_symbol \x1b[0m " - end -end diff --git a/config/fish/functions/fish_prompt.fish b/config/fish/functions/fish_prompt.fish deleted file mode 100644 index c8cf475..0000000 --- a/config/fish/functions/fish_prompt.fish +++ /dev/null @@ -1,3 +0,0 @@ -function fish_prompt --description Hydro - echo -e "$_hydro_color_pwd$_hydro_pwd$hydro_color_normal $_hydro_color_git$$_hydro_git$hydro_color_normal$_hydro_color_duration$_hydro_cmd_duration$hydro_color_normal$_hydro_status$hydro_color_normal " -end diff --git a/config/fish/functions/fish_user_key_bindings.fish b/config/fish/functions/fish_user_key_bindings.fish deleted file mode 100644 index 350a9da..0000000 --- a/config/fish/functions/fish_user_key_bindings.fish +++ /dev/null @@ -1,3 +0,0 @@ -function fish_user_key_bindings - fzf_key_bindings -end diff --git a/config/fish/functions/fisher.fish b/config/fish/functions/fisher.fish deleted file mode 100644 index a4666a1..0000000 --- a/config/fish/functions/fisher.fish +++ /dev/null @@ -1,240 +0,0 @@ -function fisher --argument-names cmd --description "A plugin manager for Fish" - set --query fisher_path || set --local fisher_path $__fish_config_dir - set --local fisher_version 4.4.2 - set --local fish_plugins $__fish_config_dir/fish_plugins - - switch "$cmd" - case -v --version - echo "fisher, version $fisher_version" - case "" -h --help - echo "Usage: fisher install Install plugins" - echo " fisher remove Remove installed plugins" - echo " fisher update Update installed plugins" - echo " fisher update Update all installed plugins" - echo " fisher list [] List installed plugins matching regex" - echo "Options:" - echo " -v or --version Print version" - echo " -h or --help Print this help message" - echo "Variables:" - echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ - case ls list - string match --entire --regex -- "$argv[2]" $_fisher_plugins - case install update remove - isatty || read --local --null --array stdin && set --append argv $stdin - - set --local install_plugins - set --local update_plugins - set --local remove_plugins - set --local arg_plugins $argv[2..-1] - set --local old_plugins $_fisher_plugins - set --local new_plugins - - test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins) - - if ! set --query argv[2] - if test "$cmd" != update - echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 - else if ! set --query file_plugins - echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 - end - set arg_plugins $file_plugins - end - - for plugin in $arg_plugins - set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin) - contains -- "$plugin" $new_plugins || set --append new_plugins $plugin - end - - if set --query argv[2] - for plugin in $new_plugins - if contains -- "$plugin" $old_plugins - test "$cmd" = remove && - set --append remove_plugins $plugin || - set --append update_plugins $plugin - else if test "$cmd" = install - set --append install_plugins $plugin - else - echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1 - end - end - else - for plugin in $new_plugins - contains -- "$plugin" $old_plugins && - set --append update_plugins $plugin || - set --append install_plugins $plugin - end - - for plugin in $old_plugins - contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin - end - end - - set --local pid_list - set --local source_plugins - set --local fetch_plugins $update_plugins $install_plugins - set --local fish_path (status fish-path) - - echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal) - - for plugin in $fetch_plugins - set --local source (command mktemp -d) - set --append source_plugins $source - - command mkdir -p $source/{completions,conf.d,themes,functions} - - $fish_path --command " - if test -e $plugin - command cp -Rf $plugin/* $source - else - set temp (command mktemp -d) - set repo (string split -- \@ $plugin) || set repo[2] HEAD - - if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) - set name (string split -- / \$path)[-1] - set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz - else - set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] - end - - echo Fetching (set_color --underline)\$url(set_color normal) - - if curl --silent -L \$url | tar -xzC \$temp -f - 2>/dev/null - command cp -Rf \$temp/*/* $source - else - echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 - command rm -rf $source - end - - command rm -rf \$temp - end - - set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files - " & - - set --append pid_list (jobs --last --pid) - end - - wait $pid_list 2>/dev/null - - for plugin in $fetch_plugins - if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source - if set --local index (contains --index -- "$plugin" $install_plugins) - set --erase install_plugins[$index] - else - set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)] - end - end - end - - for plugin in $update_plugins $remove_plugins - if set --local index (contains --index -- "$plugin" $_fisher_plugins) - set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files - - if contains -- "$plugin" $remove_plugins - for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var) - emit {$name}_uninstall - end - printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ - set --erase _fisher_plugins[$index] - end - - command rm -rf (string replace -- \~ ~ $$plugin_files_var) - - functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var) - - for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var) - complete --erase --command $name - end - - set --erase $plugin_files_var - end - end - - if set --query update_plugins[1] || set --query install_plugins[1] - command mkdir -p $fisher_path/{functions,themes,conf.d,completions} - end - - for plugin in $update_plugins $install_plugins - set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] - set --local files $source/{functions,themes,conf.d,completions}/* - - if set --local index (contains --index -- $plugin $install_plugins) - set --local user_files $fisher_path/{functions,themes,conf.d,completions}/* - set --local conflict_files - - for file in (string replace -- $source/ $fisher_path/ $files) - contains -- $file $user_files && set --append conflict_files $file - end - - if set --query conflict_files[1] && set --erase install_plugins[$index] - echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2 - continue - end - end - - for file in (string replace -- $source/ "" $files) - command cp -Rf $source/$file $fisher_path/$file - end - - set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files - - set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~) - - contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin - contains -- $plugin $install_plugins && set --local event install || set --local event update - - printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ - - for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) - source $file - if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file) - emit {$name}_$event - end - end - end - - command rm -rf $source_plugins - - if set --query _fisher_plugins[1] - set --local commit_plugins - - for plugin in $file_plugins - contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin - end - - for plugin in $_fisher_plugins - contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin - end - - printf "%s\n" $commit_plugins >$fish_plugins - else - set --erase _fisher_plugins - command rm -f $fish_plugins - end - - set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins) - - test "$total" != "0 0 0" && echo (string join ", " ( - test $total[1] = 0 || echo "Installed $total[1]") ( - test $total[2] = 0 || echo "Updated $total[2]") ( - test $total[3] = 0 || echo "Removed $total[3]") - ) plugin/s - case \* - echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1 - end -end - -if ! set --query _fisher_upgraded_to_4_4 - set --universal _fisher_upgraded_to_4_4 - if functions --query _fisher_list - set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share - command rm -rf $XDG_DATA_HOME/fisher - functions --erase _fisher_{list,plugin_parse} - fisher update >/dev/null 2>/dev/null - else - for var in (set --names | string match --entire --regex '^_fisher_.+_files$') - set $var (string replace -- ~ \~ $$var) - end - functions --erase _fisher_fish_postexec - end -end diff --git a/config/fish/functions/fzf_configure_bindings.fish b/config/fish/functions/fzf_configure_bindings.fish deleted file mode 100644 index addb55c..0000000 --- a/config/fish/functions/fzf_configure_bindings.fish +++ /dev/null @@ -1,46 +0,0 @@ -# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect -# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1 -function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options." - # no need to install bindings if not in interactive mode or running tests - status is-interactive || test "$CI" = true; or return - - set options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'variables=?' 'processes=?' - argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null - if test $status -ne 0 - echo "Invalid option or a positional argument was provided." >&2 - _fzf_configure_bindings_help - return 22 - else if set --query _flag_help - _fzf_configure_bindings_help - return - else - # Initialize with default key sequences and then override or disable them based on flags - # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = variables, 6 = processes - set key_sequences \e\cf \e\cl \e\cs \cr \cv \e\cp # \c = control, \e = escape - set --query _flag_directory && set key_sequences[1] "$_flag_directory" - set --query _flag_git_log && set key_sequences[2] "$_flag_git_log" - set --query _flag_git_status && set key_sequences[3] "$_flag_git_status" - set --query _flag_history && set key_sequences[4] "$_flag_history" - set --query _flag_variables && set key_sequences[5] "$_flag_variables" - set --query _flag_processes && set key_sequences[6] "$_flag_processes" - - # If fzf bindings already exists, uninstall it first for a clean slate - if functions --query _fzf_uninstall_bindings - _fzf_uninstall_bindings - end - - for mode in default insert - test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory - test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log - test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status - test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history - test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] "$_fzf_search_vars_command" - test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] _fzf_search_processes - end - - function _fzf_uninstall_bindings --inherit-variable key_sequences - bind --erase -- $key_sequences - bind --erase --mode insert -- $key_sequences - end - end -end diff --git a/config/fish/functions/fzf_key_bindings.fish b/config/fish/functions/fzf_key_bindings.fish deleted file mode 120000 index 92ede6d..0000000 --- a/config/fish/functions/fzf_key_bindings.fish +++ /dev/null @@ -1 +0,0 @@ -/Users/tyrel.souza/.fzf/shell/key-bindings.fish \ No newline at end of file diff --git a/config/fish/functions/man.fish b/config/fish/functions/man.fish deleted file mode 100644 index f1ab1e8..0000000 --- a/config/fish/functions/man.fish +++ /dev/null @@ -1,21 +0,0 @@ -function man --wraps man -d "Run man with added colors" - set --local --export MANPATH $MANPATH - - # special case for NetBSD and FreeBSD: set MANPATH if not already set - # see https://github.com/fish-shell/fish-shell/blob/555af37616893160ad1afb208a957d6a01a7a315/share/functions/man.fish#L15 - if test -z "$MANPATH" - if set path (command man -p 2>/dev/null) - set MANPATH (string replace --regex '[^/]+$' '' $path) - else - set MANPATH "" - end - end - - # prepend the directory of fish manpages to MANPATH - set fish_manpath $__fish_data_dir/man - if test -d $fish_manpath - set --prepend MANPATH $fish_manpath - end - - cless (command --search man) $argv -end diff --git a/config/fish/functions/nvm.fish b/config/fish/functions/nvm.fish deleted file mode 100644 index 131a030..0000000 --- a/config/fish/functions/nvm.fish +++ /dev/null @@ -1,230 +0,0 @@ -function nvm --description "Node version manager" - for silent in --silent -s - if set --local index (contains --index -- $silent $argv) - set --erase argv[$index] && break - end - set --erase silent - end - - set --local cmd $argv[1] - set --local ver $argv[2] - - if set --query silent && ! set --query cmd[1] - echo "nvm: Version number not specified (see nvm -h for usage)" >&2 - return 1 - end - - if ! set --query ver[1] && contains -- "$cmd" install use - for file in .nvmrc .node-version - set file (_nvm_find_up $PWD $file) && read ver <$file && break - end - - if ! set --query ver[1] - echo "nvm: Invalid version or missing \".nvmrc\" file" >&2 - return 1 - end - end - - set --local their_version $ver - - switch "$cmd" - case -v --version - echo "nvm, version 2.2.11" - case "" -h --help - echo "Usage: nvm install Download and activate the specified Node version" - echo " nvm install Install version from nearest .nvmrc file" - echo " nvm use Activate a version in the current shell" - echo " nvm use Activate version from nearest .nvmrc file" - echo " nvm list List installed versions" - echo " nvm list-remote List versions available to install" - echo " nvm list-remote List versions matching a given regular expression" - echo " nvm current Print the currently-active version" - echo " nvm uninstall Uninstall a version" - echo "Options:" - echo " -s or --silent Suppress standard output" - echo " -v or --version Print version" - echo " -h or --help Print this help message" - echo "Variables:" - echo " nvm_arch Override architecture, e.g. x64-musl" - echo " nvm_mirror Use a mirror of the Node binaries" - echo " nvm_default_version Set the default version for new shells" - echo " nvm_default_packages Install a list of packages every time you install a Node version" - case install - _nvm_index_update - - string match --entire --regex -- (_nvm_version_match $ver) <$nvm_data/.index | read ver alias - - if ! set --query ver[1] - echo "nvm: Invalid version number or alias: \"$their_version\"" >&2 - return 1 - end - - if test ! -e $nvm_data/$ver - set --local os (command uname -s | string lower) - set --local ext tar.gz - set --local arch (command uname -m) - - switch $os - case aix - set arch ppc64 - case sunos - case linux - case darwin - case {MSYS_NT,MINGW\*_NT}\* - set os win - set ext zip - case \* - echo "nvm: Unsupported operating system: \"$os\"" >&2 - return 1 - end - - switch $arch - case i\*86 - set arch x86 - case x86_64 - set arch x64 - case arm64 - string match --regex --quiet "v(?\d+)" $ver - if test "$os" = darwin -a $major -lt 16 - set arch x64 - end - case armv6 armv6l - set arch armv6l - case armv7 armv7l - set arch armv7l - case armv8 armv8l aarch64 - set arch arm64 - end - - set --query nvm_arch && set arch $nvm_arch - - set --local dir "node-$ver-$os-$arch" - set --local url $nvm_mirror/$ver/$dir.$ext - - command mkdir -p $nvm_data/$ver - - if ! set --query silent - echo -e "Installing Node \x1b[1m$ver\x1b[22m $alias" - echo -e "Fetching \x1b[4m$url\x1b[24m\x1b[7m" - end - - if ! command curl $silent --progress-bar --location $url | - command tar --extract --gzip --directory $nvm_data/$ver 2>/dev/null - command rm -rf $nvm_data/$ver - echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2 - return 1 - end - - set --query silent || echo -en "\033[F\33[2K\x1b[0m" - - if test "$os" = win - command mv $nvm_data/$ver/$dir $nvm_data/$ver/bin - else - command mv $nvm_data/$ver/$dir/* $nvm_data/$ver - command rm -rf $nvm_data/$ver/$dir - end - end - - if test $ver != "$nvm_current_version" - set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version - _nvm_version_activate $ver - - set --query nvm_default_packages[1] && npm install --global $silent $nvm_default_packages - end - - set --query silent || printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info) - case use - test $ver = default && set ver $nvm_default_version - _nvm_list | string match --entire --regex -- (_nvm_version_match $ver) | read ver __ - - if ! set --query ver[1] - echo "nvm: Can't use Node \"$their_version\", version must be installed first" >&2 - return 1 - end - - if test $ver != "$nvm_current_version" - set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version - test $ver != system && _nvm_version_activate $ver - end - - set --query silent || printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info) - case uninstall - if test -z "$ver" - echo "nvm: Not enough arguments for command: \"$cmd\"" >&2 - return 1 - end - - test $ver = default && test ! -z "$nvm_default_version" && set ver $nvm_default_version - - _nvm_list | string match --entire --regex -- (_nvm_version_match $ver) | read ver __ - - if ! set -q ver[1] - echo "nvm: Node version not installed or invalid: \"$their_version\"" >&2 - return 1 - end - - set --query silent || printf "Uninstalling Node %s %s\n" $ver (string replace ~ \~ "$nvm_data/$ver/bin/node") - - _nvm_version_deactivate $ver - - command rm -rf $nvm_data/$ver - case current - _nvm_current - case ls list - _nvm_list | _nvm_list_format (_nvm_current) $argv[2] - case lsr {ls,list}-remote - _nvm_index_update || return - _nvm_list | command awk ' - FILENAME == "-" && (is_local[$1] = FNR == NR) { next } { - print $0 (is_local[$1] ? " ✓" : "") - } - ' - $nvm_data/.index | _nvm_list_format (_nvm_current) $argv[2] - case \* - echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h for usage)" >&2 - return 1 - end -end - -function _nvm_find_up --argument-names path file - test -e "$path/$file" && echo $path/$file || begin - test ! -z "$path" || return - _nvm_find_up (string replace --regex -- '/[^/]*$' "" $path) $file - end -end - -function _nvm_version_match --argument-names ver - string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $ver | - string replace --filter --regex -- '^v?(\d+)' 'v$1' | - string escape --style=regex || - string lower '\b'$ver'(?:/\w+)?$' -end - -function _nvm_list_format --argument-names current regex - command awk -v current="$current" -v regex="$regex" ' - $0 ~ regex { - aliases[versions[i++] = $1] = $2 " " $3 - pad = (n = length($1)) > pad ? n : pad - } - END { - if (!i) exit 1 - while (i--) - printf((current == versions[i] ? " ▶ " : " ") "%"pad"s %s\n", - versions[i], aliases[versions[i]]) - } - ' -end - -function _nvm_current - command --search --quiet node || return - set --query nvm_current_version && echo $nvm_current_version || echo system -end - -function _nvm_node_info - set --local npm_path (string replace bin/npm-cli.js "" (realpath (command --search npm))) - test -f $npm_path/package.json || set --local npm_version_default (command npm --version) - command node --eval " - console.log(process.version) - console.log('$npm_version_default' ? '$npm_version_default': require('$npm_path/package.json').version) - console.log(process.execPath.replace(require('os').homedir(), '~')) - " -end diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 60a06d6..dba3a7d 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -48,7 +48,6 @@ map v :WhichKey set tabstop=2 -set shell=/usr/local/bin/fish set shiftwidth=2 set expandtab set hidden @@ -174,8 +173,8 @@ require'nvim-treesitter.configs'.setup { } EOF -"Guten Tags -set statusline+=%{gutentags#statusline()} +" Guten Tags +" set statusline+=%{gutentags#statusline()} " Indent Line diff --git a/gitconfig b/gitconfig index 8bc331d..6602c70 100644 --- a/gitconfig +++ b/gitconfig @@ -8,7 +8,7 @@ name = Tyrel Souza signingkey = F3614B02ACBE438E [commit] - gpgsign = true + #gpgsign = true template = /Users/tyrel/.stCommitMsg [color] ui = auto # covers diff = true, status = auto, branch = auto diff --git a/hosts/ts-tl-mbp/default.nix b/hosts/ts-tl-mbp/default.nix index ec9efa3..743e4b7 100644 --- a/hosts/ts-tl-mbp/default.nix +++ b/hosts/ts-tl-mbp/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, config, lib, ... }: { services.nix-daemon.enable = true; programs.zsh.enable = true; @@ -11,15 +11,20 @@ programs.home-manager.enable = true; home.stateVersion = "22.05"; + home.file = { + bin.source = lib.file.mkOutOfStoreSymlink "../../bin"; + }; + + + home.sessionVariables = { PAGER = "less -R"; EDITOR = "nvim"; }; home.packages = with pkgs; [ - fish ctags - htop + fzf ripgrep wget ]; @@ -27,8 +32,8 @@ programs.tmux = { enable = true; }; - home.file.".tmux".source = "../../tmux"; - home.file.".tmux.conf".source = "../../tmux.conf"; + #home.file.".tmux".source = "../../tmux"; + #home.file.".tmux.conf".source = "../../tmux.conf"; programs.git = { enable = true; @@ -53,14 +58,26 @@ }; }; - #home.file."bin".source = "../../bin"; - #home.file.".gitconfig".source = "gitconfig"; - #home.file.".gitignore".source = "../../gitignore"; - #home.file.".hushlogin".source = "../../hushlogin"; - #home.file.".pythonstartup.py".source = "../../pythonstartup.py"; - #home.file.".shell_aliases".source = "../../shell_aliases"; - #home.file.".shell_funcs".source = "../../shell_funcs"; - #home.file.".shell_funcs.fish".source = "../../shell_funcs.fish"; + programs.fish = { + enable = true; + }; + xdg.configFile = { + "fish" = { + source = ../../config/fish; + recursive = true; + }; + }; + + + programs.htop = { + enable = true; + }; + #xdg.configFile = { + # "htop" = { + # source = ../../config/htop; + # recursive = true; + # }; + #}; }; # -- HomeManager