Skip to content

Conversation

@ychin
Copy link
Contributor

@ychin ychin commented Sep 16, 2023

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.
@lacygoill
Copy link

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.

@ychin
Copy link
Contributor Author

ychin commented Sep 16, 2023

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
Copy link

codecov bot commented Sep 16, 2023

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 is n/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.

see 9 files with indirect coverage changes

@chrisbra
Copy link
Member

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
Copy link
Contributor Author

ychin commented Sep 16, 2023

Sure. Just tested and it works as well.

@chrisbra chrisbra closed this in 249a208 Sep 16, 2023
@ychin ychin deleted the fix-man-plugin-gdefault branch September 27, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants