Created
June 10, 2015 11:19
-
-
Save susieyy/ca5b9ddd6c61e4985fa3 to your computer and use it in GitHub Desktop.
dotfiles/home/.config/fish/functions/peco_change_directory.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_change_directory | |
if [ (count $argv) ] | |
peco --layout=bottom-up --query "$argv "|perl -pe 's/([ ()])/\\\\$1/g'|read foo | |
else | |
peco --layout=bottom-up |perl -pe 's/([ ()])/\\\\$1/g'|read foo | |
end | |
if [ $foo ] | |
builtin cd $foo | |
else | |
commandline '' | |
end | |
end | |
function peco_change_directory | |
begin | |
echo $HOME/Documents | |
echo $HOME/Desktop | |
echo $HOME/.config | |
ls -ad */|perl -pe "s#^#$PWD/#"|egrep -v "^$PWD/\."|head -n 5 | |
sort -r -t '|' -k 3 ~/.z|sed -e 's/\|.*//' | |
ghq list -p | |
ls -ad */|perl -pe "s#^#$PWD/#"|grep -v \.git | |
end | sed -e 's/\/$//' | awk '!a[$0]++' | _peco_change_directory $argv | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment