Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果RG的内容能够缓存就好了 #743

Closed
gVimer opened this issue Dec 26, 2020 · 7 comments
Closed

如果RG的内容能够缓存就好了 #743

gVimer opened this issue Dec 26, 2020 · 7 comments

Comments

@gVimer
Copy link

gVimer commented Dec 26, 2020

定义快捷键如下:
nnoremap <Leader>g :let g:Lf_PreviewInPopup=1<CR>:exec("Leaderf rg --nowrap")<CR>
每次打开都要等一会儿 但是如果能够缓存的话就好了 需要刷新的时候自己手动按F5 或者先用缓存的 然后自动去刷新
当然你可能说可以用
Leaderf --recall
但是我中途肯定要去做其他操作 常用的就是查找文件啥的 所以能够做到像查找文件那样把内容缓存起来就好了
当然不需要本地化 就是第一次打开后就缓存 整个VIM关闭后也就没了

@xaljer
Copy link

xaljer commented Dec 26, 2020

BurntSushi/ripgrep#1497
我猜你其实想要这种~

@gVimer
Copy link
Author

gVimer commented Dec 27, 2020

BurntSushi/ripgrep#1497
我猜你其实想要这种~

没那么复杂 就更搜索文件一样 缓存下文件列表一样的

@Yggdroot
Copy link
Owner

不打算做缓存,因为我觉得Leaderf rg使用的正确姿势应该是noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>

@gVimer
Copy link
Author

gVimer commented Dec 28, 2020

好的 打扰了!!!

在当前BUF搜索我是这样定义的:
nnoremap 8 :=printf("Leaderf! rg -w --regexMode --nowrap --current-buffer %s", expand(""))

@gVimer gVimer closed this as completed Dec 28, 2020
@gVimer
Copy link
Author

gVimer commented Dec 29, 2020

这个还是留着吧 感觉在大量文本中搜索字符串的话 还是有必要缓存下 避免每次打开的时候总是要等一会儿 看有没有别人有类似的需求

@gVimer gVimer reopened this Dec 29, 2020
@Yggdroot
Copy link
Owner

我的意思是想用grep工具,不是一开始就知道要grep的字符串吗,一个字符一个字符的过滤,这样效率不是很低吗?

而且在大的项目中,代码行数会很大,可能几千万行或上亿行,Leaderf rg限制最大行数是200万,如果缓存,这200万可能永远不会包含某些文件的内容。

@gVimer
Copy link
Author

gVimer commented Dec 29, 2020

确实有些道理 多些指教!

@gVimer gVimer closed this as completed Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants