履歴検索
# History search by peco
function peco_history
history | peco --prompt="HISTORY>" | read select_hist
commandline $select_hist
end
GHQによるディレクトリ移動
# Change directory by peco + ghq
function peco_ghq
ghq list | peco --prompt="GHQ>" | read select_dir
if [ $select_dir ]
cd (ghq root)/$select_dir
end
end
下層のファイル探索
# Find by peco + (git ls-files or find)
function peco_find
function source_files
if git rev-parse 2> /dev/null
git ls-files
else
find . -type f
end
end
source_files | peco --prompt "FIND>" | read select_file
commandline $select_file
end
ショートカット登録
function fish_user_key_bindings
bind \cr peco_history # ctrl + r
bind \cg peco_ghq # ctrl + g
bind \cf peco_find # ctrl + f
end