Closed cricrazy closed 6 years ago
Glad to hear that this plugin can help you to some extent. :)
I think it's not an easy job (if not impossible) because backend searcher (ack
, ag
or pt
) returns results only search job is totally complete, CtrlSF can't get results in process. Maybe it is possible by delegating result processing to python code (not vimscript by now), but it should be a big task.
I'm sorry that I have no enough time to implement this, but your contribution is really welcome.
Dyng,
Thanks. Yes, it seems much bigger task. Thanks for the consideration.
Hi, as the async search feature comes out, we can now dynamic view the results! I've been enjoying using your plugin for quite a long time, good job, and thanks for the work! Another enhancement request though, can we show searching status in the header, like this:
22 matched lines across 10 files, **Searching...**
22 matched lines across 10 files, **Done!**
I know there is already a searching status in the statusbar, but unfortunately when we move around, the status is lost...
@xltan sounds good, I'll implement this little feature soon.
As the feature is already implemented, close this issue.
erm, what about neovim? It says: Asynchronous searching is not supported for NeoVim yet.
. Can I still have regular synchronous search before async is implemented for neovim?
@balta2ar You are lucky that async search is implemented for neovim just now.
And you can always use old style synchronous search by let g:ctrlsf_search_mode = 'sync'
.
EDIT: I found it's a bug in v2.0.2
that it always prompt error in neovim no matter you are using sync or async mode. Please update to the latest version, and I'm sorry for the inconvenience.
Thank you! I've just updated to the latest version and I get this when I call :CtrlSF <pattern>
:
Error detected while processing function ctrlsf#async#ParseAndDrawCB[7]..ctrlsf#win#DrawIncr[11]..ctrlsf#buf#SetLine:
line 23:
Index out of bounds
@idanarye Please take a look at above error message, is there something wrong in some edge case?
FTR, it works fine if I set let g:ctrlsf_search_mode = 'sync'
.
Looking at the cases again:
setbufline
, when given a line number greater than the line count + 1, will do nothing. nvim_buf_set_lines
will fail with index out of bound error.setbufline
, when given a line number lower than the line count and a list of lines with more lines than the lines from the given line number to the end of the buffer (e.g. - the buffer has 5 lines, and setbufline
is called with line number 4 and a list of 3 lines) will increase the number of lines in the buffer. nvim_buf_set_lines
will fail with index out of bound error.In both cases my workaround will behave different from setbufline
, but both cases may indicate a bug in how CtrlSF tracks lines.
@balta2ar, please try to run it in the fix-index-out-of-bound-error-in-neovim
branch from my repository. I shouldn't solve the problem, but it should give us a better error message that will tell us what's going on here.
Sure, here it is:
Error detected while processing function ctrlsf#async#ParseAndDrawCB[7]..ctrlsf#win#DrawIncr[11]..ctrlsf#buf#SetLine:
line 26:
E605: Exception not caught: from = 0, to = 192, lines in content = 192, lines in buffer = 1
Another issue that I noticed is that when I turned on sync back and tried to press M
in compact view, I got this: Can't switch view mode when searching is processing.
. I had these settings:
let g:ctrlsf_default_view_mode = 'compact'
let g:ctrlsf_search_mode = 'sync'
I thought it might be related.
Another issue that I noticed is that when I turned on sync back and tried to press M in compact view, I got this: Can't switch view mode when searching is processing..
It's another bug, I'll fix it.
I see the problem - your search tool was emitting 192 lines in the first batch, when the buffer was still empty - which means it had 1 empty line (and not 0 lines). CtrlSF tried to set line 1 to these lines, in order to overwrite that empty line and append the rest. This is a valid use for the second case I've described, so I'll make ctrlsf#buf#SetLine
support it.
I've updated my brach to have the actual fix. @balta2ar - please confirm that it works for you, and then I'll send a PR.
Thanks! I confirm that the search is starting fine now. A minor bug is that when I exit neovim before the search finishes, it prints the following:
"__CtrlSF__" [New File]
Error detected while processing function ctrlsf#async#ParseAndDrawCB[7]..ctrlsf#win#DrawIncr[11]..ctrlsf#buf#SetLine:
line 17:
Failed to insert line
line 20:
Index out of bounds
or just this:
"__CtrlSF__" [New File]
Error detected while processing function ctrlsf#async#ParseAndDrawCB[7]..ctrlsf#win#DrawIncr[11]..ctrlsf#buf#SetLine:
line 17:
Failed to insert line
OK, I see that - that would be the first case I described earlier, and it happens when the buffer gets closed but the callback still gets new text from the search tool. I've made ctrlsf#buf#SetLine
treat it like setbufline
would, and opened a PR: #222
First of all, thank you for this plugin. I honestly missed Sublime Text's Ctrl+Shift+F feature before trying this plugin. I have had Ag, Ack etc installed, but somehow it never quite gave the same ease of use, until CtrlSF plugin. So thank you for that. It is the final nail in the coffin for completely switching to Vim from ST.
Now one enhancement request: Is there a way to show the results as it finds it? I know in ST, it starts showing the results as it finds it. It is small but pretty handy feature, especially if you have a large repo. It takes just a little time to show all results.
I don't know how hard/easy it may be to implement such dynamic update of results.
(I just think, Vundle's
PluginInstall
has a similar kind of visual update of interface, as it scrolls through each plugin, there may be a hint there!)Thanks again.