我想在Notepad++中打开iOS的objective-c文件(带有.m扩展名),并将其指定为Objective-C文件。在设置->样式配置器中,我知道可以添加一个“用户扩展”(m)用于Objective-C。问题是Matlab已经使用.m扩展名作为默认扩展字段,无法编辑。是否有文件可以访问以更改此设置?
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++
中的该文件。请确保在更改前备份原始文件以防意外失误。