I love idea of TextMate that any directory opened in it is already a project. But sometimes I it would be good to ignore files for certain dir and I don't like idea of creating project file in that dir or remembering how I named project file in some special folder like ~/.tmproject. Is there some sort of plugin or something like this which will allow me to ignore files in dir? Perfect solution would be reading .gitignore file.
2 Answers
If you're not dead-set against the idea of a .tmproject
file at the root of your project, I think that's a sensible place to keep them, especially if you match them in your global .gitignore
settings for your user.
That said, you can ignore items in through TextMate's preferences: look under Advanced → Folder References. It's one long regular expression pattern separated by |pipes| so just add yours in there.
You can't get the TM ignore pattern from a .gitignore
file, since that would be a per-project setting (...which are stored in .tmproject
files: chicken-and-egg problem!).
Another way around this would be to use the command line mate
command to open the list of files you want. Something like this will open just the files that are checked into git:
mate `git ls-tree --name-only HEAD`
For drag & drop convenience, throw an Applescript Automator wrapper around that and you're set.
-
I know about TextMate ignores in preferences :) (Though it is not a very comfortable way to manage ignores). mate
git ls-tree --name-only HEAD
will not work very well as I mainly need to ignore something deeper than first level, also searching for solution to list all files that are not ignored by git will not help also, as it will give me static project (creating files will not add them to tree). I am not dead set against .tmproj files, so now I am thinking abouttm
shell script which will build .tmproj file from .gitignore and maybe some other useful stuff.– tigJun 20, 2010 at 11:15 -
I managed to write tool which auto creates project with ignores based on .gitignore files, thanks for inspiration.– tigJul 28, 2010 at 21:52
-
-
-
2
Inspired by the previous answer, I have begun using the following command:
mate `ls | grep -vx -f .gitignore`
This will open a TextMate window which excludes anything that is in your .gitignore file. The -v option specifies a reverse match, and the -x option prevents partial matches ("bonk" doesn't match "bonkbonk")