Sublime Text 2 - 默认文档类型 [英] Sublime Text 2 - Default Document Type

查看:32
本文介绍了Sublime Text 2 - 默认文档类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在保存新文件时设置默认文档类型?我创建了几个新文件,并希望在保存新文件时使用默认值 .txt.

Is there a way to set a default document type when saving a NEW FILE? I created several new files and I want to have a default value of .txt when saving a NEW FILE.

推荐答案

这个插件做到了:

https://github.com/spadgos/sublime-DefaultFileType

看起来不错.

好的,有两件事,目前似乎有一个小错误,因此由于文件名中的空格,文本文件语法没有被正确选取.此外,您需要将use_current_file_syntax"设置为 false,(否则新文件将默认为您按 Ctrl-N 时已打开的任何文件类型)...因此修复/解决方法是:

Ok, two things, there currently seems to be a small bug so the text file syntax is not being correctly picked up due to the whitespace in the filename. In addition you need to set the "use_current_file_syntax" to false, (otherwise the new file will default to whatever filetype you have open already when you hit Ctrl-N)... So the fix/workaround is this:

将以下代码放入:Packages/User/default_file_type.sublime-settings

Put the following code in: Packages/User/default_file_type.sublime-settings

{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage",   
"use_current_file_syntax": false }

注意下划线.

接下来,找到Plain text.tmLanguage"文件并将其复制并重命名(在同一文件夹中)为Plain_text.tmLanguage".[一定要复制/复制它,不要只是重命名它,因为它可能有依赖性]

Next, find the "Plain text.tmLanguage" file and copy and rename it (in the same folder) as "Plain_text.tmLanguage". [be sure to copy/duplicate it, do not just rename it, as it may have dependancies]

重新启动,只是为了确定,这应该可以解决问题.另请注意,此插件仅适用于使用 Ctrl-N 创建的新文件.

Restart, just to be sure, and this should do the trick. Also note this plugin only works for new files created with Ctrl-N.

这篇关于Sublime Text 2 - 默认文档类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆