LoginSignup
9
8

More than 5 years have passed since last update.

fishのディレクトリ移動コマンド

Last updated at Posted at 2015-03-24
function _peco_change_directory
  if [ (count $argv) ]
    peco --query "$argv "|perl -pe 's/([ ()])/\\\\$1/g'|read foo
  else
    peco|perl -pe 's/([ ()])/\\\\$1/g'|read foo
  end
  if [ $foo ]
    eval cd "$foo"
  else
    commandline ''
  end
end
function peco_change_directory
  begin
    echo $HOME/Documents
    echo $HOME/Desktop
    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|awk '!a[$0]++'|_peco_change_directory $argv
end

ghqの出力をや.zをまぜたりディレクトリの重複を取り除いたり空白を含む行に対処したり
いろいろしている。

ソートしないで重複行を削除する
http://qiita.com/arcizan/items/9cf19cd982fa65f87546

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8