如何在Notepad++中覆盖默认文件扩展名?

9
我想在Notepad++中打开iOS的objective-c文件(带有.m扩展名),并将其指定为Objective-C文件。在设置->样式配置器中,我知道可以添加一个“用户扩展”(m)用于Objective-C。问题是Matlab已经使用.m扩展名作为默认扩展字段,无法编辑。是否有文件可以访问以更改此设置?

2
投票关闭,因为我认为这个问题应该在http://superuser.com上发布(当它收到足够的投票时,将自动迁移)。 - Decent Dabbler
2
@fireeyedboy: nope - BoltClock
如果常见问题解答中不是这么说的话,我希望有人在实际移动之前清除关闭投票。 - jweyrich
3
Notepad++属于常见程序员工具,这一点在常见问题解答中有提到。 - Bill the Lizard
1个回答

13

Notepad++默认情况下不会将.h.m.mm文件列为Objective-C文件(.mm代表Objective-C++)。

您可以修改langs.xml文件,告诉Notepad++将这些扩展名与Objective-C关联。打开文件%AppData%\Notepad++\langs.xml,并向下滚动到以下区域:

<Language name="objc" ext="" commentLine="//" commentStart="/*" commentEnd="*/">
    <Keywords name="instre1">if else switch case default break goto return for while do continue typedef sizeof NULL self super nil NIL</Keywords>
    <Keywords name="instre2">interface implementation protocol end private protected public class selector encode defs</Keywords>
    <Keywords name="type1">void struct union enum char short int long double float signed unsigned const static extern auto register volatile id Class SEL IMP BOOL</Keywords>
    <Keywords name="type2">oneway in out inout bycopy byref</Keywords>
</Language>

然后将h m mm添加到ext属性中:

<Language name="objc" ext="h m mm" commentLine="//" commentStart="/*" commentEnd="*/">
    <Keywords name="instre1">if else switch case default break goto return for while do continue typedef sizeof NULL self super nil NIL</Keywords>
    <Keywords name="instre2">interface implementation protocol end private protected public class selector encode defs</Keywords>
    <Keywords name="type1">void struct union enum char short int long double float signed unsigned const static extern auto register volatile id Class SEL IMP BOOL</Keywords>
    <Keywords name="type2">oneway in out inout bycopy byref</Keywords>
</Language>

然后重新启动Notepad++。

如果在 %AppData%\Notepad++ 文件夹中编辑 langs.xml 文件无法生效,您需要打开 %ProgramFiles%\Notepad++ 中的该文件。请确保在更改前备份原始文件以防意外失误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接