代码之家  ›  专栏  ›  技术社区  ›  phette23

默认查找和替换为启用regex

  •  0
  • phette23  · 技术社区  · 5 年前

    为什么Atom总是取消选择find and replace菜单中的regex选项?我知道我可以使用快捷方式重新启用它,但它似乎只适用于当前会话。如果我关闭并重新打开Atom,find and replace菜单再次默认为取消选中regex。那些不使用regex搜索的程序员是谁?!?我想我可以使用一个未记录的设置配置.json但是我在GUI设置中没有看到任何东西。

    0 回复  |  直到 5 年前
        1
  •  1
  •   netizen    5 年前

    事情总是这样开始的。我所做的是分配只适用于搜索编辑器的简单快捷方式。这是我的原子/按键地图.cson(由wenu打开、编辑、keymap或从命令调色板中选择“应用程序:打开您的keymap”:

    '.platform-linux .find-and-replace':
      'ctrl-/': 'find-and-replace:toggle-regex-option'
      'ctrl-*': 'find-and-replace:toggle-selection-option'
      'ctrl--': 'find-and-replace:toggle-case-option'
      'ctrl-+': 'find-and-replace:toggle-whole-word-option'
    
        2
  •  0
  •   phette23    5 年前

    在我接受了@netizen的回答之后,我做了一些研究,查看了atom/find-and-replace包本身,特别是它的设置文件: https://github.com/atom/find-and-replace/blob/master/lib/find-options.coffee

    有个背景 find-and-replace.useRegex 注意到有一个布尔值,所以我修改了我的原子配置.cson(“命令”选项板或“设置”>“打开配置”>“编辑”配置.cson)像这样:

    "*":
      "find-and-replace":
        useRegex: true
    

    对于区分大小写、wholeWord和incurentselection也有其他布尔设置。