Something I'd like to see improved in TM2 is the visibility of the current file browser root. Since I started working with TM2, I've noticed several things about the file browser:
- I frequently glance at the file browser/project drawer to orient myself, essentially answering "which project's window is this?"
- The "project" indication, the browser's current directory, is now the smallest text on the page. (I use a larger font than the default for the editing windows.) It's also tucked in the midst of a lot of other stuff, making it hardre to quickly pick out.
- The current directory name is truncated by the buttons to its right when the file browser pane is narrowed even a bit.
- Quickly inspecting the contents of the file browser is often not illuminating. Imagine working with multiple Rails apps, multiple git clones of the same project, etc.
- No location information is available when the drawer is closed. By contrast TM1's default formatting of the title bar with "<icon> <file> - <project>".
---------
On that last point, I note that the window title is now user-configurable in .tm_properties; great news. However, I've not had any luck in recreating TM1's behavior. For example, in ~/.tm_properties I have:
windowTitle = '${TM_DISPLAYNAME}\ ${TM_PROJECT_DIRECTORY:+ - $TM_PROJECT_DIRECTORY}'
and in a project root directory, I have .tm_properties with:
projectDirectory = '${CWD}'
After restarting TextMate (is there an easier way to reload the props?), it seems that TM_PROJECT_DIRECTORY is never set even when projectDirectory has been set in .tm_properties. Am I just missing something about projectDirectory/TM_PROJECT_DIRECTORY, or is this a bug?
Thanks, John
On 20 Dec 2011, at 01:22, John Whitley wrote:
[…] I've not had any luck in recreating TM1's behavior. For example, in ~/.tm_properties I have:
windowTitle = '${TM_DISPLAYNAME}\ ${TM_PROJECT_DIRECTORY:+ - $TM_PROJECT_DIRECTORY}'
and in a project root directory, I have .tm_properties with:
projectDirectory = '${CWD}'
After restarting TextMate (is there an easier way to reload the props?),
The props are automatically reloaded but cached for upto 30 seconds, so relaunch (⌃⌘Q) is probably easiest if you’re unpatient.
it seems that TM_PROJECT_DIRECTORY is never set
Correct, but you can use $projectDirectory or $CWD.
[…] is this a bug?
The reason is that TM resolves the .tm_properties files and use your setting for projectDirectory to set TM_PROJECT_DIRECTORY for command execution. So this variable does not exist prior to resolving the files, nor is it set during, as it’s a general-purpose free-form system, and you set projectDirectory not TM_PROJECT_DIRECTORY.
The main reason that I didn’t make people set the latter in .tm_properties is that the variable has a fallback if projectDirectory is unset.
Allan Odgaard <mailinglist@...> writes:
Correct, but you can use $projectDirectory or $CWD.
[…] is this a bug?
The reason is that TM resolves the .tm_properties files and use your setting
for projectDirectory to set
TM_PROJECT_DIRECTORY for command execution. So this variable does not exist
prior to resolving the
files, nor is it set during, as it’s a general-purpose free-form system, and
you set projectDirectory
not TM_PROJECT_DIRECTORY.
Right, that makes sense. If I'm reading correctly, then TM_PROJECT_DIRECTORY is therefore only useful in bundles; in a .tm_properties file it won't have had a chance to be set yet. It would be good to call this out clearly as the documentation evolves. For my part, I'd started with an assumption more like the synchronous linkage of path (shellvar) vs PATH (envvar) as many shells implement.
Digging deeper, with this in ~/.tm_properties:
foo = 'foo' windowTitle = '${TM_DISPLAYNAME}${foo:+ - $foo}'
.. I don't see '- foo' after the display name. Ah right, so this implies that .tm_properties files aren't actually interpreted sequentially. That in turn suggests that there's no way to inspect and act upon a value in ~/.tm_properties that was inherited from a more specific .tm_properties file.
FWIW, $CWD doesn't seem to be very useful for my original purpose. Even when started via the CLI interface on a specific directory, $CWD seems to be set to $HOME. Changing the root of the file browser doesn't appear to affect $CWD either. Given that, $CWD doesn't assist my goal of distinguishing working project windows from one another.
So is there a way to get the current project name into the title bar via end-user configuration? Would it work to create a custom bundle to manage windowTitle?
Thanks, John
On 20 Dec 2011, at 19:42, John Whitley wrote:
[…] in ~/.tm_properties:
foo = 'foo' windowTitle = '${TM_DISPLAYNAME}${foo:+ - $foo}'
.. I don't see '- foo' after the display name.
Works for me.
[…] .tm_properties files aren't actually interpreted sequentially.
They are.
[…] $CWD doesn't seem to be very useful for my original purpose. Even when started via the CLI interface on a specific directory, $CWD seems to be set to $HOME.
$CWD is the folder containing the .tm_properties file.
It is useful to set e.g. TM_MAKE_FILE to "$CWD/Makefile" or projectDirectory. But this .tm_properties file should then be copied to each of your projects.
So is there a way to get the current project name into the title bar via end-user configuration?
This is what I use for my projects:
windowTitle = "$TM_DISPLAYNAME — ${CWD/^.*///}"
But this needs to be set for each project’s .tm_properties file (can’t be set globally).
On 12/20/11 11:14 AM, Allan Odgaard wrote:
On 20 Dec 2011, at 19:42, John Whitley wrote:
[…] in ~/.tm_properties:
foo = 'foo' windowTitle = '${TM_DISPLAYNAME}${foo:+ - $foo}'
.. I don't see '- foo' after the display name.
Works for me.
On my Mac OS 10.6.8, my copy of TM2 b9113, will display the following when I use this variable as shown above:
{{*.{o,pyc},Icon
why is that? nobody else, eh? that's just too funny.
Thanks for great software, as always. It's quite nice, Alan. Thank you.
-AZ