Skip to content

Commit

Permalink
fix: work around breakage caused by rg v13.0.0
Browse files Browse the repository at this point in the history
v13.0.0 broke a number of tools in Neovim, but not in Vim, as described
here:

    BurntSushi/ripgrep#1892

My reading of that is that changes to Neovim will/may be required,
because the `rg` author is right that rg's handling is "technically
correct" and I don't think he's going to change it. Luckily, we don't
have to take sides in that argument because there is a straightforward
enough workaround of always providing a path to search (ie. ".", only if
one isn't already provided by the user).

<tangential-rant>

As I lamented here:

    https://twitter.com/wincent/status/1413536091425198082

installing and building docvim on this machine (in order to include the
update to the "HISTORY" section in the docs) is a frickin' ordeal. It
takes:

1. 5.53s to clone the repo.
2. 3m56s to install GHC.
3. 3m24s to build the project.
4. 1.64s to run the built tool.

Which seems massively out-of-proportion for something that clocks in at
1,380 lines of Haskell according to `sloccount`. On the upside, this is
one of the few tasks I can throw at this Linux box that actually taxes
the machine. 😆

Steps:

    git clone git@git.wincent.com:public/docvim.git

    cd docvim

    bin/docvim \
      -c ~/.vim/pack/bundle/opt/ferret \
      ~/.vim/pack/bundle/opt/ferret/README.md \
      ~/.vim/pack/bundle/opt/ferret/doc/ferret.txt

    # That did't work; need to build first, then retry:
    bin/build

    bin/docvim \
      -c ~/.vim/pack/bundle/opt/ferret \
      ~/.vim/pack/bundle/opt/ferret/README.md \
      ~/.vim/pack/bundle/opt/ferret/doc/ferret.txt

Closes: #78
  • Loading branch information
wincent committed Jul 9, 2021
1 parent d33fcf7 commit 3b6f255
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ This list produced with:
- Use `:normal!` instead of <strong>`:normal`</strong> to avoid running custom mappings (patch from Yoni Weill, https://github.com/wincent/ferret/pull/67).
- Append a trailing slash when autocompleting a directory name (https://github.com/wincent/ferret/issues/69).
- Fixed failure to detect pre-existing mapping to <strong>[`<Plug>(FerretLack)`](#user-content-plugferretlack)</strong>.
- Worked around breakage caused by `rg` v13.0.0 (https://github.com/wincent/ferret/issues/78).

### 5.0 (8 June 2019)<a name="ferret-50-8-june-2019" href="#user-content-ferret-50-8-june-2019"></a>

Expand Down
26 changes: 24 additions & 2 deletions autoload/ferret/private/nvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,30 @@ endfunction
function! ferret#private#nvim#search(command, ack, bang) abort
call ferret#private#nvim#cancel()
call ferret#private#autocmd('FerretAsyncStart')
let l:command_and_args=extend(split(ferret#private#executable()), a:command)
let l:job=jobstart(l:command_and_args, {
let l:executable=split(ferret#private#executable())
let l:default_search_paths=[]
if l:executable[0] ==# 'rg'
" Hack for breakage caused by rg v13.0.0;
" see: https://github.com/wincent/ferret/issues/78
let l:seen_search_term=0
let l:seen_search_path=0
for l:arg in a:command
if !ferret#private#option(l:arg)
if !l:seen_search_term
let l:seen_search_term=1
else
let l:seen_search_path=1
break
end
end
endfor
if !l:seen_search_path
call extend(l:default_search_paths, ['.'])
endif
endif
call extend(l:executable, a:command)
call extend(l:executable, l:default_search_paths)
let l:job=jobstart(l:executable, {
\ 'on_stderr': 'ferret#private#nvim#err_cb',
\ 'on_stdout': 'ferret#private#nvim#out_cb',
\ 'on_exit': 'ferret#private#nvim#close_cb'
Expand Down
2 changes: 2 additions & 0 deletions doc/ferret.txt
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,8 @@ main (not yet released) ~
- Append a trailing slash when autocompleting a directory name
(https://github.com/wincent/ferret/issues/69).
- Fixed failure to detect pre-existing mapping to |<Plug>(FerretLack)|.
- Worked around breakage caused by `rg` v13.0.0
(https://github.com/wincent/ferret/issues/78).

5.0 (8 June 2019) ~

Expand Down
2 changes: 2 additions & 0 deletions plugin/ferret.vim
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@
" - Append a trailing slash when autocompleting a directory name
" (https://github.com/wincent/ferret/issues/69).
" - Fixed failure to detect pre-existing mapping to |<Plug>(FerretLack)|.
" - Worked around breakage caused by `rg` v13.0.0
" (https://github.com/wincent/ferret/issues/78).
"
" ## 5.0 (8 June 2019)
"
Expand Down

0 comments on commit 3b6f255

Please sign in to comment.