Skip to content

Instantly share code, notes, and snippets.

@patorash
Last active May 23, 2021 21:42
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patorash/6e8b33efd4f67690f016 to your computer and use it in GitHub Desktop.
Save patorash/6e8b33efd4f67690f016 to your computer and use it in GitHub Desktop.
pecoを使って削除したいブランチを選択するfish用関数や、その他もろもろ。
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
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
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
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