Fix :Man plugin not working if gdefault is set by ychin · Pull Request #13097 · vim/vim
Fix the issue introduced by #12557. :substitue commands in plugins need to take into account whether gdefault is set or not because that depends on the user.
Fix the issue introduced by vim#12557. `:substitue` commands in plugins need to take into account whether `gdefault` is set or not because that depends on the user.
FWIW, :help 'gdefault', :help 'edcompatible' and :help 'magic' are ignored in Vim9.
So, the patch could be simplified with something like this (untested):
199,203c199 < if &gdefault < silent! keepjumps keeppatterns %s/\v(.)\b\ze\1?//e < else < silent! keepjumps keeppatterns %s/\v(.)\b\ze\1?//ge < endif --- > vim9 silent! keepjumps keeppatterns :%s/\v(.)\b\ze\1?//ge
But I guess the if &gdefault test is more explicit.
Right. I guess I don't like mixing vim9 and non-vim9 code. If I'm a casual reader reading this I would actually be a little confused about the sprinkling of vim9 there and not sure what the intention is as this is relying on a somewhat obscure thing that people may not know. I think if the entire thing is in vim9, it would "just work", but I also don't particularly think it's worth it (or should) to change the whole file over to Vim9.
(Edit: on second thought, maybe converting to Vim9 isn't the end. Neovim also implemented their own man.lua anyway, and currently the man pager we are using for Vim ignores the italics from the man output)
Codecov Report
Merging #13097 (f1a4b97) into master (ffb1367) will decrease coverage by
0.02%.
Report is 2 commits behind head on master.
The diff coverage isn/a.
@@ Coverage Diff @@ ## master #13097 +/- ## ========================================== - Coverage 78.26% 78.25% -0.02% ========================================== Files 150 150 Lines 152693 152695 +2 Branches 39364 39366 +2 ========================================== - Hits 119508 119492 -16 - Misses 20935 20961 +26 + Partials 12250 12242 -8
| Flag | Coverage Δ | |
|---|---|---|
| mingw-x64-HUGE | 76.67% <ø> (-0.01%) |
⬇️ |
| mingw-x86-HUGE | 77.17% <ø> (-0.01%) |
⬇️ |
| windows | 78.25% <ø> (-0.02%) |
⬇️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
how about something similar to patch 64dea84:
diff --git a/runtime/autoload/dist/man.vim b/runtime/autoload/dist/man.vim index 315636a2e..7f7d13711 100644 --- a/runtime/autoload/dist/man.vim +++ b/runtime/autoload/dist/man.vim @@ -196,7 +196,7 @@ func dist#man#GetPage(cmdmods, ...) " Emulate piping the buffer through the "col -b" command. " Ref: https://github.com/vim/vim/issues/12301 - silent! keepjumps keeppatterns %s/\v(.)\b\ze\1?//ge + exe 'silent! keepjumps keeppatterns %s/\v(.)\b\ze\1?//e' .. (&gdefault ? '' : 'g') if unsetwidth let $MANWIDTH = ''
(untested)
ychin
deleted the
fix-man-plugin-gdefault
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters