From dc256e376dda51ac1cc7a5fe44a512c8677597d5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 21 Sep 2018 09:08:39 +0200 Subject: [PATCH] man.vim: Fix very long justified lines #9023 When nroff justifies a line, it fills the line with whitespace to meet $MANWIDTH. With $MANWIDTH=9999, that of course results in nonsense (and behaves poorly with 'cursorline' option). To work around that, instead of trying to hard-justify the lines, just replace the mega-whitespace with a fixed size of 10 spaces. Perhaps N/Vim needs a "soft justify" feature? --- runtime/autoload/man.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 69bdcd30e1..8ca78f2782 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -167,6 +167,10 @@ function! s:put_page(page) abort while getline(1) =~# '^\s*$' silent keepjumps 1delete _ endwhile + " XXX: nroff justifies text by filling it with whitespace. That interacts + " badly with our use of $MANWIDTH=9999. Hack around this by using a fixed + " size for those whitespace regions. + silent! keeppatterns keepjumps %s/\s\{999,}/\=repeat(' ', 10)/g lua require("man").highlight_man_page() setlocal filetype=man endfunction