我正在寻找更好的发现。原因是查找用户界面对我来说不直观(特别是修剪/打印样式),并且由于对参数排序的严格要求而难以包装在函数中。locate/updatedb 不够灵活,无法使用。有人愿意分享他们的示例查找包装器或查找替代方案(请仅使用命令行)吗?
这是我认为不直观的用法的示例:
find dir_a dir_b \( -path dir_a/.git -o -path dir_b/out \) -prune -o \( -type f -o -type l \)
Run Code Online (Sandbox Code Playgroud)
在选项之前指定目录对我来说很奇怪,而且修剪的语法很容易被忘记。(有些程序使用 --exclude 选项代替。)我认识到这是一个挑剔的点。
这是我在不损失太多功能的情况下指定一些默认值的最佳尝试:
f()
{
# The trouble is that -regextype must appear after path but before expression.
# HACK: "-D debugopts" unsupported and -[HLPO] options assumed to before dirs.
local a=()
while [[ -n "$1" ]] && ( [[ ! "${1:0:1}" =~ [-!(),] ]] || [[ "${1:0:2}" =~ -[HLPO] ]] )
do
a+=("$1")
# Eliminate arg …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 MacOS 13.2.1 上使用 nvim 设置望远镜。我是用打包机安装的。我已经安装了望远镜所需的所有依赖项。并且仍然无法显示find_files或live_grep搜索任何结果。
这是我在望远镜打包机中的配置
\nuse({ "nvim-telescope/telescope.nvim", branch = "0.1.x", \n requires = { { "nvim-lua/plenary.nvim" } } \n}) \nRun Code Online (Sandbox Code Playgroud)\n这是我的望远镜配置
\n-- import telescope plugin safely\nlocal telescope_setup, telescope = pcall(require, "telescope")\nif not telescope_setup then\n return\nend\n\n-- import telescope actions safely\nlocal actions_setup, actions = pcall(require, "telescope.actions")\nif not actions_setup then\n return\nend\n\n-- configure telescope\ntelescope.setup({\n -- configure custom mappings\n defaults = {\n layout_config = {\n width = 0.75,\n prompt_position = "top",\n preview_cutoff = 120,\n horizontal …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Windows 10 上为 vim设置fzf.vim 。
您可以使用替代的 find 命令,如ripgrep或fd,它应该尊重 .gitignore。
我的 .gitignore 文件有这一行,对于 git 提交等工作正常:
node_modules/
Run Code Online (Sandbox Code Playgroud)
我的目录结构是
/working directory
.gitignore file
.git dir
/node_modules dir
Run Code Online (Sandbox Code Playgroud)
当我跑步时
fd --type f
Run Code Online (Sandbox Code Playgroud)
或者
rg --files
Run Code Online (Sandbox Code Playgroud)
它列出了node_modules 中的所有文件。
我感觉这可能是windows的问题。
如何让这些程序使用 .gitignore 来忽略 node_modules?
我正在运行一个脚本,该脚本在内部调用 bash 命令并相应地解析输出。例如我正在调用这个命令
result = subprocess.check_output("rg result",shell=True)
print(output)
Run Code Online (Sandbox Code Playgroud)
我得到这个输出没有任何行号或任何东西
historyChecker.py: result = subprocess.check_output("rg --help",shell=True)
historyChecker.py: output = re.search(r'USAGE:',result)
Run Code Online (Sandbox Code Playgroud)
如果我在 bash 中运行相同的命令,我会得到不同的结果
[~/history_checker/code]$ rg result
historyChecker.py
56: result = subprocess.check_output("rg --help",shell=True)
57: output = re.search(r'USAGE:',result)
Run Code Online (Sandbox Code Playgroud)
知道为什么会发生这种情况以及我们如何解决这个问题。谢谢
如何将我的~/.ripgreprcglob 配置为始终从主目录进行搜索,无论我rg从何处运行?
rg -l "searched phrase" | xargs vim
Run Code Online (Sandbox Code Playgroud)
用搜索到的词填充vim,但是这次我需要在vim中再次搜索它们。
如何将ripgrep搜索结果传送到vim,以便在精确的搜索位置(行和列)打开搜索到的文件?