changeset 32710:a57db996dbe3

Manpager: apply g flag conditionally to s command (#12679) Commit: https://github.com/vim/vim/commit/64dea84bb05a29117cf2708085021c535b898975 Author: Filip Gospodinov <f@gospodinov.ch> Date: Wed Aug 9 18:00:36 2023 +0200 Manpager: apply g flag conditionally to s command (https://github.com/vim/vim/issues/12679) Problem: The `s` command with `g` flag only substitutes one occurrence when `gdefault` is set. Solution: Use `g` flag conditionally.
author Christian Brabandt <cb@256bit.org>
date Wed, 09 Aug 2023 18:15:04 +0200
parents ea044451c98f
children f970e6f29e7d
files runtime/plugin/manpager.vim
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/plugin/manpager.vim
+++ b/runtime/plugin/manpager.vim
@@ -30,10 +30,10 @@ function s:ManPager()
   setlocal modifiable
 
   " Emulate 'col -b'
-  silent! keepj keepp %s/\v(.)\b\ze\1?//ge
+  exe 'silent! keepj keepp %s/\v(.)\b\ze\1?//e' .. (&gdefault ? '' : 'g')
 
   " Remove ansi sequences
-  silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//ge
+  exe 'silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//e' .. (&gdefault ? '' : 'g')
 
   " Remove empty lines above the header
   call cursor(1, 1)