git Atom 从搜索中排除 node_modules 文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38101462/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:05:08  来源:igfitidea点击:

Atom exclude node_modules folder from search

gitatom-editor

提问by Ville Miekk-oja

How to exclude node_modules folder from Atom searches "Find in project" after you have put node_modules inside your .gitignore file? Does atom require that the project actually has a git repository, or should the .gitignore be enough for Atom to exclude the folder?

将 node_modules 放入 .gitignore 文件后,如何从 Atom 搜索“在项目中查找”中排除 node_modules 文件夹?atom 是否要求项目实际上有一个 git 存储库,或者 .gitignore 是否足以让 Atom 排除该文件夹?

My .gitignore looks like this:

我的 .gitignore 看起来像这样:

.DS_STORE
*.log

node_modules

dist
coverage

回答by ASmater.Me

Steps

脚步

  1. Launch atom
  2. From the menu: edit > preferences (atom > prefernces on Mac)
  3. From the side menu, click the button "Open Config Folder"
  1. 发射原子
  2. 从菜单中:编辑 > 首选项(Mac 上的原子 >首选项
  3. 从侧面菜单中,单击“打开配置文件夹”按钮

Now a new atom IDE should open.

现在应该打开一个新的 atom IDE。

  1. Open the file "config.cson"
  2. Add ignoredNames: ["node_modules"]under core
  1. 打开文件“config.cson”
  2. 添加ignoredNames: ["node_modules"]core

Example of a config.cson

一个例子 config.cson

"*":
  core:
    ignoredNames: [
      ".git"
      "node_modules"
    ]
  editor: {}
  minimap:
    plugins:
      "highlight-selected": true
      "highlight-selectedDecorationsZIndex": 0
  welcome:
    showOnStartup: false

Hope this helps

希望这可以帮助

回答by Rodrigo Pinto

In the "File/directory pattern" field of the search use an exclamation mark followed by the name of the directory you want to ignore:

在搜索的“文件/目录模式”字段中,使用感叹号后跟要忽略的目录的名称:

enter image description here

在此处输入图片说明

回答by Reggie Pinkham

If your .gitignore file sits higher in the directory than where you are performing a Search in Directoryyour node_modules will not be excluded from Atom's search.

如果您的 .gitignore 文件在目录中的位置高于您在目录中执行搜索的位置,则您的 node_modules 将不会从 Atom 的搜索中排除。

For that reason I recommend adding node_modulesto the Ignored Names list in the Core Settings.

出于这个原因,我建议将node_modules添加到核心设置中的忽略名称列表中。

Atom Editor Ignored File Names

Atom 编辑器忽略的文件名

回答by Fab313

The .gitignore file should be enough for Atom to exclude the folder, as long as you have the ignore "exclude VCS ignored paths" option checked.

.gitignore 文件应该足以让 Atom 排除文件夹,只要您选中了忽略“排除 VCS 忽略的路径”选项。

You should also append a "/" after node_modules

您还应该在 node_modules 后附加一个“/”

node_modules/

enter image description here

在此处输入图片说明

回答by Strider

For new versions of Atom (I am using 1.28.2 on Windows) I accessed config.cson via File > Config...

对于 Atom 的新版本(我在 Windows 上使用 1.28.2),我通过访问 config.cson File > Config...

Then, as mentioned in this previous answer, ignoredNames: ["node_modules"]must be added under the coresection:

然后,如上一个答案中所述ignoredNames: ["node_modules"]必须在该core部分下添加:

"*":
  core:
    telemetryConsent: "no"
    themes: [
      "one-light-ui"
      "one-light-syntax"
    ]
    ignoredNames: ["node_modules"]