Saturday, December 1, 2007

Directory Project plugin for Kate

This is a plugin for Kate that mimics TextMate's directory tree view and find files features. In other words, it's a simple project managing plugin where a directory defines a project. See the "Features" section below for screenshots and the "Settings" sections for an explanation of each option.

Prerequisites


This plugin requires that Kate (obviously) and Pate be installed. If you are having trouble installing Pate on an Ubuntu system, please see this post.

Installation


git clone git://github.com/cjbottaro/kate_directory_project.git
cd directory_project
./install

If that doesn't work, all you need to do mkdir -p ~/.kde/share/apps/kate/pyplugins/directory_project and copy directory_project.py into it.

Features


Tree view of whatever directory is currently opened.

Search-as-you-type find files dialog.

Useful configuration options.


Tree browser and find files dialog stay in sync with filesystem via KDirWatch. (no picture)

Settings


There are two types of settings: project specific and global. Global options are applied to all directory projects while project specific settings are different for each one. Directory Project remembers the project specific settings between projects via an ini file in ~/.kde/share/apps/kate/pyplugins/directory_project/directory_project.conf

Probably the most important setting is the search type setting. It dictates how the find files dialog generates matches.

Search type exact only hits exact matches. For instance, searching for doc_test will yield the following matches (matching text highlighted):
doc_test.rb
email_doc_test.rb

Search type character matches by character, preserving the order of the characters. Spaces are ignored in the query string for this search type. This search type is the default behavior in TextMate. Searching for doc test yields:
document_test
dashboard_controller_test.rb

Search type word matchs by word, preserving the order of the words. Words are space separated in the query string. This is the default search type for Directory Project. Searching for doc test yields:
document_test.rb
document_controller_test.rb

The name filters settings is a space separated list of file name pattern matches. Any file that does not match one of these patterns will not show up in Directory Project's tree browser or find files dialog. The default setting is * which matches all files. If you only want to match Ruby and HTML files, you can change the name filters to *.rb *.html

The Ignore Files/Directories is a list of files and directories names that will be ignored by Directory Project. Adding a directory here will stop Directory Project from including anything below that directory.

TODO


Make an option to have the find files dialog search on the relative path instead of just the file name, so you can distinguish between app/views/emails/index.html and app/views/documents/index.html by searching for email index.

4 comments:

Christian Vest said...

This is a very nice plugin. Thanks.

Just one issue, that the syncing dosn't seem to work if you're on a gnome desktop.

Christopher J. Bottaro said...

Hey, thanks!

Yes, there 3 issues I want to address with the plugin:

1) Fixing the syncing (it doesn't even work in a KDE environment). In the meantime, gotta hit Shift-F5 to reload the project after adding/removing some files.
2) Add/remove files from the tree view.
3) Change the Find File dialog to include searching (and displaying) the relative file path.

So instead of searching for "view" resulting in:

view.rhtml
view.rhtml

It would look like:

view.rhtml (blah/app/views/thing1)
view.rhtml (blah/app/views/thing2)

And then you could search for "thing1 view" and only get back the first result.

Anonymous said...

does it works for KDE4?

Christopher J. Bottaro said...

No, it doesn't, sorry... :(

I've also completely switched to Mac and OS X, so I don't really have a need for this anymore.

Maybe when KDE4 runs natively on OS X, I'll take up this project again. Until then, anyone is free to take the source and do whatever with it.