runtime(man): remove backslashes in man pages using Vim script (#12557)
Commit:
https://github.com/vim/vim/commit/17befac581ea67f56039db832d68963cd401fb8a
Author: lifecrisis <
j...@elitemail.org>
Date: Sun Aug 20 18:41:25 2023 +0000
runtime(man): remove backslashes in man pages using Vim script (
https://github.com/vim/vim/issues/12557)
Closes: vim/vimhttps://
github.com/vim/vim/issues/12301
Co-authored-by: Jason Franklin <
ja...@oneway.dev>
diff --git a/runtime/autoload/dist/man.vim b/runtime/autoload/dist/man.vim
index 5b8b4456d..315636a2e 100644
--- a/runtime/autoload/dist/man.vim
+++ b/runtime/autoload/dist/man.vim
@@ -1,6 +1,6 @@
" Vim filetype plugin autoload file
" Language: man
-" Maintainer: Jason Franklin <
v...@justemail.net>
+" Maintainer: Jason Franklin <
ja...@oneway.dev>
" Maintainer: SungHyun Nam <
gow...@gmail.com>
" Autoload Split: Bram Moolenaar
" Last Change: 2023 Jun 28
@@ -190,9 +190,14 @@ func dist#man#GetPage(cmdmods, ...)
endif
let env_cmd = s:env_has_u ? 'env -u MANPAGER' : 'env MANPAGER=cat'
let env_cmd .= ' GROFF_NO_SGR=1'
- let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . ' | col -b'
+ let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page)
+
silent exec "r !" . man_cmd
+ " Emulate piping the buffer through the "col -b" command.
+ " Ref:
https://github.com/vim/vim/issues/12301
+ silent! keepjumps keeppatterns %s/ (.) \ze ?//ge
+
if unsetwidth
let $MANWIDTH = ''
endif