+4

Customize how unsaved files are named in tabs / sidebar

Misty Stanley-Jones 13 ár síðan Uppfært 13 ár síðan 0
If you create a new plain-text file, its first line becomes the displayed name for its tab or sidebar item. This is extremely useful for having multiple "scratch" type items. This feature stops working for XML and other file types where the first line doesn't contain something useful.

I'd like the ability to have a per-mode regex to find what the "name" of an unsaved file should be. Some ideas for different modes:

* Docbook or DITA XML: Look for the first <title> element
* PHP, C, shell scripts: Look for the first appearance of "Name:" inside a comment

To understand why this might be useful, let me tell you a little about my workflow. I write in Docbook all day long. The finished Docbook files are saved in an online CCMS, and I use OSX, which saves the state of open files (at least in Sublime Text). So I don't save my work to local files, because as soon as I update the CCMS my local copy is in danger of becoming out of sync anyway.

So each file I am working on is in a (probably unsaved) tab in Sublime Text. I currently have one window with 13 different (related) files in this state. Saving each of them involves coming up with a good displayable name for it, so that the tabs remain useful to me. My current workaround is to keep my file in "Plain Text" mode until the last minute, with the first line of the file being what I'd like to see in the tab. It's a bit silly, because I'm losing out on some of the benefits of using the mode.

I spoke with a colleague who is a Java developer, and he'd like this feature too.