3

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 2

5

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.

6
  • 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 about tm shell script which will build .tmproj file from .gitignore and maybe some other useful stuff.
    – tig
    Jun 20, 2010 at 11:15
  • I managed to write tool which auto creates project with ignores based on .gitignore files, thanks for inspiration.
    – tig
    Jul 28, 2010 at 21:52
  • Could you maybe publish that tool? I would be very interested :)
    – markijbema
    Sep 12, 2011 at 15:05
  • @tig I'd like to take a look at that tool too :) Nov 24, 2011 at 22:20
  • 2
    This tool is packed as ruby gem mate. Also I've forgot to mention in README that you can also use .tmignore files if you need to ignore something that should not be ignored by git (I'll fix README as soon as I can). @markijbema Sorry I missed your comment
    – tig
    Nov 25, 2011 at 11:01
0

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")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .