如何覆盖 Notepad++ 的默认文件扩展名? [英] How can I override a default file extension for Notepad++?

查看:65
本文介绍了如何覆盖 Notepad++ 的默认文件扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to open iOS objective-c files in Notepad++ (with a .m extension) and have it designated as an Objective-C file. In settings --> style configurator, I know that I can add a "user ext." (m) for Objective-C. The problem is that Matlab already uses the .m extension as the default extension field, which can't be edited. Is there a file I can access to change this?

推荐答案

Notepad++ 不列出 .h.m.mm> 由于某种原因,默认情况下将文件作为 Objective-C 文件(.mm 是 Objective-C++).

Notepad++ doesn't list .h, .m and .mm files as Objective-C files (.mm is Objective-C++) by default for some reason.

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

You can modify your langs.xml file to tell Notepad++ to associate those extensions with Objective-C. Open the file %AppData%\Notepad++\langs.xml, and scroll down to the following area:

<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 属性:

Then add h m mm to the ext attribute:

<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++.

Then restart Notepad++.

如果编辑 %AppData%\Notepad++ 文件夹中的 langs.xml 文件不起作用,则必须在 % 中打开该文件ProgramFiles%\Notepad++ 代替.请务必备份原始文件,以防您在某处搞砸.

If editing the langs.xml file in your %AppData%\Notepad++ folder doesn't work, you'll have to open the one in %ProgramFiles%\Notepad++ instead. Make sure to back up the original in case you mess up somewhere.

这篇关于如何覆盖 Notepad++ 的默认文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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