What have you found for these years?

2009-12-10

mate-git and mate-gem

mate-git: open a project for a git repository,
this would include dot started hidden files,
such as .gitignore and .vimrc, .gemrc, etc.
should be better than `mate .` or `mate path`

function mate-git -d 'mate a project'
set cwd (/bin/pwd)
if test $argv
cd $argv
end
# here we are removing depth>1 path
# and tr remove quotes, and sed add back quotes
mate (git ls-files | tr -d '"' | sed -E 's/([^/]*)\/?.*/"\1"/g' | uniq)
cd $cwd
end

mate-gem: short hand for opening a gem directory,
should be better than `mate ~/.gem/ruby/1.9.1/gems/rack-1.0.1`
i always need to look into gems' sources, this is helpful.
i am so tired of tab tab tab... i just want a `mate-gem rack`
function mate-gem -d 'mate a gem'
set path (gem which $argv)
if test $path = "Can't find ruby library file or shared library $argv"
echo $path
else
mate (echo $path | sed -E 's/([^/]*)\/[^/]*\/[^/]*?\.rb/\1/g')
end
end

see config.fish

0 retries:

Post a Comment

All texts are licensed under CC Attribution 3.0