Last active
May 23, 2021 21:42
-
-
Save patorash/6e8b33efd4f67690f016 to your computer and use it in GitHub Desktop.
pecoを使って削除したいブランチを選択するfish用関数や、その他もろもろ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco_delete_branch | |
git branch | peco | read line | |
set -l branch_name (echo $line | awk '{print $1}') | |
if test "$branch_name" != "*" | |
git branch -d $branch_name | |
else | |
echo "Can't delete current branch." | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco_kill | |
if set -q $argv | |
ps aux | peco | read proc | |
else | |
ps aux | peco --query $argv | read proc | |
end | |
if test -n "$proc" | |
set -l pid (echo $proc | awk '{print $2}') | |
echo "kill pid: $pid. [$proc]" | |
kill $pid | |
end | |
set -e proc | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco_select_history | |
if set -q $argv | |
history | peco | read line; commandline $line | |
else | |
history | peco --query $argv | read line; commandline $line | |
end | |
set -e line | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco_select_repository | |
if set -q $argv | |
ghq list -p | peco | read line; builtin cd $line | |
else | |
ghq list -p | peco --query $argv | read line; builtin cd $line | |
end | |
set -e line | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment