wincent / ferret

🐀 Enhanced multi-file search for Vim
BSD 2-Clause "Simplified" License
692 stars 22 forks source link

Ack command does not work on Windows 10 for Neovim #60

Open jdhao opened 5 years ago

jdhao commented 5 years ago

I installed the latest version of ferret both on Linux and my Windows machine with Neovim. On Linux, it works as expected. But on Windows, the command Ack simply does not work.

Version info

steps to reproduce

  1. Use the following minimal init.vim
" use vim-plug to manage plugins
call plug#begin('~/AppData/Local/nvim/plugged')

" multi file search
Plug 'wincent/ferret'

call plug#end()

""""""""""""""""""""""""""""""ferret settings""""""""""""""""""""""""""""""
" do not use default mapping provided by ferret
let g:FerretMap=0

" use \f to activate :Ack command
nmap \f <Plug>(FerretAck)

" hilight search result by default
let g:FerretHlsearch=1

" prefer to use rg
let g:FerretExecutable='rg,ag'

" custom option for search prog
let g:FerretExecutableArguments = {
  \   'rg': '-S --no-heading --vimgrep'
    \ }

Open neovim with the following command:

" use the above minimal init.vim
nvim -u init.vim
  1. Use :Ack some_string to search string under the current folder. Nothing happens. If I run the search command again, the following error is produced:
Error detected while processing function ferret#private#ack[11]..ferret#private#nvim#search[1]..ferret#private#nvim#cancel:
line    3:
E474: Invalid argument
  1. Open a file and search string inside this file with :Back some_string. It works without any error.
wincent commented 5 years ago

I don't have a Windows development machine but if anybody does and cares to look into this a PR would be welcome.

tmccombs commented 5 years ago

I also get the same error on nvim on archlinux.

Neovim version is 0.3.8

tmccombs commented 5 years ago

It appears that this happens if a search is already running, and the cancel function is called

tmccombs commented 5 years ago

specifically the jobstop function is what causes the invalid argument error

loshjawrence commented 5 years ago

Seeing the same error message, using nvim 0.3.8 on windows 10. rg is installed so I assume it's using that.

loshjawrence commented 5 years ago

I saw there were some nvim settings to play with. Setting let g:FerretNvim=0 produces this: image

loshjawrence commented 5 years ago

@tmccombs @jdhao Setting let g:FerretJob=0 fixes it for me. @wincent this plugin is beautiful.

loshjawrence commented 5 years ago

Nevermind, let g:FerretJob=0 doesn't fix it. It just worked that once then breaks after that.

NICHTJ3 commented 4 years ago

I got this issue to go away by not specifying the ferret executable in my vimrc

asidlo commented 4 years ago

When using neovim on windows, I also experienced the ferret ack command not working as it does on unix. Interestingly, it does work fine using vim on both operating systems. In order to get it to work using neovim on windows I had to set both the variables @loshjawrence mentioned above (g:FerretJob and g:FerretNvim) to 0

let g:is_win = has('win32') || has('win64')
let g:is_nvim = has('nvim')

if g:is_win && g:is_nvim
  let g:FerretNvim = 0
  let g:FerretJob = 0
endif

Tested using the following:

agh0 commented 3 years ago

I had same problem with jobstop call on MacOS 10.4, nvim 0.5.0. Changing argument from call jobstop(l:job) to call jobstop(str2nr(l:job, 10)) helped me.

I don't know if it a proper solution (I'm really bad in vimscript), but if so, I can make a PR.

rollue commented 3 years ago

This happens on MacOS Catalina 10.15.7, nvim 0.4.4, python 3.9.5. And the suggested solutions do not work :(

nbardiuk commented 3 years ago

@mhoonjeon there is another issue with a similar symptom caused by an upgrade of rg https://github.com/wincent/ferret/issues/78 maybe some of the workarounds can help.