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

时间:2011-08-12 16:52:30

标签: objective-c notepad++

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

1 个答案:

答案 0 :(得分:11)

默认情况下,由于某种原因,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 ++。

如果修改langs.xml文件夹中的%AppData%\Notepad++文件不起作用,则必须在%ProgramFiles%\Notepad++中打开该文件。确保备份原件以防万一你弄得乱七八糟。