How to enable sublime text to take first line as file name while saving?

sublime-text-plugin, sublimetext3

Solution

The first line is only used as the file name for unsaved files when the syntax is set to Plain Text. As soon as you change the syntax highlighting and type something, it will change the tab name to "untitled".

The implementation for this is in the Default package, `set_unsaved_view_name.py` file. To get it to work for all syntaxes:

- Install PackageResourceViewer through Package Control if it is not already installed

- Open Command Palette

- Type `PRV:` and select `PackageResourceViewer: Open Resource`

- Select `Default`

- Select `set_unsaved_view_name.py`

- Find `if syntax != 'Packages/Text/Plain text.tmLanguage':`

- Select from there to the end of the `if` statement (the first `return` statement) (Python is indentation based) inclusive `return` to be commented out.

- Go to the Edit menu -> Comment -> Toggle Comment

- Save the file

- Ensure that, in your preferences (user, syntax specific etc.), `set_unsaved_view_name` is not set to `false`

Note: these instructions are valid as at ST build 3131, and the implementation could change in future builds.

Problem

Earlier the Sublime used to take first line as file name by default but now it's "untitled". Is there a way to enable it or is there a plugin for that? Thanks

Original source