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

纵饮孤独 提交于 2019-12-06 05:30:46

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:

  1. Install PackageResourceViewer through Package Control if it is not already installed
  2. Open Command Palette
  3. Type PRV: and select PackageResourceViewer: Open Resource
  4. Select Default
  5. Select set_unsaved_view_name.py
  6. Find if syntax != 'Packages/Text/Plain text.tmLanguage':
  7. Select from there to the end of the if statement (the first return statement) (Python is indentation based) inclusive
  8. Go to the Edit menu -> Comment -> Toggle Comment
  9. Save the file
  10. 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!