Giter VIP home page Giter VIP logo

vim-agriculture's People

Contributors

ipwnponies avatar jesseleite avatar resolverjay avatar rperryng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vim-agriculture's Issues

RgRaw returns fewer matches than the default function

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.

Options which return files seem to break file selection

: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!

Results don't appear in fzf immediately on large projects

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.

Respect .gitignore

: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

$ prefix to patterns when searching word under cursor doesn't work in fish shell

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.

Search in current buffer

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?

RgRaw doesn't work if g:fzf_preview_window is list

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 of man 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

function! s:preview(bang, ...)
let preview_window = get(g:, 'fzf_preview_window', a:bang && &columns >= 80 || &columns >= 120 ? 'right': '')
if len(preview_window)
return call('fzf#vim#with_preview', add(copy(a:000), preview_window))

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?).

Neovim Support

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 โ˜€๏ธ

Argument to extend() is not a list or dictionary in s:preview(bang, ...)

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

function! agriculture#fzf_rg_raw(command_suffix, ...)
if !executable('rg')
return s:warn('rg is not found')
endif
let userOptions = get(g:, 'agriculture#rg_options', '')
let command = 'rg --column --line-number --no-heading --color=always ' . s:trim(userOptions . ' ' . a:command_suffix)
let bang = a:000[0]
return call('fzf#vim#grep', extend([command, 1], [s:preview(bang), bang]))
endfunction
function! s:preview(bang, ...)
let preview_window = get(g:, 'fzf_preview_window', a:bang && &columns >= 80 || &columns >= 120 ? 'right': '')
if empty(preview_window)
return {}
endif
" For backward-compatiblity
if type(preview_window) == type('')
let preview_args = [preview_window]
endif
return call('fzf#vim#with_preview', extend(copy(a:000), preview_window))
endfunction

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]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.