mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 17:44:52 +00:00
git fuzzy tools
This commit is contained in:
parent
9910864059
commit
e660ae797e
@ -38,6 +38,7 @@ if status --is-interactive
|
||||
notes
|
||||
awstools
|
||||
mactools
|
||||
gittools
|
||||
projects
|
||||
|
||||
# Fuzzy finder
|
||||
|
@ -30,9 +30,12 @@ function aliases --description 'All aliases'
|
||||
abbr -a gco 'git checkout'
|
||||
abbr -a gcom 'git checkout master'
|
||||
abbr -a gcob 'git checkout -b'
|
||||
abbr -a gcof 'git-checkout-fuzzy'
|
||||
abbr -a gb 'git branch'
|
||||
abbr -a gbd 'git-delete-fuzzy'
|
||||
abbr -a grh 'git reset --hard'
|
||||
abbr -a gm 'git merge'
|
||||
abbr -a gmf 'git-merge-fuzzy'
|
||||
abbr -a ghb 'gh repo view -w'
|
||||
|
||||
# Vim
|
||||
|
24
fish.configlink/functions/gittools.fish
Normal file
24
fish.configlink/functions/gittools.fish
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function gittools
|
||||
|
||||
function git-fuzzy-branch -a header
|
||||
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
||||
set -l branch (git branch --format "%(refname:short)" | eval "fzf $FZF_DEFAULT_OPTS --header='On $current, $header'")
|
||||
and echo $branch
|
||||
end
|
||||
|
||||
function git-checkout-fuzzy
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
end
|
||||
|
||||
function git-merge-fuzzy
|
||||
git merge (git-fuzzy-branch "merge from...")
|
||||
end
|
||||
|
||||
function git-delete-fuzzy
|
||||
git branch -d (git-fuzzy-branch "delete branch...")
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user