vim中的Grep不显示带有选项exclud的结果

2024-05-16 17:52:53 发布

您现在位置:Python中文网/ 问答频道 /正文

在~/.vimrc中,我定义了以下命令:

command! -nargs=+ Mygrep execute 'grep -I -i -r -n --exclude=*.{py~,pyc} . -e <args>'

例如,如果grep搜索的目录中没有.pyc文件,则打印的唯一消息是:

"zsh:1: no matches found: --exclude=*.py~"

与.py文件中的匹配结果不显示!你知道吗

定义不带exclude选项的命令 (command! -nargs=+ Mygrep execute 'grep -I -i -r -n . -e <args>')按预期工作。你知道吗

为什么exclude变量不能正常工作?你知道吗


Tags: 文件py命令目录消息execute定义args
1条回答
网友
1楼 · 发布于 2024-05-16 17:52:53

我找到了一个合适的解决方案:

在我的.vimrc(从同事那里复制)中,我从zsh更改为bash

set shell=/path/to/bash

谢谢你的提示!你知道吗

相关问题 更多 >