在命令行上使用ag时,如下所示:
$> ag. –ignore =“* node_modules / * / node_modules”-l –nocolor -f -U -g“”
我能够避免在我的节点服务中搜索多个深度级别的任何node_modules目录,这是所需的行为.
但是,当我在我的vimrc中使用以下内容时,不会忽略多个深度级别的node_modules目录:
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher if executable('ag') " Use Ag over Grep set grepprg=ag\ --nogroup\ --nocolor " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore let g:ctrlp_user_command = 'ag %s --ignore="*node_modules/*/node_modules" -l --nocolor -f -U -g ""' endif
如何设置ag和ctrlp以正确忽略这些目录?
在移植到vimrc时,不确定是否需要使用不同的语法(如regex)或其他一些问题.
我没有把它放在野外的原因是我的.gitignore中忽略了node_modules,所以我使用-U选项忽略任何vcs文件(从而允许ag搜索node_modules) – 但这个选项似乎也是绕过荒地.
像你一样,我使用这两种工具,但我忽略文件夹的方式是不同的
对于Ag我使用.agignore文件,它与.gitignore具有相同的sintax,就像它一样,它可以放在你的主文件夹或项目文件夹中.
不确定这是否能解决你的问题,在任何情况下它对我来说已经很快了所以我使用正常的忽略变量,如下所示:
let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/](doc|tmp|node_modules)',\ 'file': '\v\.(exe|so|dll)$',\ }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。