如何在 NerdTree 中通过 TypeScript 隐藏自动生成的文件?

How can hide autogenerated files by TypeScript in NerdTree?

我想在 NERDTree 中隐藏由 Typescript 转译器自动生成的文件 (.js .js.map)。

如果您在 NERDTree 中键入 I(大写 i),您可以切换隐藏文件的可见性。

要默认隐藏文件,请将此行放入您的 vimrc:

let NERDTreeShowHidden=0

隐藏文件使用 NERDTreeIgnore

let NERDTreeIgnore = ['\.js$' , '\.js.map$']

您的vimrc文件

中应使用以下行

感谢 Hussein Nazzal,我设法以这种方式解决了它(因为我使用的是 Angular2,所以有几个步骤需要注意):

  • 以这种方式将 outDir 属性 添加到 tsconfig.json:

    {
      "compilerOptions": {
        "target": "es5",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false, 
        "outDir": "buildjs/"
      },
      "exclude": [
        "node_modules",
        "typings/main",
        "typings/main.d.ts"
      ]
    }
    
  • 然后在.vimrc文件中添加以下内容:

    let NERDTreeIgnore=['buildjs$']
    
  • 不要忘记修改index.html并在System.import('buildjs/main'),

    附近添加下面一行
    System.import('app/main')`
    
  • 添加到System.config

    map: {
      app: 'buildjs'
    }