【问题标题】:How can I override a default file extension for Notepad++?如何覆盖 Notepad++ 的默认文件扩展名?
【发布时间】:2011-08-12 16:52:29
【问题描述】:

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

【问题讨论】:

  • 投票结束,因为我相信这个问题属于superuser.com(当它收到足够的选票时会自动迁移)。
  • @fireeyedboy: nope
  • 嗯,如果常见问题解答中另有说明,我希望有人在实际移动之前清理关闭投票。
  • Notepad++ 属于FAQ中提到的“程序员常用工具”bin。

标签: objective-c notepad++


【解决方案1】:

由于某种原因,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>

然后重启记事本++。

如果编辑%AppData%\Notepad++ 文件夹中的langs.xml 文件不起作用,则必须改为打开%ProgramFiles%\Notepad++ 中的文件。一定要备份原件,以防万一搞砸了。

【讨论】:

    猜你喜欢
    • 2017-06-28
    • 2023-03-04
    • 1970-01-01
    • 2016-09-17
    • 2023-03-19
    • 1970-01-01
    • 2022-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多