🔧 chore(fish): plugin updates
This commit is contained in:
parent
673373045b
commit
fe88d487f9
3 changed files with 485 additions and 513 deletions
|
@ -4,3 +4,4 @@ abbr -a t --function projectdo_test
|
|||
abbr -a p --function projectdo_tool
|
||||
abbr -a y yadm
|
||||
abbr -a pse pacseek
|
||||
abbr -a g git
|
||||
|
|
|
@ -138,6 +138,9 @@ _forgit_diff() {
|
|||
# We have to do a two-step sed -> tr pipe because OSX's sed implementation does
|
||||
# not support the null-character directly.
|
||||
get_files="echo {} | sed 's/.*] *//' | sed 's/ -> /\\\n/' | tr '\\\n' '\\\0'"
|
||||
# Similar to the line above, but only gets a single file from a single line
|
||||
# Gets the new name of renamed files
|
||||
get_file="echo {} | sed 's/.*] *//' | sed 's/.*-> //'"
|
||||
# Git stashes are named "stash@{x}", which contains the fzf placeholder "{x}".
|
||||
# In order to support passing stashes as arguments to _forgit_diff, we have to
|
||||
# prevent fzf from interpreting this substring by escaping the opening bracket.
|
||||
|
@ -150,7 +153,7 @@ opts="
|
|||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
+m -0 --bind=\"enter:execute($enter_cmd | $_forgit_enter_pager)\"
|
||||
--preview=\"$preview_cmd\"
|
||||
--bind=\"alt-e:execute-silent($EDITOR \$\($get_files\) >/dev/tty </dev/tty)+refresh-preview\"
|
||||
--bind=\"alt-e:execute-silent($EDITOR \\\"\$\($get_file)\\\" >/dev/tty </dev/tty)+refresh-preview\"
|
||||
$FORGIT_DIFF_FZF_OPTS
|
||||
--prompt=\"$commits > \"
|
||||
"
|
||||
|
@ -169,10 +172,7 @@ _forgit_add() {
|
|||
local git_add changed unmerged untracked files opts preview extract
|
||||
git_add="git add $FORGIT_ADD_GIT_OPTS"
|
||||
# Add files if passed as arguments
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_add "$@" && git status -su
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_add "$@" && git status -su; return $?; }
|
||||
|
||||
changed=$(git config --get-color color.status.changed red)
|
||||
unmerged=$(git config --get-color color.status.unmerged red)
|
||||
|
@ -194,7 +194,7 @@ else
|
|||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
-0 -m --nth 2..,..
|
||||
--preview=\"$preview\"
|
||||
--bind=\"alt-e:execute-silent($EDITOR \$\(echo {} | $extract\) >/dev/tty </dev/tty)+refresh-preview\"
|
||||
--bind=\"alt-e:execute-silent($EDITOR \\\"\$\(echo {} | $extract\)\\\" >/dev/tty </dev/tty)+refresh-preview\"
|
||||
$FORGIT_ADD_FZF_OPTS
|
||||
"
|
||||
files=$(git -c color.status=always -c status.relativePaths=true status -su |
|
||||
|
@ -211,10 +211,7 @@ _forgit_reset_head() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_reset_head cmd files opts rootdir
|
||||
git_reset_head="git reset -q $FORGIT_RESET_HEAD_GIT_OPTS HEAD"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_reset_head "$@" && git status --short
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_reset_head "$@" && git status --short; return $?; }
|
||||
rootdir=$(git rev-parse --show-toplevel)
|
||||
cmd="git diff --staged --color=always -- $rootdir/{} | $_forgit_diff_pager "
|
||||
opts="
|
||||
|
@ -234,10 +231,7 @@ _forgit_stash_show() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_stash_show git_stash_list cmd opts
|
||||
git_stash_show="git stash show --color=always --ext-diff"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_stash_show "$@"
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_stash_show "$@"; return $?; }
|
||||
git_stash_list="git stash list $FORGIT_STASH_SHOW_GIT_OPTS"
|
||||
cmd="echo {} |cut -d: -f1 |xargs -I% $git_stash_show % |$_forgit_diff_pager"
|
||||
opts="
|
||||
|
@ -270,10 +264,7 @@ _forgit_stash_push() {
|
|||
# ignore -u as it's used implicitly
|
||||
-u|--include-untracked) shift ;;
|
||||
# pass to git directly when encountering anything else
|
||||
*)
|
||||
$git_stash_push "${args[@]}"
|
||||
return $?
|
||||
;;
|
||||
*) $git_stash_push "${args[@]}"; return $?
|
||||
esac
|
||||
done
|
||||
local opts preview files
|
||||
|
@ -298,10 +289,7 @@ _forgit_stash_push() {
|
|||
# git clean selector
|
||||
_forgit_clean() {
|
||||
_forgit_inside_work_tree || return 1
|
||||
_forgit_contains_non_flags "$@" && {
|
||||
git clean -q "$@"
|
||||
return $?
|
||||
}
|
||||
_forgit_contains_non_flags "$@" && { git clean -q "$@"; return $?; }
|
||||
local git_clean files opts
|
||||
git_clean="git clean $FORGIT_CLEAN_GIT_OPTS"
|
||||
opts="
|
||||
|
@ -378,7 +366,8 @@ _forgit_cherry_pick_from_branch() {
|
|||
"
|
||||
# loop until either the branch selector is closed or a commit to be cherry
|
||||
# picked has been selected from within a branch
|
||||
while true; do
|
||||
while true
|
||||
do
|
||||
if [[ -z $input_branch ]]; then
|
||||
branch="$(eval "$cmd" | FZF_DEFAULT_OPTS="$opts" fzf | awk '{print $1}')"
|
||||
else
|
||||
|
@ -451,10 +440,7 @@ _forgit_checkout_file() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_checkout cmd files opts
|
||||
git_checkout="git checkout $FORGIT_CHECKOUT_FILE_GIT_OPTS"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_checkout -- "$@"
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_checkout -- "$@"; return $?; }
|
||||
cmd="git diff --color=always -- {} | $_forgit_diff_pager"
|
||||
opts="
|
||||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
|
@ -512,10 +498,7 @@ _forgit_checkout_tag() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_checkout cmd opts preview
|
||||
git_checkout="git checkout $FORGIT_CHECKOUT_TAG_GIT_OPTS"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_checkout "$@"
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_checkout "$@"; return $?; }
|
||||
cmd="git tag -l --sort=-v:refname"
|
||||
preview="git log {1} $_forgit_log_preview_options"
|
||||
opts="
|
||||
|
@ -534,10 +517,7 @@ _forgit_checkout_commit() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_checkout cmd opts graph
|
||||
git_checkout="git checkout $FORGIT_CHECKOUT_COMMIT_GIT_OPTS"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_checkout "$@"
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_checkout "$@"; return $?; }
|
||||
cmd="echo {} | $_forgit_extract_sha |xargs -I% git show --color=always % | $_forgit_show_pager"
|
||||
opts="
|
||||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
|
@ -557,10 +537,7 @@ _forgit_branch_delete() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_branch preview opts cmd branches
|
||||
git_branch="git branch $FORGIT_BRANCH_DELETE_GIT_OPTS"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_branch -D "$@"
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_branch -D "$@"; return $?; }
|
||||
preview="git log {1} $_forgit_log_preview_options"
|
||||
|
||||
opts="
|
||||
|
@ -581,10 +558,7 @@ _forgit_revert_commit() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_revert cmd opts files preview commits IFS
|
||||
git_revert="git revert $FORGIT_REVERT_COMMIT_GIT_OPTS"
|
||||
[[ $# -ne 0 ]] && {
|
||||
$git_revert "$@"
|
||||
return $?
|
||||
}
|
||||
[[ $# -ne 0 ]] && { $git_revert "$@"; return $?; }
|
||||
|
||||
cmd="git log --graph --color=always --format='$_forgit_log_format' $* $_forgit_emojify"
|
||||
opts="
|
||||
|
@ -623,10 +597,7 @@ _forgit_blame() {
|
|||
_forgit_inside_work_tree || return 1
|
||||
local git_blame opts flags preview file
|
||||
git_blame="git blame $FORGIT_BLAME_GIT_OPTS"
|
||||
_forgit_contains_non_flags "$@" && {
|
||||
$git_blame "$@"
|
||||
return $?
|
||||
}
|
||||
_forgit_contains_non_flags "$@" && { $git_blame "$@"; return $?; }
|
||||
opts="
|
||||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
$FORGIT_BLAME_FZF_OPTS
|
||||
|
|
|
@ -3,7 +3,7 @@ if not status is-interactive && test "$CI" != true
|
|||
exit
|
||||
end
|
||||
|
||||
# Because of scoping rules, to capture the shell variables ezactly as they are, we must read
|
||||
# Because of scoping rules, to capture the shell variables exactly as they are, we must read
|
||||
# them before even executing _fzf_search_variables. We use psub to store the
|
||||
# variables' info in temporary files and pass in the filenames as arguments.
|
||||
# This variable is global so that it can be referenced by fzf_configure_bindings and in tests
|
||||
|
|
Loading…
Add table
Reference in a new issue