"Open File Fast - Netbeans plugin for quick opening project files"

February 26, 2009

Textmate has nice feature which is a real timesaver. It’s quick open file dialog. You can type only several characters of filename you are searching for and you get list of all files matching your pattern. When you are looking for FooBar.java you can type fbj and you will find it. It really helps navigating through the project (especially bigger ones).

So… let me introduce my new Netbeans plugin: Open File Fast™. It was inspired by mentioned Textmate’s functionality but has a lot more features. Netbeans already has some Go-To-File dialog but it isn’t too flexible and it requires you to type exact part of file’s name.

Here are the key features of Open File Fast:

  • quick finding and opening any file from selected project
  • two matching modes:
    • smart (like in Textmate, matching filenames must contain all typed characters, they can be separated by other characters)
    • exact (like Netbeans’ Go-To-File, matching filenames must contain exact phrase)
  • matching from start of filename or anywhere in filename
  • support for * wildcard in exact mode
  • changing minimum entered pattern length needed for searching (default: 3)
  • changing delay (time from last keystroke) after which searching starts (default: 300ms)
  • optional cleaning of search input field when O-F-F window opens
  • hiding files you don’t work on (matching specified regular expresions) from results
  • moving less important files (matching specified regular expresions) to the bottom of results list
  • results sorted by:
    • file popularity (files opened frequently at the top of list)
    • match accuracy (distance between characters from search phrase in matched filenames)
  • opening multiple files at once (selected with ctrl/shift + mouse)

Let’s see how it look in action. Invoke O-F-F from Netbeans’ Navigate menu (I recommend creating a keyboard shortcut for it in Tools/Options/Keymap/Project, I like ctrl+T). For example when you type user you will get following results:

But what if you want to open users_helper.rb file? Just type ush and you will find it!

If you know that something you need is in some javascript file you can show all js files by entering *.js.

When you want to narrow down your search to specific directory just type some parts of directories’ names separated by slashes. For example when looking for files in directory app/models (under project root) type a/m/.

Matching algorithm by default starts searching for pattern at the start of filename, but if you want to search for pattern anywhere in filename (like in Textmate) you can change it in options. Here we are searching for proj and the results list contains also filenames not starting with proj.

Open File Fast can be set up to your own preferences and to match your own workflow. You can configure it under Open File Fast tab in Netbeans’ Miscellaneous options:

Grab it here: off-netbeans-0.9.3.nbm". If you want to help or just look into sources they’re on github .
This is the first public version of this plugin so it could have some bugs, however we’ve been using it for a while now with my workmates and nothing exploded yet :)

Update: for most recent version of plugin go to OFF project page .

Read more about netbeans, off, textmate.
blog comments powered by Disqus