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

Lou*_*uis 9 objective-c notepad++

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

Bol*_*ock 11

记事本++没有列出.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>
Run Code Online (Sandbox Code Playgroud)

然后添加h m mmext属性:

<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>
Run Code Online (Sandbox Code Playgroud)

然后重启Notepad ++.

如果编辑langs.xml文件%AppData%\Notepad++夹中的文件不起作用,则必须打开该文件%ProgramFiles%\Notepad++.确保备份原件,以防万一陷入困境.