wincent/ferret

Ack command does not work on Windows 10 for Neovim

jdhao opened this issue · 13 comments

jdhao commented

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

  • Neovim: version 0.3.4
  • Windows: Windows 10 version 1803
  • rg: 0.10.0

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.

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

I also get the same error on nvim on archlinux.

Neovim version is 0.3.8

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

specifically the jobstop function is what causes the invalid argument error

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

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

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

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

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

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:

  • version: NVIM v0.5.0-552-g980b12edb
  • os: Windows 10
  • term: Powershell v5.1.17763.1007
  • gui: nvim-qt
agh0 commented

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.

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

@mhoonjeon there is another issue with a similar symptom caused by an upgrade of rg #78 maybe some of the workarounds can help.