Skip to content

Commit

Permalink
Manpager: apply g flag conditionally to s command (#12679)
Browse files Browse the repository at this point in the history
Problem: The `s` command with `g` flag only substitutes
         one occurrence when `gdefault` is set.
Solution: Use `g` flag conditionally.
  • Loading branch information
toxeus committed Aug 9, 2023
1 parent bd76c89 commit 64dea84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/plugin/manpager.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 64dea84

Please sign in to comment.