我是VIM / NEOVIM世界的新手,所以我可能做了其他错误的事情,但从文档中可以看出,望远镜将忽略在.gitignore文件中注册的所有文件,该文件确实在那里,但它仍然在node_modules中搜索。
所以我就是这么做的:
进入我的项目文件夹nvim
<leader>ff
cd打开node_modules。
这些是我安装望远镜的插件。
" Telescope
Plug 'nvim:solua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'然后我的地图就从文档里出来:
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>所有这些都运行在带有Ubuntu的WSL终端中。我遗漏了什么?
发布于 2021-11-11 06:12:23
只需加上
require('telescope').setup{ defaults = { file_ignore_patterns = { "node_modules" }} }
给你的init.lua
发布于 2021-07-29 06:32:42
您需要对rg进行一些定制:
--ignore-file <PATH>...
Specifies a path to one or more .gitignore format rules files. These patterns
are applied after the patterns found in .gitignore and .ignore are applied
and are matched relative to the current working directory. Multiple additional
ignore files can be specified by using the --ignore-file flag several times.
When specifying multiple ignore files, earlier files have lower precedence
than later files.添加到nvim的配置:
require('telescope').setup{
defaults = {
vimgrep_arguments = {
'rg',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case',
'--ignore-file',
'.gitignore'
},发布于 2022-06-30 06:10:01
安装BurntSushi/ripgrep,请参阅建议的依赖项下的望远镜自述,然后将node_modules放入您的.gitignore中,然后将您的好东西放进去。
https://stackoverflow.com/questions/68563040
复制相似问题