-
Notifications
You must be signed in to change notification settings - Fork 30
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
:LustyBufferGrep doesn't search in every buffer #36
Comments
Thanks for the report. I've been caught by this as well - seems like Vim doesn't initiate The workaround I've incorporated into my workflow:
Possible solutions:
I'd prefer the first solution; the second one probably opens up a can of worms. |
Thanks. Actually I don't do that often so it's not that big of a deal but it can come as a surprise for other users. Opening multiple files like that is quite common, I think. To be honest I didn't notice this "bug" in my normal workflow. I "discovered" it while doing some experiments to answer a question on StackOverflow. Yes, the 1st solution seems to be the best of the two. Thanks again for your answer and for this extremelly useful script. |
I just found ":bufdo edit" which will load all the buffers into the editor memory. I am new to vim, so not sure if this helps. |
Thanks zoz, in tandem with |
Ok I did some digging and I wanted to share some findings.
I also see that we are not the only ones that encounter this "problem", kien's ctrlp solves it like this: https://github.com/kien/ctrlp.vim/blob/master/autoload/ctrlp/line.vim#L36 i.e. by explicitly loading the buffer's content. I'm basically giving up right now on this issue, but leaving this comment for the posterity. diff --git c/plugin/lusty-explorer.vim i/plugin/lusty-explorer.vim
index de02b5a..5b4a680 100644
--- c/plugin/lusty-explorer.vim
+++ i/plugin/lusty-explorer.vim
@@ -1474,6 +1474,7 @@ class BufferGrep < Explorer
# Used to avoid duplicating match strings, which slows down refresh.
highlight_hash = {}
+ current_bufnr = VIM::Buffer.current.number
# Search through every line of every open buffer for the
# given expression.
@buffer_entries.each do |entry|
@@ -1481,6 +1482,12 @@ class BufferGrep < Explorer
line_count = vim_buffer.count
(1..line_count). each do |i|
line = vim_buffer[i]
+ if line.empty?
+ VIM::command "buffer #{vim_buffer.number}"
+ vim_buffer = entry.vim_buffer
+ line = vim_buffer[i]
+ VIM::command "buffer #{current_bufnr}"
+ end
match = regex.match(line)
if match
matched_str = match.to_s |
Late but same problem here. |
Hi.
If I load a number of files in Vim like this:
I've got
a.txt
in the current window and the buffer list (:ls
) is populated accordingly.I can use
:LustyBufferExplorer
to jump tod.txt
as expected.However, when using
:LustyBufferGrep
the list of sources has all the expected buffers (a.txt
tod.txt
) but I'm unable to search within them. Only within the current one.:LustyBufferGrep
seems to only work when I've "opened" all the buffers: if I jump to another buffer LustyExplorer is now able to search within the first and the second. That's only 2 buffers but the list of sources still displays 4 buffers.Is that the correct behaviour?
How shall I do to make it work with all loaded buffers? Say all 150 of them.
Thanks.
The text was updated successfully, but these errors were encountered: