On 26.10.2007, at 02:03, Brian Huddleston wrote:
When working with templates or new files to have Textmate automatically adjust the default file name used when hitting SAVE to something other than "untitled"?
For example, if I create a BASH template, and one of my fields is the file/program name, I wanted to be able to either:
- hit "apple-s" and have Textmate pull a possible default
filename from the area/field I had defined. or 2) select text; hit "apple-s"; and have the text selection become the default filename
[...]
I believe it will be possible with the new coming DIALOG 2.
But you can try that one using CocoaDialog (it's only a fast thought idea :):
Create a command: Input: Entire Document Command:
parsed_filename="abc.txt" filename="$(CocoaDialog filesave --with-directory `dirname "$TM_FILEPATH"` --with-file "$parsed_filename" )" if [ -n "$filename" ]; then cat >"$filename" mate "$filename" fi
Key: what you like
The variable "parsed_filename" is set via a regexp parsing the second line of your template in beforehand.
The only tiny hook is that you have to close the untitled document manually.
--Hans