0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

Manpager: apply g flag conditionally to s command (#12679)

Problem: The `s` command with `g` flag only substitutes
         one occurrence when `gdefault` is set.
Solution: Use `g` flag conditionally.
This commit is contained in:
Filip Gospodinov 2023-08-09 18:00:36 +02:00 committed by GitHub
parent bd76c89e31
commit 64dea84bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)