Manpager: apply g flag conditionally to s command (#12679)
Commit:
https://github.com/vim/vim/commit/64dea84bb05a29117cf2708085021c535b898975
Author: Filip Gospodinov <[email protected]>
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.
diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim
index 1738dc943..076aca5f8 100644
--- 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)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1qTlpw-00Bt37-2Z%40256bit.org.