Fix :Man plugin not working if gdefault is set#13097
Fix :Man plugin not working if gdefault is set#13097ychin wants to merge 2 commits intovim:masterfrom
Conversation
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, 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?//geBut I guess the |
|
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 |
Codecov Report
@@ 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
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) |
|
Sure. Just tested and it works as well. |
Fix the issue introduced by #12557.
:substituecommands in plugins need to take into account whethergdefaultis set or not because that depends on the user.