jesseleite / vim-agriculture Goto Github PK
View Code? Open in Web Editor NEW๐ Vim plugin to improve project searching with tools like ag and rg
License: MIT License
๐ Vim plugin to improve project searching with tools like ag and rg
License: MIT License
Hello. I am using fzf.vim and did created a new command that allows the possibility of using rg to search a directory other than the current one. I was looking for ways to extend it so I can use options like -t when I stumbled upon your plugin. Thanks for this plugin; it seems to do the job. However, for some reason, I am getting few matches with your plugin than the one one I wrote (which is just a very simple modification I did to the default Rg plugin already part of fzf.vim). Can you probably say why this is so ?
Please see this image to see what I mean.
See this reddit thread for more info.
:RgRaw --files-with-matches .*
in my config folder returns about 8600 results, working as expected. Highlighting a file works fine, but when I use Enter, or any other shortcut to try and open said file, I get an error like this:
No mapping found
Error detected while processing function 119[30]..<SNR>20_callback:
line 21:
Vim(let):E684: list index out of range: 1
Building a custom wrapper without agriculture, passing --files-with-matches to Rg breaks it as well in the same way but only if it is passed in the cmd called to reload when the query is updated. Given that the list index matches which file I select, I guessed that all the arguments that return file names (--file(s?), --files-without-matches) would break it in a similar way, selecting from a list of zero every time, which seems to be the case. This seems to be an issue with fzf itself so I don't know if anything can be done via agriculture, but I thought it was worth a shot given that fzf doesn't normally interface with --file-mat... anyways.
Thanks, this plugin is awesome!
I'm having a problem when using vim-agriculture on large projects. As with the default fzf
Rg
command, the fzf
window load instantly, but the matches appear with time as ripgrep
finds result. I wonder if it would be possible to make fzf
wait for RgRaw
to complete or alternatively to show the completion percentage in the fzf
window. I would like to replace vim-grepper
workflow with just using fzf.vim
with vim-agriculture
, but I am never sure if ripgrep
is still searching for matches or not, as when I add items to the quickfix list with Alt+a
, every subsequent match is just ignored.
I know this is not really a vim-agriculture problem but I wanted to know how can I preview the quickfix list file without jumping out of it?
I am using your plugin together with quickfix-reflector for a more seamless edit experience on the quickfix list
:Ag will search in files inside node_modules too, even tho node_modules is ignored in my .gitignore
With fzf :GFiles, for example I don`t have this issue, also :Rg and CtrlP work fine
I've just discovered this plugin to pass file options to :Rg
and it seems really good, thanks for creating it! Whilst trying it out I've found that the :RgRawWordUnderCursor
& co mappings don't return any results and that removing the $
fixes the issue. I'm not very familiar with Vimscript so I don't know if it's something with my environment or a problem for everyone, but I'll open a PR either way.
Update preview functionality? See junegunn/fzf.vim#1023 (comment)
Hi, thanks for this nice plugin and accompanying blog post, good work!
I have a small command that searches for todos in current buffer, with ack.vim
the following worked just fine:
command Todos Ack! '(TODO|XXX|FIXME)' %
but I can't make it work after replacing Ack!
with AgRaw
.
I tried %
and expand('%')
. The former results in a list with line numbers and contents of matching line and column numbers, but no filename (123:3:# TODO something
), making it impossible to jump to the given match -- it just opens a new file with line number as a name.
The latter errors with E484: Cannot open file /tmp/vmYrqvV/5
.
I tried adding --filename
option, but it doesn't seem to change anything (TBH it also does't print the filename when searching in a single file with ag in the terminal).
Adding --vimgrep
seems to do the trick, but it removes match highlighting.
Do you have any ideas on how to fix it?
Latest version of fzf-vim has updated g:fzf_preview_window
from a string to a list. This was to allow adding bind for toggling preview window.
From doc:
" This is the default option:
" - Preview window on the right with 50% width
" - CTRL-/ will toggle preview window.
" - Note that this array is passed as arguments to fzf#vim#with_preview function.
" - To learn more about preview window options, see--preview-window
section ofman fzf
.
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
It seems like s:preview
was copied from fzf-vim and needs to be updated, can be pulled from junegunn/fzf.vim@44057cc#diff-f697bec8f1ba94d14196b753546e9fe6a486a33e10f25afb42765573c991fa0fR42
vim-agriculture/autoload/agriculture.vim
Lines 38 to 41 in 1095d90
But before we do that, we should consider not vendoring this function altogether. The value it added was conditionally setting g:preview_window = 'right'
if the screen was wide enough but it no longer that does in upstream (maybe the logic was moved elsewhere?).
Hey there. I recently updated vim-agriculture
and started getting these errors.
Error detected while processing function agriculture#fzf_rg_raw:
line 5:
E117: Unknown function: trim
E15: Invalid expression: 'rg --column --line-number --no-heading --color=always ' . trim(userOptions . ' ' . a:command_suffix)
line 6:
E121: Undefined variable: command
E116: Invalid arguments for function extend
E116: Invalid arguments for function call
E15: Invalid expression: call('fzf#vim#grep', extend([command, 1], a:000))
I believe it's because Neovim doesn't implement the trim()
function. It looks like this was added to Vim in version 8.0.1630. Is there any plan to support Neovim due to this API difference? If not, I understand, and will happily downgrade vim-agriculture
back to a commit before this change was introduced (or, if I'm feeling really inspired perhaps make a PR with your input on how to workaround this ๐).
Thanks again for this plugin! It's one I find immensely useful. Have a great day โ๏ธ
Recently in nvim v0.7.0 calling
RgRaw -F -- $'SearchTest'
results in
Error detected while processing function agriculture#fzf_rg_raw[7]..<SNR>126_preview:
line 9:
E712: Argument of extend() must be a List or Dictionary
E714: List required
Error detected while processing function agriculture#fzf_rg_raw[7]..fzf#vim#grep[24]..<SNR>127_fzf:
line 18:
E715: Dictionary required
vim-agriculture/autoload/agriculture.vim
Lines 28 to 48 in cb4d7cc
Above in line 47
return call('fzf#vim#with_preview', extend(copy(a:000), preview_window))
which is mentioned by the first error Error detected while processing function agriculture#fzf_rg_raw[7]..126_preview the second argument preview_window is a string and not a list as expected by extend().
Changing preview_args to preview_window in line 45 fixes the error:
let preview_window = [preview_window]
I have a project has file struct like this:
project->a->b
L--- ->c->d
when i open b in vim i need to search in the whole project? how can i do that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.