mirror of
https://github.com/KevinMidboe/dotfiles.git
synced 2025-12-07 19:58:58 +00:00
update dotfiles 11.2024
This commit is contained in:
7
fish/completions/fisher.fish
Normal file
7
fish/completions/fisher.fish
Normal file
@@ -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)"
|
||||
185
fish/completions/git.fish
Normal file
185
fish/completions/git.fish
Normal file
@@ -0,0 +1,185 @@
|
||||
abbr -a -- ga 'git add'
|
||||
abbr -a -- gaa 'git add --all'
|
||||
abbr -a -- gapa 'git add --patch'
|
||||
abbr -a -- gau 'git add --update'
|
||||
abbr -a -- gav 'git add --verbose'
|
||||
abbr -a -- gap 'git apply'
|
||||
abbr -a -- gapt 'git apply --3way'
|
||||
|
||||
abbr -a -- gb 'git branch'
|
||||
abbr -a -- gba 'git branch --all'
|
||||
abbr -a -- gbd 'git branch --delete'
|
||||
abbr -a -- gbD 'git branch --delete --force'
|
||||
abbr -a -- gbl 'git blame -b -w'
|
||||
abbr -a -- gbnm 'git branch --no-merged'
|
||||
abbr -a -- gbr 'git branch --remote'
|
||||
abbr -a -- gbs 'git bisect'
|
||||
abbr -a -- gbsb 'git bisect bad'
|
||||
abbr -a -- gbsg 'git bisect good'
|
||||
abbr -a -- gbsr 'git bisect reset'
|
||||
abbr -a -- gbss 'git bisect start'
|
||||
|
||||
abbr -a -- gc 'git commit --verbose'
|
||||
abbr -a -- gc ='git commit --verbose --amend'
|
||||
abbr -a -- gcn ='git commit --verbose --no-edit --amend'
|
||||
abbr -a -- gca 'git commit --verbose --all'
|
||||
abbr -a -- gca ='git commit --verbose --all --amend'
|
||||
abbr -a -- gcan ='git commit --verbose --all --no-edit --amend'
|
||||
abbr -a -- gcans ='git commit --verbose --all --signoff --no-edit --amend'
|
||||
abbr -a -- gcam 'git commit --all --message'
|
||||
abbr -a -- gcsm 'git commit --signoff --message'
|
||||
abbr -a -- gcas 'git commit --all --signoff'
|
||||
abbr -a -- gcasm 'git commit --all --signoff --message'
|
||||
abbr -a -- gcb 'git checkout -b'
|
||||
abbr -a -- gcf 'git config --list'
|
||||
|
||||
abbr -a -- gcl 'git clone --recurse-submodules'
|
||||
abbr -a -- gclean 'git clean --interactive -d'
|
||||
abbr -a -- gpristine 'git reset --hard && git clean --force -dx'
|
||||
abbr -a -- gcm 'git checkout $(git_main_branch)'
|
||||
abbr -a -- gcd 'git checkout $(git_develop_branch)'
|
||||
abbr -a -- gcmsg 'git commit --message'
|
||||
abbr -a -- gco 'git checkout'
|
||||
abbr -a -- gcor 'git checkout --recurse-submodules'
|
||||
abbr -a -- gcount 'git shortlog --summary --numbered'
|
||||
abbr -a -- gcp 'git cherry-pick'
|
||||
abbr -a -- gcpa 'git cherry-pick --abort'
|
||||
abbr -a -- gcpc 'git cherry-pick --continue'
|
||||
abbr -a -- gcs 'git commit --gpg-sign'
|
||||
abbr -a -- gcss 'git commit --gpg-sign --signoff'
|
||||
abbr -a -- gcssm 'git commit --gpg-sign --signoff --message'
|
||||
|
||||
alias gd='git diff'
|
||||
alias gdca='git diff --cached'
|
||||
alias gdcw='git diff --cached --word-diff'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
alias gds='git diff --staged'
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gdup='git diff @{upstream}'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
abbr -a -- ggpull 'git pull origin "$(git_current_branch)"'
|
||||
abbr -a -- ggpush 'git push origin "$(git_current_branch)"'
|
||||
|
||||
abbr -a -- ggsup 'git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
abbr -a -- gpsup 'git push --set-upstream origin $(git_current_branch)'
|
||||
|
||||
abbr -a -- ghh 'git help'
|
||||
|
||||
abbr -a -- gignore 'git update-index --assume-unchanged'
|
||||
abbr -a -- gignored 'git ls-files -v | grep "^[[:lower:]]"'
|
||||
|
||||
abbr -a -- gk '\gitk --all --branches &!'
|
||||
abbr -a -- gke '\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||
|
||||
abbr -a -- gl 'git pull'
|
||||
abbr -a -- glg 'git log --stat'
|
||||
abbr -a -- glgp 'git log --stat --patch'
|
||||
abbr -a -- glgg 'git log --graph'
|
||||
abbr -a -- glgga 'git log --graph --decorate --all'
|
||||
abbr -a -- glgm 'git log --graph --max-count=10'
|
||||
abbr -a -- glo 'git log --oneline --decorate'
|
||||
abbr -a -- glol "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"
|
||||
abbr -a -- glols "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat"
|
||||
abbr -a -- glod "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
|
||||
abbr -a -- glods "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
|
||||
abbr -a -- glola "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all"
|
||||
abbr -a -- glog 'git log --oneline --decorate --graph'
|
||||
abbr -a -- gloga 'git log --oneline --decorate --graph --all'
|
||||
abbr -a -- glp "_git_log_prettily"
|
||||
|
||||
abbr -a -- gm 'git merge'
|
||||
abbr -a -- gmom 'git merge origin/$(git_main_branch)'
|
||||
abbr -a -- gmtl 'git mergetool --no-prompt'
|
||||
abbr -a -- gmtlvim 'git mergetool --no-prompt --tool=vimdiff'
|
||||
abbr -a -- gmum 'git merge upstream/$(git_main_branch)'
|
||||
abbr -a -- gma 'git merge --abort'
|
||||
|
||||
abbr -a -- gp 'git push'
|
||||
abbr -a -- gpd 'git push --dry-run'
|
||||
abbr -a -- gpf 'git push --force-with-lease'
|
||||
abbr -a -- gpf ='git push --force'
|
||||
abbr -a -- gpoat 'git push origin --all && git push origin --tags'
|
||||
abbr -a -- gpr 'git pull --rebase'
|
||||
abbr -a -- gpu 'git push upstream'
|
||||
abbr -a -- gpv 'git push --verbose'
|
||||
|
||||
abbr -a -- gr 'git remote'
|
||||
abbr -a -- gra 'git remote add'
|
||||
abbr -a -- grb 'git rebase'
|
||||
abbr -a -- grba 'git rebase --abort'
|
||||
abbr -a -- grbc 'git rebase --continue'
|
||||
abbr -a -- grbd 'git rebase $(git_develop_branch)'
|
||||
abbr -a -- grbi 'git rebase --interactive'
|
||||
abbr -a -- grbm 'git rebase $(git_main_branch)'
|
||||
abbr -a -- grbom 'git rebase origin/$(git_main_branch)'
|
||||
abbr -a -- grbo 'git rebase --onto'
|
||||
abbr -a -- grbs 'git rebase --skip'
|
||||
abbr -a -- grev 'git revert'
|
||||
abbr -a -- grh 'git reset'
|
||||
abbr -a -- grhh 'git reset --hard'
|
||||
abbr -a -- groh 'git reset origin/$(git_current_branch) --hard'
|
||||
abbr -a -- grm 'git rm'
|
||||
abbr -a -- grmc 'git rm --cached'
|
||||
abbr -a -- grmv 'git remote rename'
|
||||
abbr -a -- grrm 'git remote remove'
|
||||
abbr -a -- grs 'git restore'
|
||||
abbr -a -- grset 'git remote set-url'
|
||||
abbr -a -- grss 'git restore --source'
|
||||
abbr -a -- grst 'git restore --staged'
|
||||
abbr -a -- grt 'cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||
abbr -a -- gru 'git reset --'
|
||||
abbr -a -- grup 'git remote update'
|
||||
abbr -a -- grv 'git remote --verbose'
|
||||
|
||||
abbr -a -- gsb 'git status --short --branch'
|
||||
abbr -a -- gsd 'git svn dcommit'
|
||||
abbr -a -- gsh 'git show'
|
||||
abbr -a -- gsi 'git submodule init'
|
||||
abbr -a -- gsps 'git show --pretty=short --show-signature'
|
||||
abbr -a -- gsr 'git svn rebase'
|
||||
abbr -a -- gss 'git status --short'
|
||||
abbr -a -- gst 'git status'
|
||||
|
||||
abbr -a -- gstaa 'git stash apply'
|
||||
abbr -a -- gstc 'git stash clear'
|
||||
abbr -a -- gstd 'git stash drop'
|
||||
abbr -a -- gstl 'git stash list'
|
||||
abbr -a -- gstp 'git stash pop'
|
||||
abbr -a -- gsts 'git stash show --text'
|
||||
abbr -a -- gstu 'gsta --include-untracked'
|
||||
abbr -a -- gstall 'git stash --all'
|
||||
abbr -a -- gsu 'git submodule update'
|
||||
abbr -a -- gsw 'git switch'
|
||||
abbr -a -- gswc 'git switch --create'
|
||||
abbr -a -- gswm 'git switch $(git_main_branch)'
|
||||
abbr -a -- gswd 'git switch $(git_develop_branch)'
|
||||
|
||||
abbr -a -- gts 'git tag --sign'
|
||||
abbr -a -- gtv 'git tag | sort -V'
|
||||
abbr -a -- gtl 'gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
|
||||
|
||||
abbr -a -- gunignore 'git update-index --no-assume-unchanged'
|
||||
abbr -a -- gunwip 'git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1'
|
||||
abbr -a -- gup 'git pull --rebase'
|
||||
abbr -a -- gupv 'git pull --rebase --verbose'
|
||||
abbr -a -- gupa 'git pull --rebase --autostash'
|
||||
abbr -a -- gupav 'git pull --rebase --autostash --verbose'
|
||||
abbr -a -- gupom 'git pull --rebase origin $(git_main_branch)'
|
||||
abbr -a -- gupomi 'git pull --rebase=interactive origin $(git_main_branch)'
|
||||
abbr -a -- glum 'git pull upstream $(git_main_branch)'
|
||||
abbr -a -- gluc 'git pull upstream $(git_current_branch)'
|
||||
|
||||
abbr -a -- gwch 'git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
abbr -a -- gwip 'git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
|
||||
abbr -a -- gwt 'git worktree'
|
||||
abbr -a -- gwta 'git worktree add'
|
||||
abbr -a -- gwtls 'git worktree list'
|
||||
abbr -a -- gwtmv 'git worktree move'
|
||||
abbr -a -- gwtrm 'git worktree remove'
|
||||
abbr -a -- gam 'git am'
|
||||
abbr -a -- gamc 'git am --continue'
|
||||
abbr -a -- gams 'git am --skip'
|
||||
abbr -a -- gama 'git am --abort'
|
||||
abbr -a -- gamscp 'git am --show-current-patch'
|
||||
|
||||
7
fish/conf.d/omf.fish
Normal file
7
fish/conf.d/omf.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
# Path to Oh My Fish install.
|
||||
set -q XDG_DATA_HOME
|
||||
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
||||
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
||||
|
||||
# Load Oh My Fish configuration.
|
||||
source $OMF_PATH/init.fish
|
||||
17
fish/config.fish
Normal file
17
fish/config.fish
Normal file
@@ -0,0 +1,17 @@
|
||||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
end
|
||||
|
||||
source $HOME/.profile
|
||||
|
||||
# Common programs
|
||||
abbr -a -- vi nvim
|
||||
|
||||
# File exploring
|
||||
abbr -a -- l 'tree -L 1 -a'
|
||||
abbr -a -- ll 'tree -L 2 -a'
|
||||
|
||||
# Git (loaded from completions/git.fish)
|
||||
source $HOME/.config/fish/completions/git.fish
|
||||
|
||||
# thefuck --alias | source
|
||||
1
fish/fish_plugins
Normal file
1
fish/fish_plugins
Normal file
@@ -0,0 +1 @@
|
||||
jorgebucaran/fisher
|
||||
33
fish/fish_variables
Normal file
33
fish/fish_variables
Normal file
@@ -0,0 +1,33 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR __fish_initialized:3400
|
||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:blue
|
||||
SETUVAR fish_color_comment:red
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:green
|
||||
SETUVAR fish_color_error:brred
|
||||
SETUVAR fish_color_escape:brcyan
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_host_remote:yellow
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:brcyan
|
||||
SETUVAR fish_color_param:cyan
|
||||
SETUVAR fish_color_quote:yellow
|
||||
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
|
||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||
SETUVAR fish_pager_color_completion:normal
|
||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di
|
||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||
SETUVAR fish_user_paths:/opt/homebrew/opt/ruby\x402\x2e7/bin
|
||||
240
fish/functions/fisher.fish
Normal file
240
fish/functions/fisher.fish
Normal file
@@ -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.3
|
||||
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 <plugins...> Install plugins"
|
||||
echo " fisher remove <plugins...> Remove installed plugins"
|
||||
echo " fisher update <plugins...> Update installed plugins"
|
||||
echo " fisher update Update all installed plugins"
|
||||
echo " fisher list [<regex>] List installed plugins matching regex"
|
||||
echo "Options:"
|
||||
echo " -v or --version Print version"
|
||||
echo " -h or --help Print this help message"
|
||||
echo "Variables:"
|
||||
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
||||
case ls list
|
||||
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
||||
case install update remove
|
||||
isatty || read --local --null --array stdin && set --append argv $stdin
|
||||
|
||||
set --local install_plugins
|
||||
set --local update_plugins
|
||||
set --local remove_plugins
|
||||
set --local arg_plugins $argv[2..-1]
|
||||
set --local old_plugins $_fisher_plugins
|
||||
set --local new_plugins
|
||||
|
||||
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
|
||||
|
||||
if ! set --query argv[2]
|
||||
if test "$cmd" != update
|
||||
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
|
||||
else if ! set --query file_plugins
|
||||
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
||||
end
|
||||
set arg_plugins $file_plugins
|
||||
end
|
||||
|
||||
for plugin in $arg_plugins
|
||||
set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
|
||||
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
|
||||
end
|
||||
|
||||
if set --query argv[2]
|
||||
for plugin in $new_plugins
|
||||
if contains -- "$plugin" $old_plugins
|
||||
test "$cmd" = remove &&
|
||||
set --append remove_plugins $plugin ||
|
||||
set --append update_plugins $plugin
|
||||
else if test "$cmd" = install
|
||||
set --append install_plugins $plugin
|
||||
else
|
||||
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
|
||||
end
|
||||
end
|
||||
else
|
||||
for plugin in $new_plugins
|
||||
contains -- "$plugin" $old_plugins &&
|
||||
set --append update_plugins $plugin ||
|
||||
set --append install_plugins $plugin
|
||||
end
|
||||
|
||||
for plugin in $old_plugins
|
||||
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
|
||||
end
|
||||
end
|
||||
|
||||
set --local pid_list
|
||||
set --local source_plugins
|
||||
set --local fetch_plugins $update_plugins $install_plugins
|
||||
set --local fish_path (status fish-path)
|
||||
|
||||
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
|
||||
|
||||
for plugin in $fetch_plugins
|
||||
set --local source (command mktemp -d)
|
||||
set --append source_plugins $source
|
||||
|
||||
command mkdir -p $source/{completions,conf.d,themes,functions}
|
||||
|
||||
$fish_path --command "
|
||||
if test -e $plugin
|
||||
command cp -Rf $plugin/* $source
|
||||
else
|
||||
set temp (command mktemp -d)
|
||||
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
||||
|
||||
if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
|
||||
set name (string split -- / \$path)[-1]
|
||||
set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
|
||||
else
|
||||
set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
|
||||
end
|
||||
|
||||
echo Fetching (set_color --underline)\$url(set_color normal)
|
||||
|
||||
if curl --silent -L \$url | tar -xzC \$temp -f - 2>/dev/null
|
||||
command cp -Rf \$temp/*/* $source
|
||||
else
|
||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||
command rm -rf $source
|
||||
end
|
||||
|
||||
command rm -rf \$temp
|
||||
end
|
||||
|
||||
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
|
||||
" &
|
||||
|
||||
set --append pid_list (jobs --last --pid)
|
||||
end
|
||||
|
||||
wait $pid_list 2>/dev/null
|
||||
|
||||
for plugin in $fetch_plugins
|
||||
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
|
||||
if set --local index (contains --index -- "$plugin" $install_plugins)
|
||||
set --erase install_plugins[$index]
|
||||
else
|
||||
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for plugin in $update_plugins $remove_plugins
|
||||
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
|
||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||
|
||||
if contains -- "$plugin" $remove_plugins
|
||||
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||
emit {$name}_uninstall
|
||||
end
|
||||
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||
set --erase _fisher_plugins[$index]
|
||||
end
|
||||
|
||||
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
|
||||
|
||||
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||
|
||||
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||
complete --erase --command $name
|
||||
end
|
||||
|
||||
set --erase $plugin_files_var
|
||||
end
|
||||
end
|
||||
|
||||
if set --query update_plugins[1] || set --query install_plugins[1]
|
||||
command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
|
||||
end
|
||||
|
||||
for plugin in $update_plugins $install_plugins
|
||||
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
|
||||
set --local files $source/{functions,themes,conf.d,completions}/*
|
||||
|
||||
if set --local index (contains --index -- $plugin $install_plugins)
|
||||
set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
|
||||
set --local conflict_files
|
||||
|
||||
for file in (string replace -- $source/ $fisher_path/ $files)
|
||||
contains -- $file $user_files && set --append conflict_files $file
|
||||
end
|
||||
|
||||
if set --query conflict_files[1] && set --erase install_plugins[$index]
|
||||
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
for file in (string replace -- $source/ "" $files)
|
||||
command cp -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
|
||||
|
||||
printf "%s\n" $commit_plugins >$fish_plugins
|
||||
else
|
||||
set --erase _fisher_plugins
|
||||
command rm -f $fish_plugins
|
||||
end
|
||||
|
||||
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
|
||||
|
||||
test "$total" != "0 0 0" && echo (string join ", " (
|
||||
test $total[1] = 0 || echo "Installed $total[1]") (
|
||||
test $total[2] = 0 || echo "Updated $total[2]") (
|
||||
test $total[3] = 0 || echo "Removed $total[3]")
|
||||
) plugin/s
|
||||
case \*
|
||||
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
|
||||
end
|
||||
end
|
||||
|
||||
if ! set --query _fisher_upgraded_to_4_4
|
||||
set --universal _fisher_upgraded_to_4_4
|
||||
if functions --query _fisher_list
|
||||
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
|
||||
command rm -rf $XDG_DATA_HOME/fisher
|
||||
functions --erase _fisher_{list,plugin_parse}
|
||||
fisher update >/dev/null 2>/dev/null
|
||||
else
|
||||
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
|
||||
set $var (string replace -- ~ \~ $$var)
|
||||
end
|
||||
functions --erase _fisher_fish_postexec
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user