From 34eafb22c6ae7d24f09f19ad7e418928c84dc655 Mon Sep 17 00:00:00 2001 From: Shawn Anderson Date: Thu, 27 Oct 2022 15:34:17 -0700 Subject: [PATCH] Add fish_command_timer to fishfile, also remove custom fisher plugins from this repository. I should be making stand alone fish plugins and then source them in fishfile like normal. --- .../fisher/fish-audio/pacmd-loopback.fish | 8 - .../__fzf_display_value_or_error.fish | 10 - .../fisher/fish-fzf/__fzf_preview_file.fish | 28 -- .../fish-fzf/__fzf_report_file_type.fish | 6 - .../fish-fzf/__fzf_search_current_dir.fish | 16 - .../fisher/fish-fzf/__fzf_search_git_log.fish | 20 -- .../fish-fzf/__fzf_search_git_status.fish | 29 -- .../fisher/fish-fzf/__fzf_search_history.fish | 17 - .../__fzf_search_shell_variables.fish | 21 -- dotfiles/.config/fish/fisher/fish-fzf/d.fish | 5 - .../fish/fisher/fish-fzf/fzf-bcd-widget.fish | 6 - .../fisher/fish-fzf/fzf-cdhist-widget.fish | 15 - .../fish/fisher/fish-fzf/fzf-complete.fish | 46 --- .../fish/fisher/fish-fzf/fzf-select.fish | 8 - .../fisher/fish-fzf/fzf_key_bindings.fish | 1 - .../fisher/fish-github/__github_add_org.fish | 9 - .../fish-github/__github_get_org_repos.fish | 9 - .../fisher/fish-github/conf.d/github.fish | 6 - .../.config/fish/fisher/fish-github/fcd.fish | 19 -- .../fish/fisher/fish-github/fclone.fish | 17 - .../.config/fish/fisher/fish-github/fhub.fish | 17 - .../fish/fisher/fish-github/fkill.fish | 7 - .../fisher/fish-github/forgit.plugin.fish | 299 ------------------ .../fish/fisher/fish-github/readme.fish | 6 - .../fish/fisher/fish-utils/EditDailyLog.fish | 3 - .../fish/fisher/fish-utils/LogDirectory.fish | 3 - .../fisher/fish-utils/OpenLogDirectory.fish | 4 - .../fish/fisher/fish-utils/RunBackup.fish | 29 -- .../fisher/fish-utils/create_daily_log.fish | 3 - dotfiles/.config/fish/fishfile | 5 +- 30 files changed, 1 insertion(+), 671 deletions(-) delete mode 100644 dotfiles/.config/fish/fisher/fish-audio/pacmd-loopback.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_display_value_or_error.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_preview_file.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_report_file_type.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_current_dir.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_log.fish delete mode 100755 dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_status.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_history.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_shell_variables.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/d.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/fzf-bcd-widget.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/fzf-cdhist-widget.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/fzf-complete.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-fzf/fzf-select.fish delete mode 120000 dotfiles/.config/fish/fisher/fish-fzf/fzf_key_bindings.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/__github_add_org.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/__github_get_org_repos.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/conf.d/github.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/fcd.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/fclone.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/fhub.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/fkill.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/forgit.plugin.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-github/readme.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-utils/EditDailyLog.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-utils/LogDirectory.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-utils/OpenLogDirectory.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-utils/RunBackup.fish delete mode 100644 dotfiles/.config/fish/fisher/fish-utils/create_daily_log.fish diff --git a/dotfiles/.config/fish/fisher/fish-audio/pacmd-loopback.fish b/dotfiles/.config/fish/fisher/fish-audio/pacmd-loopback.fish deleted file mode 100644 index 99c4192..0000000 --- a/dotfiles/.config/fish/fisher/fish-audio/pacmd-loopback.fish +++ /dev/null @@ -1,8 +0,0 @@ -# Defined in /tmp/fish.nJXl9C/pacmd-loopback.fish @ line 1 -function pacmd-loopback --description 'Loop a pacmd source into a pacmd sink interactively.' - if test (set source (pacmd list-sources | grep name: | awk '{ print $2 }' | cut -d'<' -f2 | cut -d'>' -f1 | fzf-tmux --header="Select a source" --phony); set sink (pacmd list-sinks | grep name: | awk '{ print $2 }' | cut -d'<' -f2 | cut -d'>' -f1 | fzf-tmux --header="Select a sink:"); printf "No\nYes" | fzf-tmux --header="CONFIRM: <$source> -> <$sink>") = "Yes" - pacmd load-module module-loopback source=$source sink=$sink - else - echo "Aborted." - end -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_display_value_or_error.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_display_value_or_error.fish deleted file mode 100644 index 6d10f0a..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_display_value_or_error.fish +++ /dev/null @@ -1,10 +0,0 @@ -# helper function for __fzf_search_shell_variables -function __fzf_display_value_or_error --argument-names variable_name --description "Displays either the value of the variable passed in, or an informative message if it is not available." - if set --query $variable_name - echo $$variable_name - else - set_color red - echo "$variable_name was not exported to this process so its value cannot be displayed." >&2 - set_color normal - end -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_preview_file.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_preview_file.fish deleted file mode 100644 index d0a9a95..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_preview_file.fish +++ /dev/null @@ -1,28 +0,0 @@ -# helper function for __fzf_search_current_dir -function __fzf_preview_file --argument-names file_path --description "Prints a preview for the given file based on its file type." - if test -f "$file_path" # regular file - bat --style=numbers --color=always "$file_path" - else if test -d "$file_path" # directory - set --local CLICOLOR_FORCE true - ls -a "$file_path" - else if test -L "$file_path" # symlink - # notify user and recurse on the target of the symlink, which can be any of these file types - set -l target_path (realpath $file_path) - - set_color yellow - echo "'$file_path' is a symlink to '$target_path'." - set_color normal - - __fzf_preview_file "$target_path" - else if test -c "$file_path" - __fzf_report_file_type "$file_path" "character device file" - else if test -b "$file_path" - __fzf_report_file_type "$file_path" "block device file" - else if test -S "$file_path" - __fzf_report_file_type "$file_path" "socket" - else if test -p "$file_path" - __fzf_report_file_type "$file_path" "named pipe" - else - echo "Unexpected file symbol $file_type_char. Please open an issue at https://github.com/patrickf3139/fzf.fish." >&2 - end -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_report_file_type.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_report_file_type.fish deleted file mode 100644 index e92eb02..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_report_file_type.fish +++ /dev/null @@ -1,6 +0,0 @@ -# helper function for __fzf_preview_file -function __fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file." - set_color red - echo "Cannot preview '$file_path': it is a $file_type." - set_color normal -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_current_dir.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_current_dir.fish deleted file mode 100644 index 9435434..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_current_dir.fish +++ /dev/null @@ -1,16 +0,0 @@ -# originally implemented and transposed from https://github.com/patrickf3139/dotfiles/pull/11 -function __fzf_search_current_dir --description "Search the current directory using fzf and fd. Insert the selected relative file path into the commandline at the cursor." - # Make sure that fzf uses fish to execute __fzf_preview_file. - # See similar comment in __fzf_search_shell_variables.fish. - set --local --export SHELL (command --search fish) - set file_path_selected ( - fd --hidden --follow --color=always --exclude=.git 2> /dev/null | - fzf --ansi --preview='__fzf_preview_file {}' - ) - - if test $status -eq 0 - commandline --insert (echo $file_path_selected | string escape) - end - - commandline --function repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_log.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_log.fish deleted file mode 100644 index ffc7286..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_log.fish +++ /dev/null @@ -1,20 +0,0 @@ -# Originally implemented in and transposed from https://github.com/patrickf3139/dotfiles/pull/2 -function __fzf_search_git_log --description "Search the git log of the current git repository. Insert the selected commit hash into the commandline at the cursor." - if not git rev-parse --git-dir >/dev/null 2>&1 - echo '__fzf_search_git_log: Not in a git repository.' >&2 - else - set selected_log_line ( - # see documentation for git format placeholders at https://git-scm.com/docs/git-log#Documentation/git-log.txt-emnem - # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below - git log --color=always --format=format:'%C(bold blue)%h%C(reset) - %C(cyan)%as%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' | \ - fzf --ansi --tiebreak=index --preview='git show --color=always (string split --max 1 " " {})[1]' - ) - if test $status -eq 0 - set abbreviated_commit_hash (string split --max 1 " " $selected_log_line)[1] - set commit_hash (git rev-parse $abbreviated_commit_hash) - commandline --insert $commit_hash - end - end - - commandline --function repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_status.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_status.fish deleted file mode 100755 index 153b95a..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_git_status.fish +++ /dev/null @@ -1,29 +0,0 @@ -function __fzf_search_git_status --description "Search the git status of the current git repository. Insert the selected file paths into the commandline at the cursor." - if not git rev-parse --git-dir >/dev/null 2>&1 - echo '__fzf_search_git_status: Not in a git repository.' >&2 - else - set selected_paths ( - # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe - git -c color.status=always status --short | - fzf --ansi --multi - ) - if test $status -eq 0 - # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle - # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") - for path in $selected_paths - if test (string sub --length 1 $path) = 'R' - # path has been renamed and looks like "R LICENSE -> LICENSE.md" - # extract the path to use from after the arrow - set cleaned_path (string split -- "-> " $path)[-1] - else - set cleaned_path (string sub --start=4 $path) - end - # add a space after each path to keep them separated when inserted - set cleaned_path_padded "$cleaned_path " - commandline --insert $cleaned_path_padded - end - end - - commandline --function repaint - end -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_history.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_history.fish deleted file mode 100644 index 843a55b..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_history.fish +++ /dev/null @@ -1,17 +0,0 @@ -# originally implemented and transposed from https://github.com/patrickf3139/dotfiles/pull/11 -function __fzf_search_history --description "Search command history using fzf. Replace the commandline with the selected command." - # history merge incorporates history changes from other fish sessions - history merge - set command_with_ts ( - # Reference https://devhints.io/strftime to understand strftime format symbols - history --null --show-time="%m/%e %H:%M:%S | " | - fzf --read0 --tiebreak=index --query=(commandline) - ) - - if test $status -eq 0 - set command_selected (string split --max 1 " | " $command_with_ts)[2] - commandline --replace $command_selected - end - - commandline --function repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_shell_variables.fish b/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_shell_variables.fish deleted file mode 100644 index 906a395..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/__fzf_search_shell_variables.fish +++ /dev/null @@ -1,21 +0,0 @@ -function __fzf_search_shell_variables --description "Search and inspect shell variables using fzf. Insert the selected variable into the commandline at the cursor." - # Make sure that fzf uses fish to execute __echo_value_or_print_message, which - # is an autoloaded fish function so doesn't exist in other shells. - # Using --local so that it does not clobber SHELL outside of this function. - set --local --export SHELL (command --search fish) - - # Pipe the names of all shell variables to fzf and attempt to display the value - # of the selected variable in fzf's preview window. - # Non-exported variables will not be accessible to the fzf process, in which case - # __echo_value_or_print_message will print an informative message in lieu of the value. - set variable_name ( - set --names | - fzf --preview '__fzf_display_value_or_error {}' - ) - - if test $status -eq 0 - commandline --insert $variable_name - end - - commandline --function repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/d.fish b/dotfiles/.config/fish/fisher/fish-fzf/d.fish deleted file mode 100644 index 68985c1..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/d.fish +++ /dev/null @@ -1,5 +0,0 @@ -# Defined in /tmp/fish.sM92eA/d.fish @ line 2 -function d - __fastdir_dirhist -l -n | awk -v OFS='%s' '{print $2}' | awk '!x[$0]++' | fzf-tmux -end -#test diff --git a/dotfiles/.config/fish/fisher/fish-fzf/fzf-bcd-widget.fish b/dotfiles/.config/fish/fisher/fish-fzf/fzf-bcd-widget.fish deleted file mode 100644 index 07dc544..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/fzf-bcd-widget.fish +++ /dev/null @@ -1,6 +0,0 @@ -# https://github.com/junegunn/fzf/wiki/Examples-(fish) -function fzf-bcd-widget -d 'cd backwards' - pwd | awk -v RS=/ '/\n/ {exit} {p=p $0 "/"; print p}' | tac | eval (__fzfcmd) +m --select-1 --exit-0 $FZF_BCD_OPTS | read -l result - [ "$result" ]; and cd $result - commandline -f repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/fzf-cdhist-widget.fish b/dotfiles/.config/fish/fisher/fish-fzf/fzf-cdhist-widget.fish deleted file mode 100644 index 31bd6f7..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/fzf-cdhist-widget.fish +++ /dev/null @@ -1,15 +0,0 @@ -# From https://github.com/junegunn/fzf/wiki/Examples-(fish) -function fzf-cdhist-widget -d 'cd to one of the previously visited locations' - # Clear non-existent folders from cdhist. - set -l buf - for i in (seq 1 (count $dirprev)) - set -l dir $dirprev[$i] - if test -d $dir - set buf $buf $dir - end - end - set dirprev $buf - string join \n $dirprev | tac | sed 1d | eval (__fzfcmd) +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CDHIST_OPTS | read -l result - [ "$result" ]; and cd $result - commandline -f repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/fzf-complete.fish b/dotfiles/.config/fish/fisher/fish-fzf/fzf-complete.fish deleted file mode 100644 index 0ca0484..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/fzf-complete.fish +++ /dev/null @@ -1,46 +0,0 @@ -# From https://github.com/junegunn/fzf/wiki/Examples-(fish) -function fzf-complete -d 'fzf completion and print selection back to commandline' - # As of 2.6, fish's "complete" function does not understand - # subcommands. Instead, we use the same hack as __fish_complete_subcommand and - # extract the subcommand manually. - set -l cmd (commandline -co) (commandline -ct) - switch $cmd[1] - case env sudo - for i in (seq 2 (count $cmd)) - switch $cmd[$i] - case '-*' - case '*=*' - case '*' - set cmd $cmd[$i..-1] - break - end - end - end - set cmd (string join -- ' ' $cmd) - - set -l complist (complete -C$cmd) - set -l result - string join -- \n $complist | sort | eval (__fzfcmd) -m --select-1 --exit-0 --header '(commandline)' | cut -f1 | while read -l r; set result $result $r; end - - set prefix (string sub -s 1 -l 1 -- (commandline -t)) - for i in (seq (count $result)) - set -l r $result[$i] - switch $prefix - case "'" - commandline -t -- (string escape -- $r) - case '"' - if string match '*"*' -- $r >/dev/null - commandline -t -- (string escape -- $r) - else - commandline -t -- '"'$r'"' - end - case '~' - commandline -t -- (string sub -s 2 (string escape -n -- $r)) - case '*' - commandline -t -- (string escape -n -- $r) - end - [ $i -lt (count $result) ]; and commandline -i ' ' - end - - commandline -f repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/fzf-select.fish b/dotfiles/.config/fish/fisher/fish-fzf/fzf-select.fish deleted file mode 100644 index 88eab28..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/fzf-select.fish +++ /dev/null @@ -1,8 +0,0 @@ -# From https://github.com/junegunn/fzf/wiki/Examples-(fish) -function fzf-select -d 'fzf commandline job and print unescaped selection back to commandline' - set -l cmd (commandline -j) - [ "$cmd" ]; or return - eval $cmd | eval (__fzfcmd) -m --tiebreak=index --select-1 --exit-0 | string join ' ' | read -l result - [ "$result" ]; and commandline -j -- $result - commandline -f repaint -end diff --git a/dotfiles/.config/fish/fisher/fish-fzf/fzf_key_bindings.fish b/dotfiles/.config/fish/fisher/fish-fzf/fzf_key_bindings.fish deleted file mode 120000 index 4b95db2..0000000 --- a/dotfiles/.config/fish/fisher/fish-fzf/fzf_key_bindings.fish +++ /dev/null @@ -1 +0,0 @@ -/home/ygg/.local/share/nvim/plugged/fzf/shell/key-bindings.fish \ No newline at end of file diff --git a/dotfiles/.config/fish/fisher/fish-github/__github_add_org.fish b/dotfiles/.config/fish/fisher/fish-github/__github_add_org.fish deleted file mode 100644 index 3e7237a..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/__github_add_org.fish +++ /dev/null @@ -1,9 +0,0 @@ -# Defined in /tmp/fish.azx9vq/__github_add_org.fish @ line 1 -function __github_add_org --description 'Add an organization name to the local share fzf file.' --argument org - if ! test -n "$org" - echo "Please provide and org name!" - return 1 - else - echo $org >> ~/.local/share/fzf/github_orgs - end -end diff --git a/dotfiles/.config/fish/fisher/fish-github/__github_get_org_repos.fish b/dotfiles/.config/fish/fisher/fish-github/__github_get_org_repos.fish deleted file mode 100644 index 870e195..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/__github_get_org_repos.fish +++ /dev/null @@ -1,9 +0,0 @@ -# Defined in /tmp/fish.mAOD6Y/__github_get_org_repos.fish @ line 2 -function __github_get_org_repos --description 'Return a list of all the github repos owned by a github organization.' --argument org - if ! test -n "$org" - echo "Please provide a github organization name." - return 1 - else - curl "https://api.github.com/orgs/$org/repos?per_page=100&page=1" | jq '.[].full_name' | awk -F'"' '{print $2}' - end -end diff --git a/dotfiles/.config/fish/fisher/fish-github/conf.d/github.fish b/dotfiles/.config/fish/fisher/fish-github/conf.d/github.fish deleted file mode 100644 index d8796b6..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/conf.d/github.fish +++ /dev/null @@ -1,6 +0,0 @@ -#------------------------------------------------------------------------------- -# From https://github.com/wfxr/forgit -# Forgit plugin requires sourcing to activate abbreviations -source ~/.config/fish/functions/forgit.plugin.fish - - diff --git a/dotfiles/.config/fish/fisher/fish-github/fcd.fish b/dotfiles/.config/fish/fisher/fish-github/fcd.fish deleted file mode 100644 index c8c5cf5..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/fcd.fish +++ /dev/null @@ -1,19 +0,0 @@ -function fcd -d "Fuzzy change directory" - if set -q argv[1] - set searchdir $argv[1] - else - set searchdir $HOME - end - - # https://github.com/fish-shell/fish-shell/issues/1362 - set -l tmpfile (mktemp) - find $searchdir \( ! -regex '.*/\..*' \) ! -name __pycache__ -type d | fzf > $tmpfile - set -l destdir (cat $tmpfile) - rm -f $tmpfile - - if test -z "$destdir" - return 1 - end - - cd $destdir -end diff --git a/dotfiles/.config/fish/fisher/fish-github/fclone.fish b/dotfiles/.config/fish/fisher/fish-github/fclone.fish deleted file mode 100644 index 998079c..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/fclone.fish +++ /dev/null @@ -1,17 +0,0 @@ -# Defined in /tmp/fish.yoQzI0/fclone.fish @ line 2 -function fclone --argument org - if ! test -n "$org" - set org_file ~/.local/share/fzf/github_orgs - if ! test -e $org_file - echo -n "Please provide an organization name either as an argument to this command or in a list at $org_file" - return 1 - else - set org (cat $org_file | fzf-tmux -e --header="Please select an organization. Set additional orgs in $org_file") - end - end - set repo (__github_get_org_repos $org | fzf-tmux --header="Please select a repository to clone.") - if test -n "$repo" - echo "Cloning '$repo' from Github" - git clone "https://github.com/$repo.git" - end -end diff --git a/dotfiles/.config/fish/fisher/fish-github/fhub.fish b/dotfiles/.config/fish/fisher/fish-github/fhub.fish deleted file mode 100644 index 0a8310b..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/fhub.fish +++ /dev/null @@ -1,17 +0,0 @@ -# Defined in /tmp/fish.T4Z5Kp/fclone.fish @ line 2 -function fhub --argument org - if ! test -n "$org" - set org_file ~/.local/share/fzf/github_orgs - if ! test -e $org_file - echo -n "Please provide an organization name either as an argument to this command or in a list at $org_file" - return 1 - else - set org (cat $org_file | fzf-tmux -e --header="Please select an organization. Set additional orgs in $org_file") - end - end - set repo (__github_get_org_repos $org | fzf-tmux --header="Please select a repository to clone.") - if test -n "$repo" - echo "Opening '$repo' in Web Browser" - hub browse $repo - end -end diff --git a/dotfiles/.config/fish/fisher/fish-github/fkill.fish b/dotfiles/.config/fish/fisher/fish-github/fkill.fish deleted file mode 100644 index 04cd1a1..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/fkill.fish +++ /dev/null @@ -1,7 +0,0 @@ -function fkill -d "Fuzzy kill" - set pid (ps -ef | sed 1d | fzf -m | awk '{print $2}') - - if test -n "$pid" - echo $pid | xargs kill -9 - end -end diff --git a/dotfiles/.config/fish/fisher/fish-github/forgit.plugin.fish b/dotfiles/.config/fish/fisher/fish-github/forgit.plugin.fish deleted file mode 100644 index 4deb289..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/forgit.plugin.fish +++ /dev/null @@ -1,299 +0,0 @@ -#!/usr/local/bin/fish -# MIT (c) Chris Apple - -function forgit::warn - printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$argv" >&2; -end - -function forgit::info - printf "%b[Info]%b %s\n" '\e[0;32m' '\e[0m' "$argv" >&2; -end - -function forgit::inside_work_tree - git rev-parse --is-inside-work-tree >/dev/null; -end - -set forgit_pager "$FORGIT_PAGER" -set forgit_show_pager "$FORGIT_SHOW_PAGER" -set forgit_diff_pager "$FORGIT_DIFF_PAGER" -set forgit_ignore_pager "$FORGIT_IGNORE_PAGER" - -test -z "$forgit_pager"; and set forgit_pager (git config core.pager || echo 'cat') -test -z "$forgit_show_pager"; and set forgit_show_pager (git config pager.show || echo "$forgit_pager") -test -z "$forgit_diff_pager"; and set forgit_diff_pager (git config pager.diff || echo "$forgit_pager") -test -z "$forgit_ignore_pager"; and set forgit_ignore_pager (type -q bat >/dev/null 2>&1 && echo 'bat -l gitignore --color=always' || echo 'cat') - -# https://github.com/wfxr/emoji-cli -type -q emojify >/dev/null 2>&1 && set forgit_emojify '|emojify' - -# git commit viewer -function forgit::log - forgit::inside_work_tree || return 1 - - set files (echo $argv | sed -nE 's/.* -- (.*)/\1/p') - set cmd "echo {} |grep -Eo '[a-f0-9]+' |head -1 |xargs -I% git show --color=always % -- $files | $forgit_show_pager" - - if test -n "$FORGIT_COPY_CMD" - set copy_cmd $FORGIT_COPY_CMD - else - set copy_cmd pbcopy - end - - set opts " - $FORGIT_FZF_DEFAULT_OPTS - +s +m --tiebreak=index - --bind=\"enter:execute($cmd |env LESS='-R' less)\" - --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '\n' | $copy_cmd)\" - $FORGIT_LOG_FZF_OPTS - " - - if set -q FORGIT_LOG_GRAPH_ENABLE - set graph "--graph" - else - set graph "" - end - - eval "git log $graph --color=always --format='%C(auto)%h%d %s %C(black)%C(bold)%cr' $argv $forgit_emojify" | - env FZF_DEFAULT_OPTS="$opts" fzf --preview="$cmd" -end - -## git diff viewer -function forgit::diff - forgit::inside_work_tree || return 1 - if count $argv > /dev/null - if git rev-parse "$1" > /dev/null 2>&1 - #set commit "$1" && set files ("${@:2}") - set commit "$1" && set files "$2" - else - set files "$argv" - end - end - - set repo (git rev-parse --show-toplevel) - set opts " - $FORGIT_FZF_DEFAULT_OPTS - +m -0 --bind=\"enter:execute($cmd |env LESS='-R' less)\" - $FORGIT_DIFF_FZF_OPTS - " - - set cmd "echo {} |sed 's/.*] //' | xargs -I% git diff --color=always $commit -- '$repo/%' | $forgit_diff_pager" - - eval "git diff --name-only $commit -- $files*| sed -E 's/^(.)[[:space:]]+(.*)\$/[\1] \2/'" | env FZF_DEFAULT_OPTS="$opts" fzf --preview="$cmd" -end - -# git add selector -function forgit::add - forgit::inside_work_tree || return 1 - # Add files if passed as arguments - count $argv >/dev/null && git add "$argv" && git status --short && return - - set changed (git config --get-color color.status.changed red) - set unmerged (git config --get-color color.status.unmerged red) - set untracked (git config --get-color color.status.untracked red) - - set extract_file " - sed 's/^[[:space:]]*//' | # remove leading whitespace - cut -d ' ' -f 2- | # cut the line after the M or ??, this leaves just the filename - sed 's/.* -> //' | # for rename case - sed -e 's/^\\\"//' -e 's/\\\"\$//' # removes surrounding quotes - " - set preview " - set file (echo {} | $extract_file) - # exit - if test (git status -s -- \$file | grep '^??') # diff with /dev/null for untracked files - git diff --color=always --no-index -- /dev/null \$file | $forgit_diff_pager | sed '2 s/added:/untracked:/' - else - git diff --color=always -- \$file | $forgit_diff_pager - end - " - set opts " - $FORGIT_FZF_DEFAULT_OPTS - -0 -m --nth 2..,.. - $FORGIT_ADD_FZF_OPTS - " - set files (git -c color.status=always -c status.relativePaths=true status -su | - grep -F -e "$changed" -e "$unmerged" -e "$untracked" | - sed -E 's/^(..[^[:space:]]*)[[:space:]]+(.*)\$/[\1] \2/' | # deal with white spaces internal to fname - env FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" | - sh -c "$extract_file") # for rename case - - if test -n "$files" - for file in $files - echo $file | tr '\n' '\0' | xargs -I{} -0 git add {} - end - git status --short - return - end - echo 'Nothing to add.' -end - -## git reset HEAD (unstage) selector -function forgit::reset::head - forgit::inside_work_tree || return 1 - set cmd "git diff --cached --color=always -- {} | $forgit_diff_pager" - set opts " - $FORGIT_FZF_DEFAULT_OPTS - -m -0 - $FORGIT_RESET_HEAD_FZF_OPTS - " - set files (git diff --cached --name-only --relative | env FZF_DEFAULT_OPTS="$opts" fzf --preview="$cmd") - if test -n "$files" - for file in $files - echo $file | tr '\n' '\0' |xargs -I{} -0 git reset -q HEAD {} - end - git status --short - return - end - echo 'Nothing to unstage.' -end - -# git checkout-restore selector -function forgit::checkout_file - forgit::inside_work_tree || return 1 - - set cmd "git diff --color=always -- {} | $forgit_diff_pager" - set opts " - $FORGIT_FZF_DEFAULT_OPTS - -m -0 - $FORGIT_CHECKOUT_FZF_OPTS - " - set git_rev_parse (git rev-parse --show-toplevel) - set files (git ls-files --modified "$git_rev_parse" | env FZF_DEFAULT_OPTS="$opts" fzf --preview="$cmd") - if test -n "$files" - for file in $files - echo $file | tr '\n' '\0' | xargs -I{} -0 git checkout -q {} - end - git status --short - return - end - echo 'Nothing to restore.' -end - -# git stash viewer -function forgit::stash::show - forgit::inside_work_tree || return 1 - set cmd "echo {} |cut -d: -f1 |xargs -I% git stash show --color=always --ext-diff % |$forgit_diff_pager" - set opts " - $FORGIT_FZF_DEFAULT_OPTS - +s +m -0 --tiebreak=index --bind=\"enter:execute($cmd |env LESS='-R' less)\" - $FORGIT_STASH_FZF_OPTS - " - git stash list | env FZF_DEFAULT_OPTS="$opts" fzf --preview="$cmd" -end - -# git clean selector -function forgit::clean - forgit::inside_work_tree || return 1 - - set opts " - $FORGIT_FZF_DEFAULT_OPTS - -m -0 - $FORGIT_CLEAN_FZF_OPTS - " - - set files (git clean -xdffn $argv| awk '{print $3}'| env FZF_DEFAULT_OPTS="$opts" fzf |sed 's#/$##') - - if test -n "$files" - for file in $files - echo $file | tr '\n' '\0'| xargs -0 -I{} git clean -xdff {} - end - git status --short - return - end - echo 'Nothing to clean.' -end - -function forgit::cherry::pick - forgit::inside_work_tree || return 1 - set base (git branch --show-current) - if not count $argv > /dev/null - echo "Please specify target branch" - return 1 - end - set target $argv[1] - set preview "echo {1} | xargs -I% git show --color=always % | $forgit_show_pager" - set opts " - $FORGIT_FZF_DEFAULT_OPTS - -m -0 - " - echo $base - echo $target - git cherry "$base" "$target" --abbrev -v | cut -d ' ' -f2- | - env FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" | cut -d' ' -f1 | - xargs -I% git cherry-pick % -end - -# git ignore generator -if test -z "$FORGIT_GI_REPO_REMOTE" - set -x FORGIT_GI_REPO_REMOTE https://github.com/dvcs/gitignore -end - -if test -z "$FORGIT_GI_REPO_LOCAL" - if test "XDG_CACHE_HOME" - set -x FORGIT_GI_REPO_LOCAL $XDG_CACHE_HOME/forgit/gi/repos/dvcs/gitignore - else - set -x FORGIT_GI_REPO_LOCAL $HOME/.cache/forgit/gi/repos/dvcs/gitignore - end -end - -if test -z "$FORGIT_GI_TEMPLATES" - set -x FORGIT_GI_TEMPLATES $FORGIT_GI_REPO_LOCAL/templates -end - -function forgit::ignore - if not test -d "$FORGIT_GI_REPO_LOCAL" - forgit::ignore::update - end - - set cmd "$forgit_ignore_pager $FORGIT_GI_TEMPLATES/{2}{,.gitignore} 2>/dev/null" - set opts " - $FORGIT_FZF_DEFAULT_OPTS - -m --preview-window='right:70%' - $FORGIT_IGNORE_FZF_OPTS - " - set IFS '\n' - - set args $argv - if not count $argv > /dev/null - set args (forgit::ignore::list | nl -nrn -w4 -s' ' | - env FZF_DEFAULT_OPTS="$opts" fzf --preview="$cmd" |awk '{print $2}') - end - - if not count $args > /dev/null - return 1 - end - - forgit::ignore::get $args -end - -function forgit::ignore::update - if test -d "$FORGIT_GI_REPO_LOCAL" - forgit::info 'Updating gitignore repo...' - set pull_result (git -C "$FORGIT_GI_REPO_LOCAL" pull --no-rebase --ff) - test -n "$pull_result" || return 1 - else - forgit::info 'Initializing gitignore repo...' - git clone --depth=1 "$FORGIT_GI_REPO_REMOTE" "$FORGIT_GI_REPO_LOCAL" - end -end - -function forgit::ignore::get - for item in $argv - set filename (find -L "$FORGIT_GI_TEMPLATES" -type f \( -iname "$item.gitignore" -o -iname "$item}" \) -print -quit) - if test -n "$filename" - set header $filename && set header (echo $filename | sed 's/.*\.//') - echo "### $header" && cat "$filename" && echo - else - forgit::warn "No gitignore template found for '$item'." && continue - end - end -end - -function forgit::ignore::list - find "$FORGIT_GI_TEMPLATES" -print |sed -e 's#.gitignore$##' -e 's#.*/##' | sort -fu -end - -function forgit::ignore::clean - setopt localoptions rmstarsilent - [[ -d "$FORGIT_GI_REPO_LOCAL" ]] && rm -rf "$FORGIT_GI_REPO_LOCAL" -end diff --git a/dotfiles/.config/fish/fisher/fish-github/readme.fish b/dotfiles/.config/fish/fisher/fish-github/readme.fish deleted file mode 100644 index 1ad0ede..0000000 --- a/dotfiles/.config/fish/fisher/fish-github/readme.fish +++ /dev/null @@ -1,6 +0,0 @@ -function readme -a owner repo branch - if test -z "$branch" - set branch master - end - curl -s https://raw.githubusercontent.com/$owner/$repo/$branch/README.md -end diff --git a/dotfiles/.config/fish/fisher/fish-utils/EditDailyLog.fish b/dotfiles/.config/fish/fisher/fish-utils/EditDailyLog.fish deleted file mode 100644 index e68738a..0000000 --- a/dotfiles/.config/fish/fisher/fish-utils/EditDailyLog.fish +++ /dev/null @@ -1,3 +0,0 @@ -function EditDailyLog - vim (LogDirectory)/(date +%d-%B).md -end diff --git a/dotfiles/.config/fish/fisher/fish-utils/LogDirectory.fish b/dotfiles/.config/fish/fisher/fish-utils/LogDirectory.fish deleted file mode 100644 index 6badb1d..0000000 --- a/dotfiles/.config/fish/fisher/fish-utils/LogDirectory.fish +++ /dev/null @@ -1,3 +0,0 @@ -function LogDirectory - echo ~/Documents/Session\ Notes/(date +%B) -end diff --git a/dotfiles/.config/fish/fisher/fish-utils/OpenLogDirectory.fish b/dotfiles/.config/fish/fisher/fish-utils/OpenLogDirectory.fish deleted file mode 100644 index f86fafe..0000000 --- a/dotfiles/.config/fish/fisher/fish-utils/OpenLogDirectory.fish +++ /dev/null @@ -1,4 +0,0 @@ -function OpenLogDirectory - tmux split-window -h -c (LogDirectory) -end - diff --git a/dotfiles/.config/fish/fisher/fish-utils/RunBackup.fish b/dotfiles/.config/fish/fisher/fish-utils/RunBackup.fish deleted file mode 100644 index 0834931..0000000 --- a/dotfiles/.config/fish/fisher/fish-utils/RunBackup.fish +++ /dev/null @@ -1,29 +0,0 @@ -function RunBackup - echo Pushing ~/.vim to GitHub - cd ~/.vim - git add . - git commit --ammend -m "Running Backup: (date +%D) - git push origin master - - echo Pushing ~/.config/fish to GitHub - cd ~/.config/fish - git add config.fish functions/ - git commit --ammend -m "Running Backup: (date +%D) - git push origin master - - echo Pushing ~/.config/tmux to GitHub - cd ~/.config/tmux - git add . - git commit --ammend -m "Running Backup: (date +%D) - git push origin master - - echo Pushing ~/Documents/Notes to GitHub - cd ~/Documents/Notes/ - git add . - git commit --ammend -m "Running Backup: (date +%D) - git push origin master - - cp ~/Documents ~/sfuhome/Documents - -end - diff --git a/dotfiles/.config/fish/fisher/fish-utils/create_daily_log.fish b/dotfiles/.config/fish/fisher/fish-utils/create_daily_log.fish deleted file mode 100644 index 3146705..0000000 --- a/dotfiles/.config/fish/fisher/fish-utils/create_daily_log.fish +++ /dev/null @@ -1,3 +0,0 @@ -function create_daily_log - touch (date +%d-%B).md -end diff --git a/dotfiles/.config/fish/fishfile b/dotfiles/.config/fish/fishfile index c8361a1..8640779 100644 --- a/dotfiles/.config/fish/fishfile +++ b/dotfiles/.config/fish/fishfile @@ -1,8 +1,5 @@ jorgebucaran/nvm.fish tuvistavie/fish-completion-helpers -~/.config/fish/fisher/fish-github -~/.config/fish/fisher/fish-utils -~/.config/fish/fisher/fish-audio -~/.config/fish/fisher/fish-fzf danhper/fish-fastdir edc/bass +jichu4n/fish-command-timer