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?
1 Answer
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 selectPackageResourceViewer: 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 firstreturn
statement) (Python is indentation based) inclusivereturn
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 tofalse
Note: these instructions are valid as at ST build 3131, and the implementation could change in future builds.
-
thanks, but it didn't worked for me. I made a video to demonstrate that youtu.be/gLHQoIEbb4Y May 5, 2017 at 4:58
-
hmm, do you perhaps have
set_unsaved_view_name
set to false in your preferences somewhere? you could try addingprint('set_unsaved_view_name.py - at line 35')
style statements and check ST's console to help debug where it is going wrong May 5, 2017 at 12:22 -
1Thanks! Worked for me on ST3, build 3126. For files that were already open and had "untitled" as their tab name, I did have to make a change to the first line content for the tabs to update (e.g., adding and removing a space). (Also, for awkwardly long tab names, you can type view.set_name("the new name") in the console to change the tab name.)– RogareJul 20, 2017 at 9:51
-
Perfect! Worked for me as well! This is why I love sublime! it's so hackable!– LopofskyAug 28, 2019 at 15:37
-