Home Download Buy Blog Forum Support

open .sublime-project file in project root from any folder

open .sublime-project file in project root from any folder

Postby leeh on Sun Feb 03, 2013 3:35 am

I wanted a simple shell command to open a sublime project in the root of my project folder even if I wasn't in the root, similar to how ant finds the build.xml. This seems to work on the mac, but I haven't done much shell scripting in a while. Try it if you like. Improve it if you can.

Project file must be named .sublime-project

https://gist.github.com/4700370
Code: Select all
#/bin/sh
x=`pwd`;
while [ "$x" != "/" ] && [ -z "$y" ] ; do
  y=$(find "$x" -maxdepth 1 -name .sublime\-project)
  if [ -n "$y" ];then
    echo "$y"
    subl --project "$y"
  fi
  x=`dirname "$x"`;
done
leeh
 
Posts: 4
Joined: Wed Nov 30, 2011 1:54 pm

Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 36 guests