which for open files
Do you drag file handles from app titlebars into your terminal a lot? And you consider yourself a hardened keyboard warrior and don't like using the mouse unless absolutely necessary?
Sure, you might say "I'd just type and tab complete that shit." But let's just imagine that file is really deep in the project hierarchy or just really damn annoying to autocomplete because there's a billion files with the same prefixes.
Now, let's take a look at your coding life with
"Holy shit, that's amazing!" you say, "But what about if I have more than one window? Which one does it choose?"
You get a choice!
filepath is democratic like that.
You can grab it from the downloads page
or build it yourself, then slap it in any directory in your $PATH (I
I'll probably write a recipe for homebrew at some point.
This requires Snow Leopard (10.6) and access for assistive devices must be enabled in Accessibility.
This only works on applications that use NSDocument. Let me know if it doesn't work for an application with a draggable handle in the title bar.
If you somehow don't have Snow Leopard, upgrade already.
$ filepath # Finds the most recently used window that has documents $ filepath textmate # Gets documents from Textmate $ filepath -f # Always picks the first choice
Alias it to
fp for even less typing.
I like being efficient. I'd rather spend an hour or two writing a tool making me more efficient in the long run than waste two seconds every time I drag a file into the terminal.
- Added -f option.
- First release.
Fork and send me pull requests! You might be able to tell that I don't code Objective-C/C very often and so I'm happy to learn better ways of doing things.
(The MIT License)
Copyright © 2011 Jack "chendo" Chen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.