diff --git a/fish/completions/fisher.fish b/fish/completions/fisher.fish new file mode 100644 index 0000000..6d23ce4 --- /dev/null +++ b/fish/completions/fisher.fish @@ -0,0 +1,7 @@ +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/fish/completions/ghq.fish b/fish/completions/ghq.fish new file mode 100644 index 0000000..1c6674b --- /dev/null +++ b/fish/completions/ghq.fish @@ -0,0 +1,66 @@ +function __fish_ghq_needs_command + set cmd (commandline -opc) + if [ (count $cmd) -eq 1 -a $cmd[1] = "ghq" ] + return 0 + end + return 1 +end + +function __fish_ghq_using_command + set cmd (commandline -opc) + if [ (count $cmd) -gt 1 ] + if [ $argv[1] = $cmd[2] ] + return 0 + end + end + return 1 +end + +# Help +function __fish_ghq_help_topics + for c in get list root create + printf "%s\thelp topic\n" $c + end +end + +function __fish_ghq_vcs + for c in git subversion git-svn mercurial darcs + printf "%s\tVCS\n" $c + end + printf "github\tAlias for git\n" + printf "svn\tAlias for subversion\n" + printf "hg\tAlias for mercurial\n" +end + +complete -f -c ghq -n "__fish_ghq_needs_command" -a help -d "Shows a list of commands or help for one command" +complete -f -c ghq -n "__fish_ghq_using_command help" -a "(__fish_ghq_help_topics)" + +complete -f -c ghq -n "__fish_ghq_needs_command" -a get -d "Clone/sync with a remote repository" +complete -f -c ghq -n "__fish_ghq_using_command get" -l update -s u -d "Update local repository if cloned already" +complete -f -c ghq -n "__fish_ghq_using_command get" -s p -d "Clone with SSH" +complete -f -c ghq -n "__fish_ghq_using_command get" -l shallow -d "Do a shallow clone" +complete -f -c ghq -n "__fish_ghq_using_command get" -l look -s l -d "Look after get" +complete -f -c ghq -n "__fish_ghq_using_command get" -l vcs -d "Specify VCS backend for cloning" -r -a "(__fish_ghq_vcs)" +complete -f -c ghq -n "__fish_ghq_using_command get" -l silent -s s -d "Clone or update silently" +complete -f -c ghq -n "__fish_ghq_using_command get" -l no-recursive -d "Prevent recursive fetching" +complete -f -c ghq -n "__fish_ghq_using_command get" -l branch -s b -d "Specify branch name. This flag implies --single-branch on Git" +complete -f -c ghq -n "__fish_ghq_using_command get" -l parallel -s P -d "Import parallely" +complete -f -c ghq -n "__fish_ghq_using_command get" -l help -s h -d "Show help" + +complete -f -c ghq -n "__fish_ghq_needs_command" -a list -d "List local repositories" +complete -f -c ghq -n "__fish_ghq_using_command list" -l exact -s e -d "Perform an exact match" +complete -f -c ghq -n "__fish_ghq_using_command list" -l vcs -d "Specify VCS backend for matching" -r -a "(__fish_ghq_vcs)" +complete -f -c ghq -n "__fish_ghq_using_command list" -l full-path -s p -d "Print full paths" +complete -f -c ghq -n "__fish_ghq_using_command list" -l unique -d "Print unique subpaths" +complete -f -c ghq -n "__fish_ghq_using_command list" -l help -s h -d "Show help" + +complete -f -c ghq -n "__fish_ghq_needs_command" -a root -d "Show repositories' root" +complete -f -c ghq -n "__fish_ghq_using_command root" -l all -d "Show all roots" +complete -f -c ghq -n "__fish_ghq_using_command root" -l help -s h -d "Show help" + +complete -f -c ghq -n "__fish_ghq_needs_command" -a create -d "Create a new repository" +complete -f -c ghq -n "__fish_ghq_using_command create" -l vcs -d "Specify VCS backend explicitly" -r -a "(__fish_ghq_vcs)" +complete -f -c ghq -n "__fish_ghq_using_command create" -l help -s h -d "Show help" + +complete -f -c ghq -n "__fish_ghq_needs_command" -l help -s h -d "Show help" +complete -f -c ghq -n "__fish_ghq_needs_command" -l version -s v -d "Print the version" diff --git a/fish/completions/nvm.fish b/fish/completions/nvm.fish new file mode 100644 index 0000000..14be1b7 --- /dev/null +++ b/fish/completions/nvm.fish @@ -0,0 +1,21 @@ +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 the specified Node version in the current shell" +complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed Node versions" +complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List available Node versions to install" +complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active Node 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 the specified Node 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/fish/conf.d/fish-exa.fish b/fish/conf.d/fish-exa.fish new file mode 100644 index 0000000..5ec5878 --- /dev/null +++ b/fish/conf.d/fish-exa.fish @@ -0,0 +1,95 @@ +function __fish_exa_install --on-event fish-exa_install + function _set + if not set --query --universal --export $argv[1] + set --universal --export $argv[1] $argv[2..-1] + end + end + + # Prefer eza as exa is unmaintained + if type -q eza + set -Ux __FISH_EXA_BINARY eza + else + set -Ux __FISH_EXA_BINARY exa + end + + set -Ux __FISH_EXA_BASE_ALIASES l ll lg le lt lc lo + set -Ux __FISH_EXA_EXPANDED a d i id aa ad ai aid aad aai aaid + set -Ux __FISH_EXA_EXPANDED_OPT_NAME LA LD LI LID LAA LAD LAI LAID LAAD LAAI LAAID + set -Ux __FISH_EXA_OPT_NAMES + set -Ux __FISH_EXA_ALIASES + set -Ux __FISH_EXA_SORT_OPTIONS name .name size ext mod old acc cr inode + + _set EXA_STANDARD_OPTIONS "--group" "--header" "--group-directories-first" + + # Base aliases + _set EXA_L_OPTIONS + _set EXA_LL_OPTIONS "--long" + _set EXA_LG_OPTIONS "--git" "--git-ignore" "--long" + _set EXA_LE_OPTIONS "--extended" "--long" + _set EXA_LT_OPTIONS "--tree" "--level" + _set EXA_LC_OPTIONS "--across" + _set EXA_LO_OPTIONS "--oneline" + + # Extended aliases + _set EXA_LI_OPTIONS "--icons" + _set EXA_LD_OPTIONS "--only-dirs" + _set EXA_LID_OPTIONS "--icons" "--only-dirs" + _set EXA_LA_OPTIONS "--all" "--binary" + _set EXA_LAD_OPTIONS "--all" "--binary" "--only-dirs" + _set EXA_LAI_OPTIONS "--all" "--binary" "--icons" + _set EXA_LAID_OPTIONS "--all" "--binary" "--icons" "--only-dirs" + _set EXA_LAA_OPTIONS "--all" "--all" "--binary" + _set EXA_LAAD_OPTIONS "--all" "--all" "--binary" "--only-dirs" + _set EXA_LAAI_OPTIONS "--all" "--all" "--binary" "--icons" + _set EXA_LAAID_OPTIONS "--all" "--all" "--binary" "--icons" "--only-dirs" + + for a in $__FISH_EXA_BASE_ALIASES + set -l opt_name (string join '_' "EXA" (string upper $a) "OPTIONS") + if test $a = "ll" + alias --save "$a" "exa_git" + else + alias --save "$a" "$__FISH_EXA_BINARY \$EXA_STANDARD_OPTIONS \$$opt_name" + end + set -a __FISH_EXA_OPT_NAMES "$opt_name" + set -a __FISH_EXA_ALIASES "$a" + + for i in (seq (count $__FISH_EXA_EXPANDED)) + set -l name "$a$__FISH_EXA_EXPANDED[$i]" + # --tree is useless given --all --all + if test $name = "ltaa"; or test $name = "ltaac" + continue + end + set -l exp_opt_name (string join '_' "EXA" $__FISH_EXA_EXPANDED_OPT_NAME[$i] "OPTIONS") + if string match --quiet 'll*' "$name" + alias --save "$name" "exa_git \$$exp_opt_name" + else + alias --save "$name" "$__FISH_EXA_BINARY \$EXA_STANDARD_OPTIONS \$$exp_opt_name \$$opt_name" + end + set -a __FISH_EXA_ALIASES "$name" + + if not contains $exp_opt_name $__FISH_EXA_OPT_NAMES + set -a __FISH_EXA_OPT_NAMES $exp_opt_name + end + end + end +end + +function __fish_exa_update --on-event fish-exa_update + __fish_exa_uninstall + __fish_exa_install +end + +function __fish_exa_uninstall --on-event fish-exa_uninstall + for a in $__FISH_EXA_ALIASES + functions --erase $a + funcsave $a + end + + set --erase __FISH_EXA_BASE_ALIASES + set --erase __FISH_EXA_ALIASES + set --erase __FISH_EXA_EXPANDED + set --erase __FISH_EXA_EXPANDED_OPT_NAME + set --erase __FISH_EXA_OPT_NAMES + set --erase __FISH_EXA_SORT_OPTIONS + set --erase __FISH_EXA_BINARY +end diff --git a/fish/conf.d/ghq_key_bindings.fish b/fish/conf.d/ghq_key_bindings.fish new file mode 100644 index 0000000..00e51b8 --- /dev/null +++ b/fish/conf.d/ghq_key_bindings.fish @@ -0,0 +1,4 @@ +bind \cg '__ghq_repository_search' +if bind -M insert >/dev/null 2>/dev/null + bind -M insert \cg '__ghq_repository_search' +end diff --git a/fish/conf.d/nvm.fish b/fish/conf.d/nvm.fish new file mode 100644 index 0000000..7545699 --- /dev/null +++ b/fish/conf.d/nvm.fish @@ -0,0 +1,28 @@ +set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share +set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist +set --query nvm_data || set --global nvm_data $XDG_DATA_HOME/nvm + +function _nvm_install --on-event nvm_install + 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 --universal nvm_data && set --erase --universal nvm_data + set --query --universal nvm_mirror && set --erase --universal nvm_mirror + set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist +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/fish/conf.d/z.fish b/fish/conf.d/z.fish new file mode 100644 index 0000000..59c960f --- /dev/null +++ b/fish/conf.d/z.fish @@ -0,0 +1,63 @@ +if test -z "$Z_DATA" + if test -z "$XDG_DATA_HOME" + set -U Z_DATA_DIR "$HOME/.local/share/z" + else + set -U Z_DATA_DIR "$XDG_DATA_HOME/z" + end + set -U Z_DATA "$Z_DATA_DIR/data" +end + +if test ! -e "$Z_DATA" + if test ! -e "$Z_DATA_DIR" + mkdir -p -m 700 "$Z_DATA_DIR" + end + touch "$Z_DATA" +end + +if test -z "$Z_CMD" + set -U Z_CMD z +end + +set -U ZO_CMD "$Z_CMD"o + +if test ! -z $Z_CMD + function $Z_CMD -d "jump around" + __z $argv + end +end + +if test ! -z $ZO_CMD + function $ZO_CMD -d "open target dir" + __z -d $argv + end +end + +if not set -q Z_EXCLUDE + set -U Z_EXCLUDE "^$HOME\$" +else if contains $HOME $Z_EXCLUDE + # Workaround: migrate old default values to a regex (see #90). + set Z_EXCLUDE (string replace -r -- "^$HOME\$" '^'$HOME'$$' $Z_EXCLUDE) +end + +# Setup completions once first +__z_complete + +function __z_on_variable_pwd --on-variable PWD + __z_add +end + +function __z_uninstall --on-event z_uninstall + functions -e __z_on_variable_pwd + functions -e $Z_CMD + functions -e $ZO_CMD + + if test ! -z "$Z_DATA" + printf "To completely erase z's data, remove:\n" >/dev/stderr + printf "%s\n" "$Z_DATA" >/dev/stderr + end + + set -e Z_CMD + set -e ZO_CMD + set -e Z_DATA + set -e Z_EXCLUDE +end diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..9698fc7 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,29 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +# fisher +set -Ux fish_user_paths $fish_user_paths /usr/local/bin + +# brew +set -g PATH /opt/homebrew/bin $PATH + +# mysql +set -g PATH /usr/local/mysql/bin $PATH + +# golang +set -Ux GOPATH /Users/m1ng/Documents/PF/data/go +set -Ux PATH $PATH $GOPATH/bin + +thefuck --alias | source + +function fish_greeting +echo 'Talk is cheap. Show me the code.' | lolcat -a -d 10 +end + +# pnpm +set -gx PNPM_HOME "/Users/m1ng/Library/pnpm" +if not string match -q -- $PNPM_HOME $PATH + set -gx PATH "$PNPM_HOME" $PATH +end +# pnpm end diff --git a/fish/fish_plugins b/fish/fish_plugins new file mode 100644 index 0000000..ee1f030 --- /dev/null +++ b/fish/fish_plugins @@ -0,0 +1,6 @@ +jethrokuan/z +jorgebucaran/nvm.fish +simnalamburt/shellder +decors/fish-ghq +jorgebucaran/fisher +gazorby/fish-exa diff --git a/fish/fish_variables b/fish/fish_variables new file mode 100644 index 0000000..56b47b4 --- /dev/null +++ b/fish/fish_variables @@ -0,0 +1,83 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR --export EXA_LAAD_OPTIONS:\x2d\x2dall\x1e\x2d\x2dall\x1e\x2d\x2dbinary\x1e\x2d\x2donly\x2ddirs +SETUVAR --export EXA_LAAID_OPTIONS:\x2d\x2dall\x1e\x2d\x2dall\x1e\x2d\x2dbinary\x1e\x2d\x2dicons\x1e\x2d\x2donly\x2ddirs +SETUVAR --export EXA_LAAI_OPTIONS:\x2d\x2dall\x1e\x2d\x2dall\x1e\x2d\x2dbinary\x1e\x2d\x2dicons +SETUVAR --export EXA_LAA_OPTIONS:\x2d\x2dall\x1e\x2d\x2dall\x1e\x2d\x2dbinary +SETUVAR --export EXA_LAD_OPTIONS:\x2d\x2dall\x1e\x2d\x2dbinary\x1e\x2d\x2donly\x2ddirs +SETUVAR --export EXA_LAID_OPTIONS:\x2d\x2dall\x1e\x2d\x2dbinary\x1e\x2d\x2dicons\x1e\x2d\x2donly\x2ddirs +SETUVAR --export EXA_LAI_OPTIONS:\x2d\x2dall\x1e\x2d\x2dbinary\x1e\x2d\x2dicons +SETUVAR --export EXA_LA_OPTIONS:\x2d\x2dall\x1e\x2d\x2dbinary +SETUVAR --export EXA_LC_OPTIONS:\x2d\x2dacross +SETUVAR --export EXA_LD_OPTIONS:\x2d\x2donly\x2ddirs +SETUVAR --export EXA_LE_OPTIONS:\x2d\x2dextended\x1e\x2d\x2dlong +SETUVAR --export EXA_LG_OPTIONS:\x2d\x2dgit\x1e\x2d\x2dgit\x2dignore\x1e\x2d\x2dlong +SETUVAR --export EXA_LID_OPTIONS:\x2d\x2dicons\x1e\x2d\x2donly\x2ddirs +SETUVAR --export EXA_LI_OPTIONS:\x2d\x2dicons +SETUVAR --export EXA_LL_OPTIONS:\x2d\x2dlong +SETUVAR --export EXA_LO_OPTIONS:\x2d\x2doneline +SETUVAR --export EXA_LT_OPTIONS:\x2d\x2dtree\x1e\x2d\x2dlevel +SETUVAR --export EXA_L_OPTIONS:\x1d +SETUVAR --export EXA_STANDARD_OPTIONS:\x2d\x2dgroup\x1e\x2d\x2dheader\x1e\x2d\x2dgroup\x2ddirectories\x2dfirst +SETUVAR --export --path GOPATH:/Users/m1ng/Documents/PF/data/go +SETUVAR --export --path PATH:/usr/local/mysql/bin\x1e/opt/homebrew/bin\x1e/opt/homebrew/sbin\x1e/opt/homebrew/opt/openjdk/bin\x1e/usr/local/bin\x1e/System/Cryptexes/App/usr/bin\x1e/usr/bin\x1e/bin\x1e/usr/sbin\x1e/sbin\x1e/var/run/com\x2eapple\x2esecurity\x2ecryptexd/codex\x2esystem/bootstrap/usr/local/bin\x1e/var/run/com\x2eapple\x2esecurity\x2ecryptexd/codex\x2esystem/bootstrap/usr/bin\x1e/var/run/com\x2eapple\x2esecurity\x2ecryptexd/codex\x2esystem/bootstrap/usr/appleinternal/bin\x1e/Library/Apple/usr/bin\x1e/Applications/iTerm\x2eapp/Contents/Resources/utilities\x1e/Users/m1ng/Documents/PF/data/go/bin +SETUVAR ZO_CMD:zo +SETUVAR Z_CMD:z +SETUVAR Z_DATA:/Users/m1ng/\x2elocal/share/z/data +SETUVAR Z_DATA_DIR:/Users/m1ng/\x2elocal/share/z +SETUVAR Z_EXCLUDE:\x5e/Users/m1ng\x24 +SETUVAR --export __FISH_EXA_ALIASES:l\x1ela\x1eld\x1eli\x1elid\x1elaa\x1elad\x1elai\x1elaid\x1elaad\x1elaai\x1elaaid\x1ell\x1ella\x1elld\x1elli\x1ellid\x1ellaa\x1ellad\x1ellai\x1ellaid\x1ellaad\x1ellaai\x1ellaaid\x1elg\x1elga\x1elgd\x1elgi\x1elgid\x1elgaa\x1elgad\x1elgai\x1elgaid\x1elgaad\x1elgaai\x1elgaaid\x1ele\x1elea\x1eled\x1elei\x1eleid\x1eleaa\x1elead\x1eleai\x1eleaid\x1eleaad\x1eleaai\x1eleaaid\x1elt\x1elta\x1eltd\x1elti\x1eltid\x1eltad\x1eltai\x1eltaid\x1eltaad\x1eltaai\x1eltaaid\x1elc\x1elca\x1elcd\x1elci\x1elcid\x1elcaa\x1elcad\x1elcai\x1elcaid\x1elcaad\x1elcaai\x1elcaaid\x1elo\x1eloa\x1elod\x1eloi\x1eloid\x1eloaa\x1eload\x1eloai\x1eloaid\x1eloaad\x1eloaai\x1eloaaid +SETUVAR --export __FISH_EXA_BASE_ALIASES:l\x1ell\x1elg\x1ele\x1elt\x1elc\x1elo +SETUVAR --export __FISH_EXA_BINARY:eza +SETUVAR --export __FISH_EXA_EXPANDED:a\x1ed\x1ei\x1eid\x1eaa\x1ead\x1eai\x1eaid\x1eaad\x1eaai\x1eaaid +SETUVAR --export __FISH_EXA_EXPANDED_OPT_NAME:LA\x1eLD\x1eLI\x1eLID\x1eLAA\x1eLAD\x1eLAI\x1eLAID\x1eLAAD\x1eLAAI\x1eLAAID +SETUVAR --export __FISH_EXA_OPT_NAMES:EXA_L_OPTIONS\x1eEXA_LA_OPTIONS\x1eEXA_LD_OPTIONS\x1eEXA_LI_OPTIONS\x1eEXA_LID_OPTIONS\x1eEXA_LAA_OPTIONS\x1eEXA_LAD_OPTIONS\x1eEXA_LAI_OPTIONS\x1eEXA_LAID_OPTIONS\x1eEXA_LAAD_OPTIONS\x1eEXA_LAAI_OPTIONS\x1eEXA_LAAID_OPTIONS\x1eEXA_LL_OPTIONS\x1eEXA_LG_OPTIONS\x1eEXA_LE_OPTIONS\x1eEXA_LT_OPTIONS\x1eEXA_LC_OPTIONS\x1eEXA_LO_OPTIONS +SETUVAR --export __FISH_EXA_SORT_OPTIONS:name\x1e\x2ename\x1esize\x1eext\x1emod\x1eold\x1eacc\x1ecr\x1einode +SETUVAR __fish_initialized:3800 +SETUVAR _fisher_decors_2F_fish_2D_ghq_files:\x7e/\x2econfig/fish/functions/__ghq_repository_search\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/ghq_key_bindings\x2efish\x1e\x7e/\x2econfig/fish/completions/ghq\x2efish +SETUVAR _fisher_gazorby_2F_fish_2D_exa_files:\x7e/\x2econfig/fish/functions/exa_git\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fish\x2dexa\x2efish +SETUVAR _fisher_jethrokuan_2F_z_files:\x7e/\x2econfig/fish/functions/__z\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_add\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_clean\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_complete\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/z\x2efish +SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\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_plugins:jethrokuan/z\x1ejorgebucaran/nvm\x2efish\x1esimnalamburt/shellder\x1edecors/fish\x2dghq\x1ejorgebucaran/fisher\x1egazorby/fish\x2dexa +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR fish_color_autosuggestion:777777 +SETUVAR fish_color_cancel:\x2d\x2dreverse +SETUVAR fish_color_command:00FF00 +SETUVAR fish_color_comment:30BE30 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:FF7B7B +SETUVAR fish_color_error:A40000 +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_keyword:00FF00 +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_option:30BE30 +SETUVAR fish_color_param:30BE30 +SETUVAR fish_color_quote:44FF44 +SETUVAR fish_color_redirection:7BFF7B +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_background:\x1d +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D +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_secondary_background:\x1d +SETUVAR fish_pager_color_secondary_completion:\x1d +SETUVAR fish_pager_color_secondary_description:\x1d +SETUVAR fish_pager_color_secondary_prefix:\x1d +SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack +SETUVAR fish_pager_color_selected_completion:\x1d +SETUVAR fish_pager_color_selected_description:\x1d +SETUVAR fish_pager_color_selected_prefix:\x1d +SETUVAR --export fish_user_paths:/opt/homebrew/sbin\x1e/opt/homebrew/opt/openjdk/bin\x1e/usr/local/bin diff --git a/fish/functions/__ghq_repository_search.fish b/fish/functions/__ghq_repository_search.fish new file mode 100644 index 0000000..fa19d16 --- /dev/null +++ b/fish/functions/__ghq_repository_search.fish @@ -0,0 +1,22 @@ +function __ghq_repository_search -d 'Repository search' + set -l selector + [ -n "$GHQ_SELECTOR" ]; and set selector $GHQ_SELECTOR; or set selector fzf + set -l selector_options + [ -n "$GHQ_SELECTOR_OPTS" ]; and set selector_options $GHQ_SELECTOR_OPTS + + if not type -qf $selector + printf "\nERROR: '$selector' not found.\n" + return 1 + end + + set -l query (commandline -b) + [ -n "$query" ]; and set flags --query="$query"; or set flags + switch "$selector" + case fzf fzf-tmux peco percol fzy sk + ghq list --full-path | "$selector" $selector_options $flags | read select + case \* + printf "\nERROR: plugin-ghq is not support '$selector'.\n" + end + [ -n "$select" ]; and cd "$select" + commandline -f repaint +end diff --git a/fish/functions/__z.fish b/fish/functions/__z.fish new file mode 100644 index 0000000..0b02005 --- /dev/null +++ b/fish/functions/__z.fish @@ -0,0 +1,174 @@ +function __z -d "Jump to a recent directory." + function __print_help -d "Print z help." + printf "Usage: $Z_CMD [-celrth] string1 string2...\n\n" + printf " -c --clean Removes directories that no longer exist from $Z_DATA\n" + printf " -d --dir Opens matching directory using system file manager.\n" + printf " -e --echo Prints best match, no cd\n" + printf " -l --list List matches and scores, no cd\n" + printf " -p --purge Delete all entries from $Z_DATA\n" + printf " -r --rank Search by rank\n" + printf " -t --recent Search by recency\n" + printf " -x --delete Removes the current directory from $Z_DATA\n" + printf " -h --help Print this help\n\n" + end + function __z_legacy_escape_regex + # taken from escape_string_pcre2 in fish + # used to provide compatibility with fish 2 + for c in (string split -- '' $argv) + if contains $c (string split '' '.^$*+()?[{}\\|-]') + printf \\ + end + printf '%s' $c + end + end + + set -l options h/help c/clean e/echo l/list p/purge r/rank t/recent d/directory x/delete + + argparse $options -- $argv + + if set -q _flag_help + __print_help + return 0 + else if set -q _flag_clean + __z_clean + printf "%s cleaned!\n" $Z_DATA + return 0 + else if set -q _flag_purge + echo >$Z_DATA + printf "%s purged!\n" $Z_DATA + return 0 + else if set -q _flag_delete + sed -i -e "\:^$PWD|.*:d" $Z_DATA + return 0 + end + + set -l typ + + if set -q _flag_rank + set typ rank + else if set -q _flag_recent + set typ recent + end + + set -l z_script ' + function frecent(rank, time) { + dx = t-time + if( dx < 3600 ) return rank*4 + if( dx < 86400 ) return rank*2 + if( dx < 604800 ) return rank/2 + return rank/4 + } + + function output(matches, best_match, common) { + # list or return the desired directory + if( list ) { + cmd = "sort -nr" + for( x in matches ) { + if( matches[x] ) { + printf "%-10s %s\n", matches[x], x | cmd + } + } + } else { + if( common ) best_match = common + print best_match + } + } + + function common(matches) { + # find the common root of a list of matches, if it exists + for( x in matches ) { + if( matches[x] && (!short || length(x) < length(short)) ) { + short = x + } + } + if( short == "/" ) return + for( x in matches ) if( matches[x] && index(x, short) != 1 ) { + return + } + return short + } + + BEGIN { + hi_rank = ihi_rank = -9999999999 + } + { + if( typ == "rank" ) { + rank = $2 + } else if( typ == "recent" ) { + rank = $3 - t + } else rank = frecent($2, $3) + if( $1 ~ q ) { + matches[$1] = rank + } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank + if( matches[$1] && matches[$1] > hi_rank ) { + best_match = $1 + hi_rank = matches[$1] + } else if( imatches[$1] && imatches[$1] > ihi_rank ) { + ibest_match = $1 + ihi_rank = imatches[$1] + } + } + + END { + # prefer case sensitive + if( best_match ) { + output(matches, best_match, common(matches)) + } else if( ibest_match ) { + output(imatches, ibest_match, common(imatches)) + } + } + ' + + set -l qs + for arg in $argv + set -l escaped $arg + if string escape --style=regex '' >/dev/null 2>&1 # use builtin escape if available + set escaped (string escape --style=regex -- $escaped) + else + set escaped (__z_legacy_escape_regex $escaped) + end + # Need to escape twice, see https://www.math.utah.edu/docs/info/gawk_5.html#SEC32 + set escaped (string replace --all -- \\ \\\\ $escaped) + set qs $qs $escaped + end + set -l q (string join -- '.*' $qs) + + if set -q _flag_list + # Handle list separately as it can print common path information to stderr + # which cannot be captured from a subcommand. + command awk -v t=(date +%s) -v list="list" -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA" + return + end + + set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA") + + if test "$status" -gt 0 + return + end + + if test -z "$target" + printf "'%s' did not match any results\n" "$argv" + return 1 + end + + if set -q _flag_echo + printf "%s\n" "$target" + else if set -q _flag_directory + if test -n "$ZO_METHOD" + type -q "$ZO_METHOD"; and "$ZO_METHOD" "$target"; and return $status + echo "Cannot open with ZO_METHOD set to $ZO_METHOD"; and return 1 + else if test "$OS" = Windows_NT + # Be careful, in msys2, explorer always return 1 + type -q explorer; and explorer "$target" + return 0 + echo "Cannot open file explorer" + return 1 + else + type -q xdg-open; and xdg-open "$target"; and return $status + type -q open; and open "$target"; and return $status + echo "Not sure how to open file manager"; and return 1 + end + else + pushd "$target" + end +end diff --git a/fish/functions/__z_add.fish b/fish/functions/__z_add.fish new file mode 100644 index 0000000..20d5d7e --- /dev/null +++ b/fish/functions/__z_add.fish @@ -0,0 +1,49 @@ +function __z_add -d "Add PATH to .z file" + test -n "$fish_private_mode"; and return 0 + + for i in $Z_EXCLUDE + if string match -r $i $PWD >/dev/null + return 0 #Path excluded + end + end + + set -l tmpfile (mktemp $Z_DATA.XXXXXX) + + if test -f $tmpfile + set -l path (string replace --all \\ \\\\ $PWD) + command awk -v path=$path -v now=(date +%s) -F "|" ' + BEGIN { + rank[path] = 1 + time[path] = now + } + $2 >= 1 { + if( $1 == path ) { + rank[$1] = $2 + 1 + time[$1] = now + } + else { + rank[$1] = $2 + time[$1] = $3 + } + count += $2 + } + END { + if( count > 1000 ) { + for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging + } + else for( i in rank ) print i "|" rank[i] "|" time[i] + } + ' $Z_DATA 2>/dev/null >$tmpfile + + if test ! -z "$Z_OWNER" + chown $Z_OWNER:(id -ng $Z_OWNER) $tmpfile + end + # + # Don't use redirection here as it can lead to a race condition where $Z_DATA is clobbered. + # Note: There is a still a possible race condition where an old version of $Z_DATA is + # read by one instance of Fish before another instance of Fish writes its copy. + # + command mv $tmpfile $Z_DATA + or command rm $tmpfile + end +end diff --git a/fish/functions/__z_clean.fish b/fish/functions/__z_clean.fish new file mode 100644 index 0000000..ae1721a --- /dev/null +++ b/fish/functions/__z_clean.fish @@ -0,0 +1,11 @@ +function __z_clean -d "Clean up .z file to remove paths no longer valid" + set -l tmpfile (mktemp $Z_DATA.XXXXXX) + + if test -f $tmpfile + while read line + set -l path (string split '|' $line)[1] + test -d $path; and echo $line + end <$Z_DATA >$tmpfile + command mv -f $tmpfile $Z_DATA + end +end diff --git a/fish/functions/__z_complete.fish b/fish/functions/__z_complete.fish new file mode 100644 index 0000000..a626456 --- /dev/null +++ b/fish/functions/__z_complete.fish @@ -0,0 +1,13 @@ +function __z_complete -d "add completions" + complete -c $Z_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k + complete -c $ZO_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k + + complete -c $Z_CMD -s c -l clean -d "Cleans out $Z_DATA" + complete -c $Z_CMD -s e -l echo -d "Prints best match, no cd" + complete -c $Z_CMD -s l -l list -d "List matches, no cd" + complete -c $Z_CMD -s p -l purge -d "Purges $Z_DATA" + complete -c $Z_CMD -s r -l rank -d "Searches by rank, cd" + complete -c $Z_CMD -s t -l recent -d "Searches by recency, cd" + complete -c $Z_CMD -s h -l help -d "Print help" + complete -c $Z_CMD -s x -l delete -d "Removes the current directory from $Z_DATA" +end diff --git a/fish/functions/_nvm_index_update.fish b/fish/functions/_nvm_index_update.fish new file mode 100644 index 0000000..c66753d --- /dev/null +++ b/fish/functions/_nvm_index_update.fish @@ -0,0 +1,20 @@ +function _nvm_index_update + test ! -d $nvm_data && command mkdir -p $nvm_data + + set --local index $nvm_data/.index + + if not command curl -q --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/fish/functions/_nvm_list.fish b/fish/functions/_nvm_list.fish new file mode 100644 index 0000000..1623bb8 --- /dev/null +++ b/fish/functions/_nvm_list.fish @@ -0,0 +1,14 @@ +function _nvm_list + set --local versions $nvm_data/* + + set --query versions[1] && + string match --entire --regex -- ( + string replace --all -- $nvm_data/ "" $versions | + string match --regex -- "v\d.+" | + 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/fish/functions/_nvm_version_activate.fish b/fish/functions/_nvm_version_activate.fish new file mode 100644 index 0000000..f7dfef7 --- /dev/null +++ b/fish/functions/_nvm_version_activate.fish @@ -0,0 +1,4 @@ +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/fish/functions/_nvm_version_deactivate.fish b/fish/functions/_nvm_version_deactivate.fish new file mode 100644 index 0000000..24dd36e --- /dev/null +++ b/fish/functions/_nvm_version_deactivate.fish @@ -0,0 +1,5 @@ +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/fish/functions/exa_git.fish b/fish/functions/exa_git.fish new file mode 100644 index 0000000..10fa9cc --- /dev/null +++ b/fish/functions/exa_git.fish @@ -0,0 +1,7 @@ +function exa_git -d "Use exa and its git options if in a git repo" + if git rev-parse --is-inside-work-tree &>/dev/null + $__FISH_EXA_BINARY $EXA_STANDARD_OPTIONS {$EXA_LL_OPTIONS} --git $argv + else + $__FISH_EXA_BINARY $EXA_STANDARD_OPTIONS {$EXA_LL_OPTIONS} $argv + end +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..c969ab9 --- /dev/null +++ b/fish/functions/fish_prompt.fish @@ -0,0 +1,90 @@ +function fish_prompt + set -l __last_command_exit_status $status + + if not set -q -g __fish_arrow_functions_defined + set -g __fish_arrow_functions_defined + function _git_branch_name + set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null) + if set -q branch[1] + echo (string replace -r '^refs/heads/' '' $branch) + else + echo (git rev-parse --short HEAD 2>/dev/null) + end + end + + function _is_git_dirty + not command git diff-index --cached --quiet HEAD -- &>/dev/null + or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null + end + + function _is_git_repo + type -q git + or return 1 + git rev-parse --git-dir >/dev/null 2>&1 + end + + function _hg_branch_name + echo (hg branch 2>/dev/null) + end + + function _is_hg_dirty + set -l stat (hg status -mard 2>/dev/null) + test -n "$stat" + end + + function _is_hg_repo + fish_print_hg_root >/dev/null + end + + function _repo_branch_name + _$argv[1]_branch_name + end + + function _is_repo_dirty + _is_$argv[1]_dirty + end + + function _repo_type + if _is_hg_repo + echo hg + return 0 + else if _is_git_repo + echo git + return 0 + end + return 1 + end + end + + set -l cyan (set_color -o cyan) + set -l yellow (set_color -o yellow) + set -l red (set_color -o red) + set -l green (set_color -o green) + set -l blue (set_color -o blue) + set -l normal (set_color normal) + + set -l arrow_color "$green" + if test $__last_command_exit_status != 0 + set arrow_color "$red" + end + + set -l arrow "$arrow_color➜ " + if fish_is_root_user + set arrow "$arrow_color# " + end + + set -l cwd $cyan(prompt_pwd | path basename) + + set -l repo_info + if set -l repo_type (_repo_type) + set -l repo_branch $red(_repo_branch_name $repo_type) + set repo_info "$blue $repo_type:($repo_branch$blue)" + + if _is_repo_dirty $repo_type + set -l dirty "$yellow βœ—" + set repo_info "$repo_info$dirty" + end + end + + echo -n -s $arrow ' '$cwd $repo_info $normal ' ' +end diff --git a/fish/functions/fisher.fish b/fish/functions/fisher.fish new file mode 100644 index 0000000..e915cb8 --- /dev/null +++ b/fish/functions/fisher.fish @@ -0,0 +1,240 @@ +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.5 + 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, --version Print version" + echo " -h, --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 | string replace -- \~ ~) + + 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 command curl -q --silent -L \$url | command 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 -RLf $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 + + string replace --regex -- $HOME \~ $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/fish/functions/l.fish b/fish/functions/l.fish new file mode 100644 index 0000000..d479e57 --- /dev/null +++ b/fish/functions/l.fish @@ -0,0 +1,4 @@ +function l --wraps='eza $EXA_STANDARD_OPTIONS $EXA_L_OPTIONS' --description 'alias l eza $EXA_STANDARD_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/la.fish b/fish/functions/la.fish new file mode 100644 index 0000000..1c9f993 --- /dev/null +++ b/fish/functions/la.fish @@ -0,0 +1,4 @@ +function la --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_L_OPTIONS' --description 'alias la eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/laa.fish b/fish/functions/laa.fish new file mode 100644 index 0000000..ae383ff --- /dev/null +++ b/fish/functions/laa.fish @@ -0,0 +1,4 @@ +function laa --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_L_OPTIONS' --description 'alias laa eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/laad.fish b/fish/functions/laad.fish new file mode 100644 index 0000000..236d3db --- /dev/null +++ b/fish/functions/laad.fish @@ -0,0 +1,4 @@ +function laad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_L_OPTIONS' --description 'alias laad eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/laai.fish b/fish/functions/laai.fish new file mode 100644 index 0000000..3fc1fce --- /dev/null +++ b/fish/functions/laai.fish @@ -0,0 +1,4 @@ +function laai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_L_OPTIONS' --description 'alias laai eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/laaid.fish b/fish/functions/laaid.fish new file mode 100644 index 0000000..6f034a5 --- /dev/null +++ b/fish/functions/laaid.fish @@ -0,0 +1,4 @@ +function laaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_L_OPTIONS' --description 'alias laaid eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/lad.fish b/fish/functions/lad.fish new file mode 100644 index 0000000..3af0c90 --- /dev/null +++ b/fish/functions/lad.fish @@ -0,0 +1,4 @@ +function lad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_L_OPTIONS' --description 'alias lad eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/lai.fish b/fish/functions/lai.fish new file mode 100644 index 0000000..90ce5e2 --- /dev/null +++ b/fish/functions/lai.fish @@ -0,0 +1,4 @@ +function lai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_L_OPTIONS' --description 'alias lai eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/laid.fish b/fish/functions/laid.fish new file mode 100644 index 0000000..6601f36 --- /dev/null +++ b/fish/functions/laid.fish @@ -0,0 +1,4 @@ +function laid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_L_OPTIONS' --description 'alias laid eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/lc.fish b/fish/functions/lc.fish new file mode 100644 index 0000000..20e57e7 --- /dev/null +++ b/fish/functions/lc.fish @@ -0,0 +1,4 @@ +function lc --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LC_OPTIONS' --description 'alias lc eza $EXA_STANDARD_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lca.fish b/fish/functions/lca.fish new file mode 100644 index 0000000..5112880 --- /dev/null +++ b/fish/functions/lca.fish @@ -0,0 +1,4 @@ +function lca --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LC_OPTIONS' --description 'alias lca eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcaa.fish b/fish/functions/lcaa.fish new file mode 100644 index 0000000..e6af325 --- /dev/null +++ b/fish/functions/lcaa.fish @@ -0,0 +1,4 @@ +function lcaa --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcaa eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcaad.fish b/fish/functions/lcaad.fish new file mode 100644 index 0000000..854a549 --- /dev/null +++ b/fish/functions/lcaad.fish @@ -0,0 +1,4 @@ +function lcaad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcaad eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcaai.fish b/fish/functions/lcaai.fish new file mode 100644 index 0000000..1dcc58c --- /dev/null +++ b/fish/functions/lcaai.fish @@ -0,0 +1,4 @@ +function lcaai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcaai eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcaaid.fish b/fish/functions/lcaaid.fish new file mode 100644 index 0000000..ec43967 --- /dev/null +++ b/fish/functions/lcaaid.fish @@ -0,0 +1,4 @@ +function lcaaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcaaid eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcad.fish b/fish/functions/lcad.fish new file mode 100644 index 0000000..dae56f8 --- /dev/null +++ b/fish/functions/lcad.fish @@ -0,0 +1,4 @@ +function lcad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcad eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcai.fish b/fish/functions/lcai.fish new file mode 100644 index 0000000..6074354 --- /dev/null +++ b/fish/functions/lcai.fish @@ -0,0 +1,4 @@ +function lcai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcai eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcaid.fish b/fish/functions/lcaid.fish new file mode 100644 index 0000000..1e9d873 --- /dev/null +++ b/fish/functions/lcaid.fish @@ -0,0 +1,4 @@ +function lcaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcaid eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcd.fish b/fish/functions/lcd.fish new file mode 100644 index 0000000..7ff2379 --- /dev/null +++ b/fish/functions/lcd.fish @@ -0,0 +1,4 @@ +function lcd --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcd eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lci.fish b/fish/functions/lci.fish new file mode 100644 index 0000000..69131ba --- /dev/null +++ b/fish/functions/lci.fish @@ -0,0 +1,4 @@ +function lci --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LC_OPTIONS' --description 'alias lci eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/lcid.fish b/fish/functions/lcid.fish new file mode 100644 index 0000000..8394d90 --- /dev/null +++ b/fish/functions/lcid.fish @@ -0,0 +1,4 @@ +function lcid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LC_OPTIONS' --description 'alias lcid eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LC_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LC_OPTIONS $argv + +end diff --git a/fish/functions/ld.fish b/fish/functions/ld.fish new file mode 100644 index 0000000..41d9fec --- /dev/null +++ b/fish/functions/ld.fish @@ -0,0 +1,4 @@ +function ld --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_L_OPTIONS' --description 'alias ld eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/le.fish b/fish/functions/le.fish new file mode 100644 index 0000000..4d78950 --- /dev/null +++ b/fish/functions/le.fish @@ -0,0 +1,4 @@ +function le --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LE_OPTIONS' --description 'alias le eza $EXA_STANDARD_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/lea.fish b/fish/functions/lea.fish new file mode 100644 index 0000000..b56079b --- /dev/null +++ b/fish/functions/lea.fish @@ -0,0 +1,4 @@ +function lea --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LE_OPTIONS' --description 'alias lea eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leaa.fish b/fish/functions/leaa.fish new file mode 100644 index 0000000..cfbe91e --- /dev/null +++ b/fish/functions/leaa.fish @@ -0,0 +1,4 @@ +function leaa --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LE_OPTIONS' --description 'alias leaa eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leaad.fish b/fish/functions/leaad.fish new file mode 100644 index 0000000..d197bfd --- /dev/null +++ b/fish/functions/leaad.fish @@ -0,0 +1,4 @@ +function leaad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LE_OPTIONS' --description 'alias leaad eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leaai.fish b/fish/functions/leaai.fish new file mode 100644 index 0000000..4171483 --- /dev/null +++ b/fish/functions/leaai.fish @@ -0,0 +1,4 @@ +function leaai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LE_OPTIONS' --description 'alias leaai eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leaaid.fish b/fish/functions/leaaid.fish new file mode 100644 index 0000000..e56286c --- /dev/null +++ b/fish/functions/leaaid.fish @@ -0,0 +1,4 @@ +function leaaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LE_OPTIONS' --description 'alias leaaid eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/lead.fish b/fish/functions/lead.fish new file mode 100644 index 0000000..b06f950 --- /dev/null +++ b/fish/functions/lead.fish @@ -0,0 +1,4 @@ +function lead --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LE_OPTIONS' --description 'alias lead eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leai.fish b/fish/functions/leai.fish new file mode 100644 index 0000000..ee9c629 --- /dev/null +++ b/fish/functions/leai.fish @@ -0,0 +1,4 @@ +function leai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LE_OPTIONS' --description 'alias leai eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leaid.fish b/fish/functions/leaid.fish new file mode 100644 index 0000000..ae370da --- /dev/null +++ b/fish/functions/leaid.fish @@ -0,0 +1,4 @@ +function leaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LE_OPTIONS' --description 'alias leaid eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/led.fish b/fish/functions/led.fish new file mode 100644 index 0000000..d28c2a4 --- /dev/null +++ b/fish/functions/led.fish @@ -0,0 +1,4 @@ +function led --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LE_OPTIONS' --description 'alias led eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/lei.fish b/fish/functions/lei.fish new file mode 100644 index 0000000..b9587ea --- /dev/null +++ b/fish/functions/lei.fish @@ -0,0 +1,4 @@ +function lei --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LE_OPTIONS' --description 'alias lei eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/leid.fish b/fish/functions/leid.fish new file mode 100644 index 0000000..37f0d17 --- /dev/null +++ b/fish/functions/leid.fish @@ -0,0 +1,4 @@ +function leid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LE_OPTIONS' --description 'alias leid eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LE_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LE_OPTIONS $argv + +end diff --git a/fish/functions/lg.fish b/fish/functions/lg.fish new file mode 100644 index 0000000..f2c09ce --- /dev/null +++ b/fish/functions/lg.fish @@ -0,0 +1,4 @@ +function lg --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LG_OPTIONS' --description 'alias lg eza $EXA_STANDARD_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lga.fish b/fish/functions/lga.fish new file mode 100644 index 0000000..a97bc85 --- /dev/null +++ b/fish/functions/lga.fish @@ -0,0 +1,4 @@ +function lga --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LG_OPTIONS' --description 'alias lga eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgaa.fish b/fish/functions/lgaa.fish new file mode 100644 index 0000000..b237663 --- /dev/null +++ b/fish/functions/lgaa.fish @@ -0,0 +1,4 @@ +function lgaa --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgaa eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgaad.fish b/fish/functions/lgaad.fish new file mode 100644 index 0000000..ee2ab04 --- /dev/null +++ b/fish/functions/lgaad.fish @@ -0,0 +1,4 @@ +function lgaad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgaad eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgaai.fish b/fish/functions/lgaai.fish new file mode 100644 index 0000000..d0c7418 --- /dev/null +++ b/fish/functions/lgaai.fish @@ -0,0 +1,4 @@ +function lgaai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgaai eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgaaid.fish b/fish/functions/lgaaid.fish new file mode 100644 index 0000000..f3112b4 --- /dev/null +++ b/fish/functions/lgaaid.fish @@ -0,0 +1,4 @@ +function lgaaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgaaid eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgad.fish b/fish/functions/lgad.fish new file mode 100644 index 0000000..774db06 --- /dev/null +++ b/fish/functions/lgad.fish @@ -0,0 +1,4 @@ +function lgad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgad eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgai.fish b/fish/functions/lgai.fish new file mode 100644 index 0000000..41a3478 --- /dev/null +++ b/fish/functions/lgai.fish @@ -0,0 +1,4 @@ +function lgai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgai eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgaid.fish b/fish/functions/lgaid.fish new file mode 100644 index 0000000..1eb2777 --- /dev/null +++ b/fish/functions/lgaid.fish @@ -0,0 +1,4 @@ +function lgaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgaid eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgd.fish b/fish/functions/lgd.fish new file mode 100644 index 0000000..1a88bfa --- /dev/null +++ b/fish/functions/lgd.fish @@ -0,0 +1,4 @@ +function lgd --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgd eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgi.fish b/fish/functions/lgi.fish new file mode 100644 index 0000000..f2e6541 --- /dev/null +++ b/fish/functions/lgi.fish @@ -0,0 +1,4 @@ +function lgi --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgi eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/lgid.fish b/fish/functions/lgid.fish new file mode 100644 index 0000000..fd83d86 --- /dev/null +++ b/fish/functions/lgid.fish @@ -0,0 +1,4 @@ +function lgid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LG_OPTIONS' --description 'alias lgid eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LG_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LG_OPTIONS $argv + +end diff --git a/fish/functions/li.fish b/fish/functions/li.fish new file mode 100644 index 0000000..5d2c087 --- /dev/null +++ b/fish/functions/li.fish @@ -0,0 +1,4 @@ +function li --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_L_OPTIONS' --description 'alias li eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/lid.fish b/fish/functions/lid.fish new file mode 100644 index 0000000..6c439d1 --- /dev/null +++ b/fish/functions/lid.fish @@ -0,0 +1,4 @@ +function lid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_L_OPTIONS' --description 'alias lid eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_L_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_L_OPTIONS $argv + +end diff --git a/fish/functions/ll.fish b/fish/functions/ll.fish new file mode 100644 index 0000000..79ddc13 --- /dev/null +++ b/fish/functions/ll.fish @@ -0,0 +1,4 @@ +function ll --wraps=exa_git --description 'alias ll exa_git' + exa_git $argv + +end diff --git a/fish/functions/lla.fish b/fish/functions/lla.fish new file mode 100644 index 0000000..85f5f13 --- /dev/null +++ b/fish/functions/lla.fish @@ -0,0 +1,4 @@ +function lla --wraps='exa_git $EXA_LA_OPTIONS' --description 'alias lla exa_git $EXA_LA_OPTIONS' + exa_git $EXA_LA_OPTIONS $argv + +end diff --git a/fish/functions/llaa.fish b/fish/functions/llaa.fish new file mode 100644 index 0000000..fb364b7 --- /dev/null +++ b/fish/functions/llaa.fish @@ -0,0 +1,4 @@ +function llaa --wraps='exa_git $EXA_LAA_OPTIONS' --description 'alias llaa exa_git $EXA_LAA_OPTIONS' + exa_git $EXA_LAA_OPTIONS $argv + +end diff --git a/fish/functions/llaad.fish b/fish/functions/llaad.fish new file mode 100644 index 0000000..b28e0a2 --- /dev/null +++ b/fish/functions/llaad.fish @@ -0,0 +1,4 @@ +function llaad --wraps='exa_git $EXA_LAAD_OPTIONS' --description 'alias llaad exa_git $EXA_LAAD_OPTIONS' + exa_git $EXA_LAAD_OPTIONS $argv + +end diff --git a/fish/functions/llaai.fish b/fish/functions/llaai.fish new file mode 100644 index 0000000..d3500f9 --- /dev/null +++ b/fish/functions/llaai.fish @@ -0,0 +1,4 @@ +function llaai --wraps='exa_git $EXA_LAAI_OPTIONS' --description 'alias llaai exa_git $EXA_LAAI_OPTIONS' + exa_git $EXA_LAAI_OPTIONS $argv + +end diff --git a/fish/functions/llaaid.fish b/fish/functions/llaaid.fish new file mode 100644 index 0000000..5324e09 --- /dev/null +++ b/fish/functions/llaaid.fish @@ -0,0 +1,4 @@ +function llaaid --wraps='exa_git $EXA_LAAID_OPTIONS' --description 'alias llaaid exa_git $EXA_LAAID_OPTIONS' + exa_git $EXA_LAAID_OPTIONS $argv + +end diff --git a/fish/functions/llad.fish b/fish/functions/llad.fish new file mode 100644 index 0000000..d264b6e --- /dev/null +++ b/fish/functions/llad.fish @@ -0,0 +1,4 @@ +function llad --wraps='exa_git $EXA_LAD_OPTIONS' --description 'alias llad exa_git $EXA_LAD_OPTIONS' + exa_git $EXA_LAD_OPTIONS $argv + +end diff --git a/fish/functions/llai.fish b/fish/functions/llai.fish new file mode 100644 index 0000000..8afda30 --- /dev/null +++ b/fish/functions/llai.fish @@ -0,0 +1,4 @@ +function llai --wraps='exa_git $EXA_LAI_OPTIONS' --description 'alias llai exa_git $EXA_LAI_OPTIONS' + exa_git $EXA_LAI_OPTIONS $argv + +end diff --git a/fish/functions/llaid.fish b/fish/functions/llaid.fish new file mode 100644 index 0000000..e3ba5a3 --- /dev/null +++ b/fish/functions/llaid.fish @@ -0,0 +1,4 @@ +function llaid --wraps='exa_git $EXA_LAID_OPTIONS' --description 'alias llaid exa_git $EXA_LAID_OPTIONS' + exa_git $EXA_LAID_OPTIONS $argv + +end diff --git a/fish/functions/lld.fish b/fish/functions/lld.fish new file mode 100644 index 0000000..77048a3 --- /dev/null +++ b/fish/functions/lld.fish @@ -0,0 +1,4 @@ +function lld --wraps='exa_git $EXA_LD_OPTIONS' --description 'alias lld exa_git $EXA_LD_OPTIONS' + exa_git $EXA_LD_OPTIONS $argv + +end diff --git a/fish/functions/lli.fish b/fish/functions/lli.fish new file mode 100644 index 0000000..5faea07 --- /dev/null +++ b/fish/functions/lli.fish @@ -0,0 +1,4 @@ +function lli --wraps='exa_git $EXA_LI_OPTIONS' --description 'alias lli exa_git $EXA_LI_OPTIONS' + exa_git $EXA_LI_OPTIONS $argv + +end diff --git a/fish/functions/llid.fish b/fish/functions/llid.fish new file mode 100644 index 0000000..6e280af --- /dev/null +++ b/fish/functions/llid.fish @@ -0,0 +1,4 @@ +function llid --wraps='exa_git $EXA_LID_OPTIONS' --description 'alias llid exa_git $EXA_LID_OPTIONS' + exa_git $EXA_LID_OPTIONS $argv + +end diff --git a/fish/functions/lo.fish b/fish/functions/lo.fish new file mode 100644 index 0000000..c0d7708 --- /dev/null +++ b/fish/functions/lo.fish @@ -0,0 +1,4 @@ +function lo --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LO_OPTIONS' --description 'alias lo eza $EXA_STANDARD_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loa.fish b/fish/functions/loa.fish new file mode 100644 index 0000000..d345abe --- /dev/null +++ b/fish/functions/loa.fish @@ -0,0 +1,4 @@ +function loa --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LO_OPTIONS' --description 'alias loa eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loaa.fish b/fish/functions/loaa.fish new file mode 100644 index 0000000..e4b2a90 --- /dev/null +++ b/fish/functions/loaa.fish @@ -0,0 +1,4 @@ +function loaa --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LO_OPTIONS' --description 'alias loaa eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAA_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loaad.fish b/fish/functions/loaad.fish new file mode 100644 index 0000000..01d071d --- /dev/null +++ b/fish/functions/loaad.fish @@ -0,0 +1,4 @@ +function loaad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LO_OPTIONS' --description 'alias loaad eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loaai.fish b/fish/functions/loaai.fish new file mode 100644 index 0000000..6e7e41c --- /dev/null +++ b/fish/functions/loaai.fish @@ -0,0 +1,4 @@ +function loaai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LO_OPTIONS' --description 'alias loaai eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loaaid.fish b/fish/functions/loaaid.fish new file mode 100644 index 0000000..8fe79be --- /dev/null +++ b/fish/functions/loaaid.fish @@ -0,0 +1,4 @@ +function loaaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LO_OPTIONS' --description 'alias loaaid eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/load.fish b/fish/functions/load.fish new file mode 100644 index 0000000..8196545 --- /dev/null +++ b/fish/functions/load.fish @@ -0,0 +1,4 @@ +function load --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LO_OPTIONS' --description 'alias load eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loai.fish b/fish/functions/loai.fish new file mode 100644 index 0000000..08d59f7 --- /dev/null +++ b/fish/functions/loai.fish @@ -0,0 +1,4 @@ +function loai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LO_OPTIONS' --description 'alias loai eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loaid.fish b/fish/functions/loaid.fish new file mode 100644 index 0000000..21a3b6e --- /dev/null +++ b/fish/functions/loaid.fish @@ -0,0 +1,4 @@ +function loaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LO_OPTIONS' --description 'alias loaid eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/lod.fish b/fish/functions/lod.fish new file mode 100644 index 0000000..9383220 --- /dev/null +++ b/fish/functions/lod.fish @@ -0,0 +1,4 @@ +function lod --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LO_OPTIONS' --description 'alias lod eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loi.fish b/fish/functions/loi.fish new file mode 100644 index 0000000..eb63c20 --- /dev/null +++ b/fish/functions/loi.fish @@ -0,0 +1,4 @@ +function loi --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LO_OPTIONS' --description 'alias loi eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/loid.fish b/fish/functions/loid.fish new file mode 100644 index 0000000..241ab9f --- /dev/null +++ b/fish/functions/loid.fish @@ -0,0 +1,4 @@ +function loid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LO_OPTIONS' --description 'alias loid eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LO_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LO_OPTIONS $argv + +end diff --git a/fish/functions/lt.fish b/fish/functions/lt.fish new file mode 100644 index 0000000..ec9acf8 --- /dev/null +++ b/fish/functions/lt.fish @@ -0,0 +1,4 @@ +function lt --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LT_OPTIONS' --description 'alias lt eza $EXA_STANDARD_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/lta.fish b/fish/functions/lta.fish new file mode 100644 index 0000000..dbc56af --- /dev/null +++ b/fish/functions/lta.fish @@ -0,0 +1,4 @@ +function lta --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LT_OPTIONS' --description 'alias lta eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LA_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltaad.fish b/fish/functions/ltaad.fish new file mode 100644 index 0000000..6862bf9 --- /dev/null +++ b/fish/functions/ltaad.fish @@ -0,0 +1,4 @@ +function ltaad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltaad eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAD_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltaai.fish b/fish/functions/ltaai.fish new file mode 100644 index 0000000..16690e0 --- /dev/null +++ b/fish/functions/ltaai.fish @@ -0,0 +1,4 @@ +function ltaai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltaai eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAI_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltaaid.fish b/fish/functions/ltaaid.fish new file mode 100644 index 0000000..ef075ef --- /dev/null +++ b/fish/functions/ltaaid.fish @@ -0,0 +1,4 @@ +function ltaaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltaaid eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAAID_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltad.fish b/fish/functions/ltad.fish new file mode 100644 index 0000000..dad8e23 --- /dev/null +++ b/fish/functions/ltad.fish @@ -0,0 +1,4 @@ +function ltad --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltad eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAD_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltai.fish b/fish/functions/ltai.fish new file mode 100644 index 0000000..b1820c3 --- /dev/null +++ b/fish/functions/ltai.fish @@ -0,0 +1,4 @@ +function ltai --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltai eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAI_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltaid.fish b/fish/functions/ltaid.fish new file mode 100644 index 0000000..757dcc4 --- /dev/null +++ b/fish/functions/ltaid.fish @@ -0,0 +1,4 @@ +function ltaid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltaid eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LAID_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltd.fish b/fish/functions/ltd.fish new file mode 100644 index 0000000..f29fd06 --- /dev/null +++ b/fish/functions/ltd.fish @@ -0,0 +1,4 @@ +function ltd --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltd eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LD_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/lti.fish b/fish/functions/lti.fish new file mode 100644 index 0000000..cf04557 --- /dev/null +++ b/fish/functions/lti.fish @@ -0,0 +1,4 @@ +function lti --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LT_OPTIONS' --description 'alias lti eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LI_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/ltid.fish b/fish/functions/ltid.fish new file mode 100644 index 0000000..94f64d0 --- /dev/null +++ b/fish/functions/ltid.fish @@ -0,0 +1,4 @@ +function ltid --wraps='eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LT_OPTIONS' --description 'alias ltid eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LT_OPTIONS' + eza $EXA_STANDARD_OPTIONS $EXA_LID_OPTIONS $EXA_LT_OPTIONS $argv + +end diff --git a/fish/functions/nvm.fish b/fish/functions/nvm.fish new file mode 100644 index 0000000..f86c75c --- /dev/null +++ b/fish/functions/nvm.fish @@ -0,0 +1,235 @@ +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.17" + case "" -h --help + echo "Usage: nvm install Download and activate the specified Node version" + echo " nvm install Install the version specified in the nearest .nvmrc file" + echo " nvm use Activate the specified Node version in the current shell" + echo " nvm use Activate the version specified in the nearest .nvmrc file" + echo " nvm list List installed Node versions" + echo " nvm list-remote List available Node versions to install" + echo " nvm list-remote List Node versions matching a given regex pattern" + echo " nvm current Print the currently-active Node version" + echo " nvm uninstall Uninstall the specified Node version" + echo "Options:" + echo " -s, --silent Suppress standard output" + echo " -v, --version Print the version of nvm" + echo " -h, --help Print this help message" + echo "Variables:" + echo " nvm_arch Override architecture, e.g. x64-musl" + echo " nvm_mirror Use a mirror for downloading Node binaries" + echo " nvm_default_version Set the default version for new shells" + echo " nvm_default_packages Install a list of packages every time a Node version is installed" + echo " nvm_data Set a custom directory for storing nvm data" + echo "Examples:" + echo " nvm install latest Install the latest version of Node" + echo " nvm use 14.15.1 Use Node version 14.15.1" + echo " nvm use system Activate the system's 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 -q $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) + " | string replace -- ~ \~ +end diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..00d56f4 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,10 @@ +if vim.loader then + vim.loader.enable() +end + +_G.dd = function(...) + require("util.debug").dump(...) +end +vim.print = _G.dd + +require("config.lazy") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..46dc2ba --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,54 @@ +{ + "LazyVim": { "branch": "main", "commit": "25abbf546d564dc484cf903804661ba12de45507" }, + "SchemaStore.nvim": { "branch": "main", "commit": "6af106298a8fd50af775d5281ee39a102556e352" }, + "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" }, + "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, + "crates.nvim": { "branch": "main", "commit": "5d8b1bef686db0fabe5f1bb593744b617e8f1405" }, + "dial.nvim": { "branch": "master", "commit": "2c7e2750372918f072a20f3cf754d845e143d7c9" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "git.nvim": { "branch": "main", "commit": "7354ed2efe31b979778cb62ffa2fa23df70eaf26" }, + "gitsigns.nvim": { "branch": "main", "commit": "1b0350ab707713b2bc6c236151f1a324175347b1" }, + "grug-far.nvim": { "branch": "main", "commit": "b3f9412b1ed76f14cfc68e1ee899873544330c80" }, + "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, + "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, + "incline.nvim": { "branch": "main", "commit": "0fd2d5a27504dba7fdc507a53275f22c081fe640" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mini.ai": { "branch": "main", "commit": "d172ada7b0281044a06cb9a625a862553c457b6f" }, + "mini.bracketed": { "branch": "main", "commit": "a54a2a180dc40f4d85875eeafacbdf991d042a36" }, + "mini.hipatterns": { "branch": "main", "commit": "d71c21167d6bd5f21c9ecf90912c510f9edfc02b" }, + "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, + "mini.pairs": { "branch": "main", "commit": "42407ccb80ec59c84e7c91d815f42ed90a8cc093" }, + "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, + "nvim-lspconfig": { "branch": "master", "commit": "2d0ca00368742c0c7af802b9b2a920c4cd02303a" }, + "nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" }, + "rustaceanvim": { "branch": "master", "commit": "2bd452c23dee06ced27abae4b562baee50158b66" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "solarized-osaka.nvim": { "branch": "main", "commit": "f796014c14b1910e08d42cc2077fef34f08e0295" }, + "symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "7bf55ed0ff5be182ad3301cff266581fc1c56cce" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, + "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } +} diff --git a/nvim/lazyvim.json b/nvim/lazyvim.json new file mode 100644 index 0000000..f41671f --- /dev/null +++ b/nvim/lazyvim.json @@ -0,0 +1,11 @@ +{ + "extras": [ + + ], + "install_version": 8, + "news": { + "NEWS.md": "10960", + "doc/news.txt": "24841" + }, + "version": 8 +} \ No newline at end of file diff --git a/nvim/lua/config/autocmds.lua b/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..a9d3f98 --- /dev/null +++ b/nvim/lua/config/autocmds.lua @@ -0,0 +1,14 @@ +-- Turn off paste mode when leaving insert +vim.api.nvim_create_autocmd("InsertLeave", { + pattern = "*", + command = "set nopaste", +}) + +-- Disable the concealing in some file formats +-- The default conceallevel is 3 in LazyVim +vim.api.nvim_create_autocmd("FileType", { + pattern = { "json", "jsonc", "markdown" }, + callback = function() + vim.opt.conceallevel = 0 + end, +}) diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..eb1e725 --- /dev/null +++ b/nvim/lua/config/keymaps.lua @@ -0,0 +1,74 @@ +local discipline = require("m1ngsama.discipline") + +-- discipline.cowboy() + +local keymap = vim.keymap +local opts = { noremap = true, silent = true } + +-- Do things without affecting the registers +keymap.set("n", "x", '"_x') +keymap.set("n", "p", '"0p') +keymap.set("n", "P", '"0P') +keymap.set("v", "p", '"0p') +keymap.set("n", "c", '"_c') +keymap.set("n", "C", '"_C') +keymap.set("v", "c", '"_c') +keymap.set("v", "C", '"_C') +keymap.set("n", "d", '"_d') +keymap.set("n", "D", '"_D') +keymap.set("v", "d", '"_d') +keymap.set("v", "D", '"_D') + +-- Increment/decrement +keymap.set("n", "+", "") +keymap.set("n", "-", "") + +-- Delete a word backwards +keymap.set("n", "dw", 'vb"_d') + +-- Select all +keymap.set("n", "", "ggG") + +-- Save with root permission (not working for now) +--vim.api.nvim_create_user_command('W', 'w !sudo tee > /dev/null %', {}) + +-- Disable continuations +keymap.set("n", "o", "o^Da", opts) +keymap.set("n", "O", "O^Da", opts) + +-- Jumplist +keymap.set("n", "", "", opts) + +-- New tab +keymap.set("n", "te", ":tabedit") +keymap.set("n", "", ":tabnext", opts) +keymap.set("n", "", ":tabprev", opts) +-- Split window +keymap.set("n", "ss", ":split", opts) +keymap.set("n", "sv", ":vsplit", opts) +-- Move window +keymap.set("n", "sh", "h") +keymap.set("n", "sk", "k") +keymap.set("n", "sj", "j") +keymap.set("n", "sl", "l") + +-- Resize window +keymap.set("n", "", "<") +keymap.set("n", "", ">") +keymap.set("n", "", "+") +keymap.set("n", "", "-") + +-- Diagnostics +keymap.set("n", "", function() + vim.diagnostic.goto_next() +end, opts) + +keymap.set("n", "mp", "MarkdownPreview", { desc = "Markdown Preview" }) + +keymap.set("n", "r", function() + require("m1ngsama.hsl").replaceHexWithHSL() +end) + +keymap.set("n", "i", function() + require("m1ngsama.lsp").toggleInlayHints() +end) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..014aa3b --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,87 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { + "LazyVim/LazyVim", + import = "lazyvim.plugins", + opts = { + colorscheme = "solarized-osaka", + news = { + lazyvim = true, + neovim = true, + }, + }, + }, + -- import any extras modules here + { import = "lazyvim.plugins.extras.linting.eslint" }, + { import = "lazyvim.plugins.extras.formatting.prettier" }, + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.json" }, + -- { import = "lazyvim.plugins.extras.lang.markdown" }, + { import = "lazyvim.plugins.extras.lang.rust" }, + { import = "lazyvim.plugins.extras.lang.tailwind" }, + -- { import = "lazyvim.plugins.extras.ai.copilot" }, + -- { import = "lazyvim.plugins.extras.dap.core" }, + -- { import = "lazyvim.plugins.extras.vscode" }, + { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, + -- { import = "lazyvim.plugins.extras.test.core" }, + -- { import = "lazyvim.plugins.extras.coding.yanky" }, + -- { import = "lazyvim.plugins.extras.editor.mini-files" }, + -- { import = "lazyvim.plugins.extras.util.project" }, + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + dev = { + path = "~/.ghq/github.com", + }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + cache = { + enabled = true, + -- disable_events = {}, + }, + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + "netrwPlugin", + "rplugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, + ui = { + custom_keys = { + ["d"] = function(plugin) + dd(plugin) + end, + }, + }, + debug = false, +}) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua new file mode 100644 index 0000000..218f64d --- /dev/null +++ b/nvim/lua/config/options.lua @@ -0,0 +1,47 @@ +vim.g.mapleader = " " + +vim.opt.encoding = "utf-8" +vim.opt.fileencoding = "utf-8" + +vim.opt.number = true + +vim.opt.title = true +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.hlsearch = true +vim.opt.backup = false +vim.opt.showcmd = true +vim.opt.cmdheight = 1 +vim.opt.laststatus = 3 +vim.opt.expandtab = true +vim.opt.scrolloff = 10 +vim.opt.shell = "fish" +vim.opt.backupskip = { "/tmp/*", "/private/tmp/*" } +vim.opt.inccommand = "split" +vim.opt.ignorecase = true -- Case insensitive searching UNLESS /C or capital in search +vim.opt.smarttab = true +vim.opt.breakindent = true +vim.opt.shiftwidth = 2 +vim.opt.tabstop = 2 +vim.opt.wrap = false -- No Wrap lines +vim.opt.backspace = { "start", "eol", "indent" } +vim.opt.path:append({ "**" }) -- Finding files - Search down into subfolders +vim.opt.wildignore:append({ "*/node_modules/*" }) +vim.opt.splitbelow = true -- Put new windows below current +vim.opt.splitright = true -- Put new windows right of current +vim.opt.splitkeep = "cursor" +vim.opt.mouse = "" + +-- Undercurl +vim.cmd([[let &t_Cs = "\e[4:3m"]]) +vim.cmd([[let &t_Ce = "\e[4:0m"]]) + +-- Add asterisks in block comments +vim.opt.formatoptions:append({ "r" }) + +vim.cmd([[au BufNewFile,BufRead *.astro setf astro]]) +vim.cmd([[au BufNewFile,BufRead Podfile setf ruby]]) + +if vim.fn.has("nvim-0.8") == 1 then + vim.opt.cmdheight = 0 +end diff --git a/nvim/lua/m1ngsama/discipline.lua b/nvim/lua/m1ngsama/discipline.lua new file mode 100644 index 0000000..ff2c0d5 --- /dev/null +++ b/nvim/lua/m1ngsama/discipline.lua @@ -0,0 +1,36 @@ +local M = {} + +function M.cowboy() + ---@type table? + local ok = true + for _, key in ipairs({ "h", "j", "k", "l", "+", "-" }) do + local count = 0 + local timer = assert(vim.uv.new_timer()) + local map = key + vim.keymap.set("n", key, function() + if vim.v.count > 0 then + count = 0 + end + if count >= 10 and vim.bo.buftype ~= "nofile" then + ok = pcall(vim.notify, "Hold it Cowboy!", vim.log.levels.WARN, { + icon = "🀠", + id = "cowboy", + keep = function() + return count >= 10 + end, + }) + if not ok then + return map + end + else + count = count + 1 + timer:start(2000, 0, function() + count = 0 + end) + return map + end + end, { expr = true, silent = true }) + end +end + +return M diff --git a/nvim/lua/m1ngsama/hsl.lua b/nvim/lua/m1ngsama/hsl.lua new file mode 100644 index 0000000..4c97404 --- /dev/null +++ b/nvim/lua/m1ngsama/hsl.lua @@ -0,0 +1,154 @@ +-- https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua + +local M = {} + +local hexChars = "0123456789abcdef" + +function M.hex_to_rgb(hex) + hex = string.lower(hex) + local ret = {} + for i = 0, 2 do + local char1 = string.sub(hex, i * 2 + 2, i * 2 + 2) + local char2 = string.sub(hex, i * 2 + 3, i * 2 + 3) + local digit1 = string.find(hexChars, char1) - 1 + local digit2 = string.find(hexChars, char2) - 1 + ret[i + 1] = (digit1 * 16 + digit2) / 255.0 + end + return ret +end + +--[[ + * Converts an RGB color value to HSL. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes r, g, and b are contained in the set [0, 255] and + * returns h, s, and l in the set [0, 1]. + * + * @param Number r The red color value + * @param Number g The green color value + * @param Number b The blue color value + * @return Array The HSL representation +]] +function M.rgbToHsl(r, g, b) + local max, min = math.max(r, g, b), math.min(r, g, b) + local h = 0 + local s = 0 + local l = 0 + + l = (max + min) / 2 + + if max == min then + h, s = 0, 0 -- achromatic + else + local d = max - min + if l > 0.5 then + s = d / (2 - max - min) + else + s = d / (max + min) + end + if max == r then + h = (g - b) / d + if g < b then + h = h + 6 + end + elseif max == g then + h = (b - r) / d + 2 + elseif max == b then + h = (r - g) / d + 4 + end + h = h / 6 + end + + return h * 360, s * 100, l * 100 +end + +--[[ + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h, s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param Number h The hue + * @param Number s The saturation + * @param Number l The lightness + * @return Array The RGB representation +]] +function M.hslToRgb(h, s, l) + local r, g, b + + if s == 0 then + r, g, b = l, l, l -- achromatic + else + function hue2rgb(p, q, t) + if t < 0 then + t = t + 1 + end + if t > 1 then + t = t - 1 + end + if t < 1 / 6 then + return p + (q - p) * 6 * t + end + if t < 1 / 2 then + return q + end + if t < 2 / 3 then + return p + (q - p) * (2 / 3 - t) * 6 + end + return p + end + + local q + if l < 0.5 then + q = l * (1 + s) + else + q = l + s - l * s + end + local p = 2 * l - q + + r = hue2rgb(p, q, h + 1 / 3) + g = hue2rgb(p, q, h) + b = hue2rgb(p, q, h - 1 / 3) + end + + return r * 255, g * 255, b * 255 +end + +function M.hexToHSL(hex) + local hsluv = require("solarized-osaka.hsluv") + local rgb = M.hex_to_rgb(hex) + local h, s, l = M.rgbToHsl(rgb[1], rgb[2], rgb[3]) + + return string.format("hsl(%d, %d, %d)", math.floor(h + 0.5), math.floor(s + 0.5), math.floor(l + 0.5)) +end + +--[[ + * Converts an HSL color value to RGB in Hex representation. + * @param Number h The hue + * @param Number s The saturation + * @param Number l The lightness + * @return String The hex representation +]] +function M.hslToHex(h, s, l) + local r, g, b = M.hslToRgb(h / 360, s / 100, l / 100) + + return string.format("#%02x%02x%02x", r, g, b) +end + +function M.replaceHexWithHSL() + -- Get the current line number + local line_number = vim.api.nvim_win_get_cursor(0)[1] + + -- Get the line content + local line_content = vim.api.nvim_buf_get_lines(0, line_number - 1, line_number, false)[1] + + -- Find hex code patterns and replace them + for hex in line_content:gmatch("#[0-9a-fA-F]+") do + local hsl = M.hexToHSL(hex) + line_content = line_content:gsub(hex, hsl) + end + + -- Set the line content back + vim.api.nvim_buf_set_lines(0, line_number - 1, line_number, false, { line_content }) +end + +return M diff --git a/nvim/lua/m1ngsama/lsp.lua b/nvim/lua/m1ngsama/lsp.lua new file mode 100644 index 0000000..a52e945 --- /dev/null +++ b/nvim/lua/m1ngsama/lsp.lua @@ -0,0 +1,7 @@ +local M = {} + +function M.toggleInlayHints() + vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled()) +end + +return M diff --git a/nvim/lua/plugins/coding.lua b/nvim/lua/plugins/coding.lua new file mode 100644 index 0000000..963e401 --- /dev/null +++ b/nvim/lua/plugins/coding.lua @@ -0,0 +1,97 @@ +return { + -- Create annotations with one keybind, and jump your cursor in the inserted annotation + { + "danymat/neogen", + keys = { + { + "cc", + function() + require("neogen").generate({}) + end, + desc = "Neogen Comment", + }, + }, + opts = { snippet_engine = "luasnip" }, + }, + + -- Incremental rename + { + "smjonas/inc-rename.nvim", + cmd = "IncRename", + config = true, + }, + + -- Refactoring tool + { + "ThePrimeagen/refactoring.nvim", + keys = { + { + "r", + function() + require("refactoring").select_refactor() + end, + mode = "v", + noremap = true, + silent = true, + expr = false, + }, + }, + opts = {}, + }, + + -- Go forward/backward with square brackets + { + "echasnovski/mini.bracketed", + event = "BufReadPost", + config = function() + local bracketed = require("mini.bracketed") + bracketed.setup({ + file = { suffix = "" }, + window = { suffix = "" }, + quickfix = { suffix = "" }, + yank = { suffix = "" }, + treesitter = { suffix = "n" }, + }) + end, + }, + + -- Better increase/descrease + { + "monaqa/dial.nvim", + -- stylua: ignore + keys = { + { "", function() return require("dial.map").inc_normal() end, expr = true, desc = "Increment" }, + { "", function() return require("dial.map").dec_normal() end, expr = true, desc = "Decrement" }, + }, + config = function() + local augend = require("dial.augend") + require("dial.config").augends:register_group({ + default = { + augend.integer.alias.decimal, + augend.integer.alias.hex, + augend.date.alias["%Y/%m/%d"], + augend.constant.alias.bool, + augend.semver.alias.semver, + augend.constant.new({ elements = { "let", "const" } }), + }, + }) + end, + }, + + { + "simrat39/symbols-outline.nvim", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + cmd = "SymbolsOutline", + opts = { + position = "right", + }, + }, + + { + "nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..b126b70 --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,12 @@ +return { + { + "craftzdog/solarized-osaka.nvim", + lazy = true, + priority = 1000, + opts = function() + return { + transparent = true, + } + end, + }, +} diff --git a/nvim/lua/plugins/editor.lua b/nvim/lua/plugins/editor.lua new file mode 100644 index 0000000..507f52d --- /dev/null +++ b/nvim/lua/plugins/editor.lua @@ -0,0 +1,237 @@ +return { + { + enabled = false, + "folke/flash.nvim", + ---@type Flash.Config + opts = { + search = { + forward = true, + multi_window = false, + wrap = false, + incremental = true, + }, + }, + }, + + { + "echasnovski/mini.hipatterns", + event = "BufReadPre", + opts = { + highlighters = { + hsl_color = { + pattern = "hsl%(%d+,? %d+%%?,? %d+%%?%)", + group = function(_, match) + local utils = require("solarized-osaka.hsl") + --- @type string, string, string + local nh, ns, nl = match:match("hsl%((%d+),? (%d+)%%?,? (%d+)%%?%)") + --- @type number?, number?, number? + local h, s, l = tonumber(nh), tonumber(ns), tonumber(nl) + --- @type string + local hex_color = utils.hslToHex(h, s, l) + return MiniHipatterns.compute_hex_color_group(hex_color, "bg") + end, + }, + }, + }, + }, + + { + "dinhhuy258/git.nvim", + event = "BufReadPre", + opts = { + keymaps = { + -- Open blame window + blame = "gb", + -- Open file/folder in git repository + browse = "go", + }, + }, + }, + + { + "nvim-telescope/telescope.nvim", + dependencies = { + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + "nvim-telescope/telescope-file-browser.nvim", + }, + keys = { + { + "fP", + function() + require("telescope.builtin").find_files({ + cwd = require("lazy.core.config").options.root, + }) + end, + desc = "Find Plugin File", + }, + { + ";f", + function() + local builtin = require("telescope.builtin") + builtin.find_files({ + no_ignore = false, + hidden = true, + }) + end, + desc = "Lists files in your current working directory, respects .gitignore", + }, + { + ";r", + function() + local builtin = require("telescope.builtin") + builtin.live_grep({ + additional_args = { "--hidden" }, + }) + end, + desc = "Search for a string in your current working directory and get results live as you type, respects .gitignore", + }, + { + "\\\\", + function() + local builtin = require("telescope.builtin") + builtin.buffers() + end, + desc = "Lists open buffers", + }, + { + ";t", + function() + local builtin = require("telescope.builtin") + builtin.help_tags() + end, + desc = "Lists available help tags and opens a new window with the relevant help info on ", + }, + { + ";;", + function() + local builtin = require("telescope.builtin") + builtin.resume() + end, + desc = "Resume the previous telescope picker", + }, + { + ";e", + function() + local builtin = require("telescope.builtin") + builtin.diagnostics() + end, + desc = "Lists Diagnostics for all open buffers or a specific buffer", + }, + { + ";s", + function() + local builtin = require("telescope.builtin") + builtin.treesitter() + end, + desc = "Lists Function names, variables, from Treesitter", + }, + { + "sf", + function() + local telescope = require("telescope") + + local function telescope_buffer_dir() + return vim.fn.expand("%:p:h") + end + + telescope.extensions.file_browser.file_browser({ + path = "%:p:h", + cwd = telescope_buffer_dir(), + respect_gitignore = false, + hidden = true, + grouped = true, + previewer = false, + initial_mode = "normal", + layout_config = { height = 40 }, + }) + end, + desc = "Open File Browser with the path of the current buffer", + }, + }, + config = function(_, opts) + local telescope = require("telescope") + local actions = require("telescope.actions") + local fb_actions = require("telescope").extensions.file_browser.actions + + opts.defaults = vim.tbl_deep_extend("force", opts.defaults, { + wrap_results = true, + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + mappings = { + n = {}, + }, + }) + opts.pickers = { + diagnostics = { + theme = "ivy", + initial_mode = "normal", + layout_config = { + preview_cutoff = 9999, + }, + }, + } + opts.extensions = { + file_browser = { + theme = "dropdown", + -- disables netrw and use telescope-file-browser in its place + hijack_netrw = true, + mappings = { + -- your custom insert mode mappings + ["n"] = { + -- your custom normal mode mappings + ["N"] = fb_actions.create, + ["h"] = fb_actions.goto_parent_dir, + ["/"] = function() + vim.cmd("startinsert") + end, + [""] = function(prompt_bufnr) + for i = 1, 10 do + actions.move_selection_previous(prompt_bufnr) + end + end, + [""] = function(prompt_bufnr) + for i = 1, 10 do + actions.move_selection_next(prompt_bufnr) + end + end, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + }, + }, + }, + } + telescope.setup(opts) + require("telescope").load_extension("fzf") + require("telescope").load_extension("file_browser") + end, + }, + + { + "saghen/blink.cmp", + opts = { + completion = { + menu = { + winblend = vim.o.pumblend, + }, + }, + signature = { + window = { + winblend = vim.o.pumblend, + }, + }, + }, + }, + + { + "3rd/image.nvim", + build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239 + opts = { + processor = "magick_cli", + }, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..1979c45 --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,193 @@ +return { + -- tools + { + "williamboman/mason.nvim", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { + "stylua", + "selene", + "luacheck", + "shellcheck", + "shfmt", + "tailwindcss-language-server", + "typescript-language-server", + "css-lsp", + "clangd", + }) + end, + }, + + -- lsp servers + { + "neovim/nvim-lspconfig", + opts = { + inlay_hints = { enabled = false }, + ---@type lspconfig.options + servers = { + cssls = {}, + tailwindcss = { + root_dir = function(...) + return require("lspconfig.util").root_pattern(".git")(...) + end, + }, + tsserver = { + root_dir = function(...) + return require("lspconfig.util").root_pattern(".git")(...) + end, + single_file_support = false, + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "literal", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, + }, + html = {}, + yamlls = { + settings = { + yaml = { + keyOrdering = false, + }, + }, + }, + lua_ls = { + -- enabled = false, + single_file_support = true, + settings = { + Lua = { + workspace = { + checkThirdParty = false, + }, + completion = { + workspaceWord = true, + callSnippet = "Both", + }, + misc = { + parameters = { + -- "--log-level=trace", + }, + }, + hint = { + enable = true, + setType = false, + paramType = true, + paramName = "Disable", + semicolon = "Disable", + arrayIndex = "Disable", + }, + doc = { + privateName = { "^_" }, + }, + type = { + castNumberToInteger = true, + }, + diagnostics = { + disable = { "incomplete-signature-doc", "trailing-space" }, + -- enable = false, + groupSeverity = { + strong = "Warning", + strict = "Warning", + }, + groupFileStatus = { + ["ambiguity"] = "Opened", + ["await"] = "Opened", + ["codestyle"] = "None", + ["duplicate"] = "Opened", + ["global"] = "Opened", + ["luadoc"] = "Opened", + ["redefined"] = "Opened", + ["strict"] = "Opened", + ["strong"] = "Opened", + ["type-check"] = "Opened", + ["unbalanced"] = "Opened", + ["unused"] = "Opened", + }, + unusedLocalExclude = { "_*" }, + }, + format = { + enable = false, + defaultConfig = { + indent_style = "space", + indent_size = "2", + continuation_indent_size = "2", + }, + }, + }, + }, + }, + gopls = { + settings = { + gopls = { + analyses = { + unusedparams = true, + shadow = true, + }, + staticcheck = true, + }, + }, + }, + clangd = { + cmd = { "clangd", "--background-index" }, + filetypes = { "c", "cpp", "objc", "objcpp" }, + root_dir = function(...) + return require("lspconfig.util").root_pattern( + "compile_commands.json", + "compile_flags.txt", + ".git" + )(...) + end, + }, + }, + setup = {}, + }, + }, + { + "neovim/nvim-lspconfig", + opts = function() + local keys = require("lazyvim.plugins.lsp.keymaps").get() + vim.list_extend(keys, { + { + "gd", + function() + -- DO NOT RESUSE WINDOW + require("telescope.builtin").lsp_definitions({ reuse_win = false }) + end, + desc = "Goto Definition", + has = "definition", + }, + }) + end, + }, + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + config = function() + vim.g.mkdp_auto_start = 0 + vim.g.mkdp_auto_close = 1 + vim.g.mkdp_refresh_slow = 0 + vim.g.mkdp_command_for_global = 0 + end, + }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..f3443d2 --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,67 @@ +return { + { "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" }, + + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "astro", + "cmake", + "cpp", + "css", + "fish", + "gitignore", + "go", + "graphql", + "http", + "java", + "php", + "rust", + "scss", + "sql", + "svelte", + }, + + -- matchup = { + -- enable = true, + -- }, + + -- https://github.com/nvim-treesitter/playground#query-linter + query_linter = { + enable = true, + use_virtual_text = true, + lint_events = { "BufWrite", "CursorHold" }, + }, + + playground = { + enable = true, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = true, -- Whether the query persists across vim sessions + keybindings = { + toggle_query_editor = "o", + toggle_hl_groups = "i", + toggle_injected_languages = "t", + toggle_anonymous_nodes = "a", + toggle_language_display = "I", + focus_language = "f", + unfocus_language = "F", + update = "R", + goto_node = "", + show_help = "?", + }, + }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + + -- MDX + vim.filetype.add({ + extension = { + mdx = "mdx", + }, + }) + vim.treesitter.language.register("markdown", "mdx") + end, + }, +} diff --git a/nvim/lua/plugins/ui.lua b/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..692fd8f --- /dev/null +++ b/nvim/lua/plugins/ui.lua @@ -0,0 +1,170 @@ +return { + -- messages, cmdline and the popupmenu + { + "folke/noice.nvim", + opts = function(_, opts) + table.insert(opts.routes, { + filter = { + event = "notify", + find = "No information available", + }, + opts = { skip = true }, + }) + local focused = true + vim.api.nvim_create_autocmd("FocusGained", { + callback = function() + focused = true + end, + }) + vim.api.nvim_create_autocmd("FocusLost", { + callback = function() + focused = false + end, + }) + table.insert(opts.routes, 1, { + filter = { + cond = function() + return not focused + end, + }, + view = "notify_send", + opts = { stop = false }, + }) + + opts.commands = { + all = { + -- options for the message history that you get with `:Noice` + view = "split", + opts = { enter = true, format = "details" }, + filter = {}, + }, + } + + vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function(event) + vim.schedule(function() + require("noice.text.markdown").keys(event.buf) + end) + end, + }) + + opts.presets.lsp_doc_border = true + end, + }, + + { + "rcarriga/nvim-notify", + opts = { + timeout = 5000, + }, + }, + + { + "snacks.nvim", + opts = { + scroll = { enabled = false }, + }, + keys = {}, + }, + + -- buffer line + { + "akinsho/bufferline.nvim", + event = "VeryLazy", + keys = { + { "", "BufferLineCycleNext", desc = "Next tab" }, + { "", "BufferLineCyclePrev", desc = "Prev tab" }, + }, + opts = { + options = { + mode = "tabs", + -- separator_style = "slant", + show_buffer_close_icons = false, + show_close_icon = false, + }, + }, + }, + + -- filename + { + "b0o/incline.nvim", + dependencies = { "craftzdog/solarized-osaka.nvim" }, + event = "BufReadPre", + priority = 1200, + config = function() + local colors = require("solarized-osaka.colors").setup() + require("incline").setup({ + highlight = { + groups = { + InclineNormal = { guibg = colors.magenta500, guifg = colors.base04 }, + InclineNormalNC = { guifg = colors.violet500, guibg = colors.base03 }, + }, + }, + window = { margin = { vertical = 0, horizontal = 1 } }, + hide = { + cursorline = true, + }, + render = function(props) + local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t") + if vim.bo[props.buf].modified then + filename = "[+] " .. filename + end + + local icon, color = require("nvim-web-devicons").get_icon_color(filename) + return { { icon, guifg = color }, { " " }, { filename } } + end, + }) + end, + }, + + -- statusline + { + "nvim-lualine/lualine.nvim", + opts = function(_, opts) + local LazyVim = require("lazyvim.util") + opts.sections.lualine_c[4] = { + LazyVim.lualine.pretty_path({ + length = 0, + relative = "cwd", + modified_hl = "MatchParen", + directory_hl = "", + filename_hl = "Bold", + modified_sign = "", + readonly_icon = " 󰌾 ", + }), + } + end, + }, + + { + "folke/zen-mode.nvim", + cmd = "ZenMode", + opts = { + plugins = { + gitsigns = true, + tmux = true, + kitty = { enabled = false, font = "+2" }, + }, + }, + keys = { { "z", "ZenMode", desc = "Zen Mode" } }, + }, + + { + "folke/snacks.nvim", + opts = { + dashboard = { + preset = { + header = [[ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•”β•β•β• + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— + β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•šβ•β• β•šβ•β•β•β•β•β•β• + ]], + }, + }, + }, + }, +} diff --git a/nvim/lua/util/debug.lua b/nvim/lua/util/debug.lua new file mode 100644 index 0000000..136823f --- /dev/null +++ b/nvim/lua/util/debug.lua @@ -0,0 +1,158 @@ +-- selene: allow(global_usage) + +local M = {} + +function M.get_loc() + local me = debug.getinfo(1, "S") + local level = 2 + local info = debug.getinfo(level, "S") + while info and (info.source == me.source or info.source == "@" .. vim.env.MYVIMRC or info.what ~= "Lua") do + level = level + 1 + info = debug.getinfo(level, "S") + end + info = info or me + local source = info.source:sub(2) + source = vim.loop.fs_realpath(source) or source + return source .. ":" .. info.linedefined +end + +---@param value any +---@param opts? {loc:string} +function M._dump(value, opts) + opts = opts or {} + opts.loc = opts.loc or M.get_loc() + if vim.in_fast_event() then + return vim.schedule(function() + M._dump(value, opts) + end) + end + opts.loc = vim.fn.fnamemodify(opts.loc, ":~:.") + local msg = vim.inspect(value) + vim.notify(msg, vim.log.levels.INFO, { + title = "Debug: " .. opts.loc, + on_open = function(win) + vim.wo[win].conceallevel = 3 + vim.wo[win].concealcursor = "" + vim.wo[win].spell = false + local buf = vim.api.nvim_win_get_buf(win) + if not pcall(vim.treesitter.start, buf, "lua") then + vim.bo[buf].filetype = "lua" + end + end, + }) +end + +function M.dump(...) + local value = { ... } + if vim.tbl_isempty(value) then + value = nil + else + value = vim.tbl_islist(value) and vim.tbl_count(value) <= 1 and value[1] or value + end + M._dump(value) +end + +function M.extmark_leaks() + local nsn = vim.api.nvim_get_namespaces() + + local counts = {} + + for name, ns in pairs(nsn) do + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + local count = #vim.api.nvim_buf_get_extmarks(buf, ns, 0, -1, {}) + if count > 0 then + counts[#counts + 1] = { + name = name, + buf = buf, + count = count, + ft = vim.bo[buf].ft, + } + end + end + end + table.sort(counts, function(a, b) + return a.count > b.count + end) + dd(counts) +end + +function estimateSize(value, visited) + if value == nil then + return 0 + end + local bytes = 0 + + -- initialize the visited table if not already done + --- @type table + visited = visited or {} + + -- handle already-visited value to avoid infinite recursion + if visited[value] then + return 0 + else + visited[value] = true + end + + if type(value) == "boolean" or value == nil then + bytes = 4 + elseif type(value) == "number" then + bytes = 8 + elseif type(value) == "string" then + bytes = string.len(value) + 24 + elseif type(value) == "function" then + bytes = 32 -- base size for a function + -- add size of upvalues + local i = 1 + while true do + local name, val = debug.getupvalue(value, i) + if not name then + break + end + bytes = bytes + estimateSize(val, visited) + i = i + 1 + end + elseif type(value) == "table" then + bytes = 40 -- base size for a table entry + for k, v in pairs(value) do + bytes = bytes + estimateSize(k, visited) + estimateSize(v, visited) + end + local mt = debug.getmetatable(value) + if mt then + bytes = bytes + estimateSize(mt, visited) + end + end + return bytes +end + +function M.module_leaks(filter) + local sizes = {} + for modname, mod in pairs(package.loaded) do + if not filter or modname:match(filter) then + local root = modname:match("^([^%.]+)%..*$") or modname + -- root = modname + sizes[root] = sizes[root] or { mod = root, size = 0 } + sizes[root].size = sizes[root].size + estimateSize(mod) / 1024 / 1024 + end + end + sizes = vim.tbl_values(sizes) + table.sort(sizes, function(a, b) + return a.size > b.size + end) + dd(sizes) +end + +function M.get_upvalue(func, name) + local i = 1 + while true do + local n, v = debug.getupvalue(func, i) + if not n then + break + end + if n == name then + return v + end + i = i + 1 + end +end + +return M diff --git a/tmux/macos.conf b/tmux/macos.conf new file mode 100644 index 0000000..914c951 --- /dev/null +++ b/tmux/macos.conf @@ -0,0 +1,7 @@ +# osx clipboard +set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL" + +# Undercurl +set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support +set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 + diff --git a/tmux/statusline.conf b/tmux/statusline.conf new file mode 100644 index 0000000..f2a2ee5 --- /dev/null +++ b/tmux/statusline.conf @@ -0,0 +1,31 @@ +# vim: ft=tmux +set -g mode-style "fg=#eee8d5,bg=#073642" + +set -g message-style "fg=#eee8d5,bg=#073642" +set -g message-command-style "fg=#eee8d5,bg=#073642" + +set -g pane-border-style "fg=#073642" +set -g pane-active-border-style "fg=#eee8d5" + +set -g status "on" +set -g status-interval 1 +set -g status-justify "left" + +set -g status-style "fg=#586e75,bg=#073642" + +set -g status-bg "#002b36" + +set -g status-left-length "100" +set -g status-right-length "100" + +set -g status-left-style NONE +set -g status-right-style NONE + +set -g status-left "#[fg=#073642,bg=#eee8d5,bold] #S #[fg=#eee8d5,bg=#93a1a1,nobold,nounderscore,noitalics]ξ‚°#[fg=#15161E,bg=#93a1a1,bold] #(whoami) #[fg=#93a1a1,bg=#002b36]ξ‚°" +set -g status-right "#[fg=#586e75,bg=#002b36,nobold,nounderscore,noitalics]ξ‚²#[fg=#93a1a1,bg=#586e75]#[fg=#657b83,bg=#586e75,nobold,nounderscore,noitalics]ξ‚²#[fg=#93a1a1,bg=#657b83]#[fg=#93a1a1,bg=#657b83,nobold,nounderscore,noitalics]ξ‚²#[fg=#15161E,bg=#93a1a1,bold] #h " + +setw -g window-status-activity-style "underscore,fg=#839496,bg=#002b36" +setw -g window-status-separator "" +setw -g window-status-style "NONE,fg=#839496,bg=#002b36" +setw -g window-status-format '#[fg=#002b36,bg=#002b36]ξ‚°#[default] #I ξ‚± #{b:pane_current_path} #[fg=#002b36,bg=#002b36,nobold,nounderscore,noitalics]ξ‚°' +setw -g window-status-current-format '#[fg=#002b36,bg=#eee8d5]ξ‚°#[fg=#b58900,bg=#eee8d5] #I #[fg=#eee8d5,bg=#b58900]ξ‚° #{b:pane_current_path} #[fg=#b58900,bg=#002b36,nobold]ξ‚°' diff --git a/tmux/theme.conf b/tmux/theme.conf new file mode 100644 index 0000000..37a022c --- /dev/null +++ b/tmux/theme.conf @@ -0,0 +1,24 @@ +#### COLOUR (Solarized 256) + +# default statusbar colors +set-option -g status-style bg=colour235,fg=colour136,default + +# default window title colors +set-window-option -g window-status-style fg=colour244,bg=colour234,dim + +# active window title colors +set-window-option -g window-status-current-style fg=colour166,bg=default,bright + +# pane border +set-option -g pane-border-style fg=colour235 #base02 +set-option -g pane-active-border-style fg=colour136,bg=colour235 + +# message text +set-option -g message-style bg=colour235,fg=colour166 + +# pane number display +set-option -g display-panes-active-colour colour33 #blue +set-option -g display-panes-colour colour166 #orange + +# clock +set-window-option -g clock-mode-colour colour64 #green diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..5c178d3 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,71 @@ +#set -g default-terminal "tmux-256color" +set -g default-terminal "xterm-256color" +#set -ga terminal-overrides ",*256col*:Tc" +set -ga terminal-overrides ",xterm-256color:Tc" +# action key +unbind C-b +set-option -g prefix C-t +set-option -g repeat-time 0 +set-option -g focus-events on + +#### Key bindings + +set-window-option -g mode-keys vi + +#bind a send-key C-t +# Reload settings +bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" +# Open current directory +bind o run-shell "open '#{pane_current_path}'" +bind -r e kill-pane -a + +# Select window +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# Moving window +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 3 +bind -r K resize-pane -U 3 +bind -r L resize-pane -R 5 + +# Split window +bind | split-window -h # Ctrl-a | +bind - split-window -v # Ctrl-a - +bind x kill-pane # Ctrl-a x +bind X kill-window # Ctrl-a X + +#### basic settings + +set-option -g status-justify "left" +#set-option utf8-default on +#set-option -g mouse-select-pane +set-window-option -g mode-keys vi +#set-window-option -g utf8 on +# look'n feel +set-option -g status-fg cyan +set-option -g status-bg black +set -g pane-active-border-style fg=colour166,bg=default +set -g window-style fg=colour10,bg=default +set -g window-active-style fg=colour12,bg=default +set-option -g history-limit 64096 + +set -sg escape-time 10 + + +# allow the title bar to adapt to whatever host you connect to +set -g set-titles on +set -g set-titles-string "#T" + +# import +if-shell "uname -s | grep -q Darwin" "source ~/.config/tmux/macos.conf" + +source ~/.config/tmux/theme.conf +source ~/.config/tmux/statusline.conf +source ~/.config/tmux/utility.conf + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-pain-control' +run '~/.config/tmux/plugins/tpm/tpm' diff --git a/tmux/utility.conf b/tmux/utility.conf new file mode 100644 index 0000000..1d63e94 --- /dev/null +++ b/tmux/utility.conf @@ -0,0 +1,3 @@ +# Display lazygit +bind -r g display-popup -d '#{pane_current_path}' -w80% -h80% -E lazygit +