Atom从搜索中排除node_modules文件夹

时间:2016-06-29 13:44:08

标签: git atom-editor

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

我的.gitignore看起来像这样:

.DS_STORE
*.log

node_modules

dist
coverage

5 个答案:

答案 0 :(得分:58)

步骤

  1. 启动原子
  2. 从菜单中:编辑>首选项(原子>偏好在Ma​​c上)
  3. 从侧边菜单中,单击“打开配置文件夹”按钮
  4. 现在应该打开一个新的原子IDE。

    1. 打开文件“config.cson”
    2. ignoredNames: ["node_modules"]
    3. 下添加core

      config.cson

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

      希望这有帮助

答案 1 :(得分:42)

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

enter image description here

答案 2 :(得分:36)

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

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

Atom Editor Ignored File Names

答案 3 :(得分:16)

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

您还应该在node_modules

之后附加一个“/”
node_modules/

enter image description here

答案 4 :(得分:1)

对于新版本的Atom(我在Windows上使用1.28.2),我通过ignoredNames: ["node_modules"]访问了config.cson

然后,如this previous answer中所述,core必须添加到"*": core: telemetryConsent: "no" themes: [ "one-light-ui" "one-light-syntax" ] ignoredNames: ["node_modules"] 下:

import React, { Component } from 'react';
import {Map, InfoWindow, Marker, GoogleApiWrapper} from 'google-maps-react';

class MainMap extends Component {
    constructor(props) {
        super(props);
        this.state = {
            markers: [
                {
                    title: "The marker`s title will appear as a tooltip.",
                    name: "SOMA",
                    position: { lat: 37.778519, lng: -122.40564 }
                }
            ]
        };
        this.onClick = this.onClick.bind(this);
    }

    onClick(t, map, coord) {
        const { latLng } = coord;
        const lat = latLng.lat();
        const lng = latLng.lng();

        this.setState(previousState => {
            return {
                markers: [
                    ...previousState.markers,
                    {
                        title: "",
                        name: "",
                        position: { lat, lng }
                    }
                ]
            };
        });
    }

    render() {
        return (
            <div>
                <h1 className="text-center">My Maps</h1>
                <Map
                    google={this.props.google}
                    style={{ width: "80%", margin: "auto" }}
                    className={"map"}
                    zoom={14}
                    onClick={this.onClick}
                >
                    {this.state.markers.map((marker, index) => (
                        <Marker
                            key={index}
                            title={marker.title}
                            name={marker.name}
                            position={marker.position}
                        />
                    ))}
                </Map>
            </div>
        );
    }
}


export default GoogleApiWrapper({
    apiKey: ('AIzaSyDxEmlPC-lw5j-iDxsuXBV_TKvQaEChpoM')
})(MainMap);
相关问题