This file contains hidden or 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
fdocker() { | |
local dhelp=$(docker --list) | |
} |
This file contains hidden or 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
mru() { | |
local -a f | |
f=( | |
~/.vim_mru_files(N) | |
~/.unite/file_mru(N) | |
~/.cache/ctrlp/mru/cache.txt(N) | |
~/.frill(N) | |
) | |
if [[ $#f -eq 0 ]]; then | |
echo "There is no available MRU Vim plugins" >&2 |
This file contains hidden or 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
frepo() { | |
local dir | |
dir=$(ghq list > /dev/null | fzf-tmux --reverse +m) && | |
cd $(ghq root)/$dir | |
} | |
This file contains hidden or 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
fkill() { | |
local pid | |
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') | |
if [ "x$pid" != "x" ] | |
then | |
echo $pid | xargs kill -${1:-9} | |
fi | |
} |
This file contains hidden or 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
fh() { | |
print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//') | |
} | |
This file contains hidden or 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
tm() { | |
[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" | |
if [ $1 ]; then | |
tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return | |
fi | |
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found." | |
} | |
# fs [FUZZY PATTERN] - Select selected tmux session | |
# - Bypass fuzzy finder if there's only one match (--select-1) |
This file contains hidden or 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
fco() { | |
local tags branches target | |
tags=$( | |
git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}') || return | |
branches=$( | |
git branch --all | grep -v HEAD | | |
sed "s/.* //" | sed "s#remotes/[^/]*/##" | | |
sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}') || return | |
target=$( | |
(echo "$tags"; echo "$branches") | |
This file contains hidden or 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
fshow() { | |
local out shas sha q k | |
while out=$( | |
git log --graph --color=always \ | |
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | | |
fzf --ansi --multi --no-sort --reverse --query="$q" \ | |
--print-query --expect=ctrl-d); do | |
q=$(head -1 <<< "$out") | |
k=$(head -2 <<< "$out" | tail -1) | |
shas=$(sed '1,2d;s/^[^a-z0-9]*//;/^$/d' <<< "$out" | awk '{print $1}') |
This file contains hidden or 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
fbr() { | |
local branches branch | |
branches=$(git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format="%(refname:short)") && | |
branch=$(echo "$branches" | | |
fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) && | |
git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##") | |
} | |