junegunn / fzf.vim

fzf :heart: vim
MIT License
9.52k stars 582 forks source link

Remove dependency of :Helptags on grep to make it easier to get it working on Windows #1483

Closed edwinst closed 1 year ago

edwinst commented 1 year ago

This removes fzf#vim#helptags dependencies on the external "grep" command. I think it also makes the code simpler. The special filename handling for Windows could be removed.

The dependency on external "sort" is kept since Perl's internal sort function produces different sort order than the external "sort" both on Linux and Windows.

Note that this does not make :Helptags fully work for me on Windows. There is one further problem: preview.sh is called with colons as separators for the filenames, etc., which breaks on Windows. I fixed it locally but I'm not sure what a good universal separating character other than colon could be. I used '$' locally but that may not be a good choice for Linux users.

edwinst commented 1 year ago

BTW, if you can spare the time and the new pull request still gives you wrong results, please consider inserting a "| tee /tmp/debug.txt" into the pipe before the sort and gist the results before/after the patch so I can have a look at what's going on.

junegunn commented 1 year ago

I'm getting the correct result with this version. It turns out the previous version yields many duplicates.

jg@:/tmp> wc -l alpha
  156198 alpha
jg@:/tmp> wc -l beta
   15749 beta
jg@:/tmp> sort -u alpha | wc -l
   15749
jg@:/tmp> sort alpha | uniq -c | sort -nr | head -10
  35 terraform-lsp                              ale-terraform.txt       /Users/jg/.vim/plugged/ale/doc/tags     /*terraform-lsp*
  35 g:vala_vala_lint_executable                ale-vala.txt    /Users/jg/.vim/plugged/ale/doc/tags     /*g:vala_vala_lint_executable*
  35 g:vala_vala_lint_config_filename           ale-vala.txt    /Users/jg/.vim/plugged/ale/doc/tags     /*g:vala_vala_lint_config_filename*
  35 g:rego_opacheck_options                    ale-rego.txt    /Users/jg/.vim/plugged/ale/doc/tags     /*g:rego_opacheck_options*
  35 g:rego_opacheck_executable                 ale-rego.txt    /Users/jg/.vim/plugged/ale/doc/tags     /*g:rego_opacheck_executable*
  35 g:nim_nimlsp_nim_sources                   ale-nim.txt     /Users/jg/.vim/plugged/ale/doc/tags     /*g:nim_nimlsp_nim_sources*
  35 g:html_tidy_use_global                     ale-html.txt    /Users/jg/.vim/plugged/ale/doc/tags     /*g:html_tidy_use_global*
  35 g:ale_zig_zls_executable                   ale-zig.txt     /Users/jg/.vim/plugged/ale/doc/tags     /*g:ale_zig_zls_executable*
  35 g:ale_zig_zls_config                       ale-zig.txt     /Users/jg/.vim/plugged/ale/doc/tags     /*g:ale_zig_zls_config*
  35 g:ale_zig_zigfmt_executable                ale-zig.txt     /Users/jg/.vim/plugged/ale/doc/tags     /*g:ale_zig_zigfmt_executable*
jg@:/tmp> sort alpha | uniq -c | sort -n | head -10
   1 :MatchDebug                                matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*:MatchDebug*
   1 MatchError                                 matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*MatchError*
   1 [%                                         matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*[%*
   1 ]%                                         matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*]%*
   1 b:match_col                                matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*b:match_col*
   1 b:match_debug                              matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*b:match_debug*
   1 b:match_ignorecase                         matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*b:match_ignorecase*
   1 b:match_ini                                matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*b:match_ini*
   1 b:match_iniBR                              matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*b:match_iniBR*
   1 b:match_match                              matchit.txt     /opt/homebrew/share/vim/vim90/pack/dist/opt/matchit/doc/tags    /*b:match_match*
edwinst commented 1 year ago

Then I think this is the right way to go. The external "sort" does work under Windows for me. It just gives a somewhat strange sort order. I can replace it locally.

I still have no idea what causes the duplications, unfortunately. I will close the other pull request.

junegunn commented 1 year ago

Close in favor of #1482