Write a command:
Input: Selected Text or Nothing
Command: FILENAME="$TM_SELECTED_TEXT" EXT=$("$TMTOOLS" get suggestedExtensionForDocument) filename="$(CocoaDialog filesave --with-directory `dirname "$TM_FILEPATH"` --with-file "$FILENAME.$EXT" )" if [ -n "$filename" ]; then echo "{name=""$filename"";overwriteMode;}" |"$TMTOOLS" do saveWithFilenameAndReopen - fi
Output: Show a Tool Tip
Or if you want to bind that command to APPLE+SHIFT+S you can try this as command:
FILENAME="$TM_SELECTED_TEXT" if [ -z "$TM_SELECTED_TEXT" ]; then "$TMTOOLS" show saveAsPanel exit_show_tool_tip fi
FMF=$("$TMTOOLS" get frontMostDocument) if [ "${FMF:0:8}" == "untitled" ]; then EXT=$("$TMTOOLS" get suggestedExtensionForDocument) filename="$(CocoaDialog filesave --with-directory `dirname "$TM_FILEPATH"` --with-file "$FILENAME.$EXT" )" if [ -n "$filename" ]; then echo "{name=""$filename"";overwriteMode;}" |"$TMTOOLS" do saveWithFilenameAndReopen - fi else "$TMTOOLS" show saveAsPanel exit_show_tool_tip fi
--Hans