aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-09-21 09:08:39 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-09-21 10:17:37 +0200
commitdc256e376dda51ac1cc7a5fe44a512c8677597d5 (patch)
tree6305db6d796798fe0d29f3cc467bf8feee4049d5
parent9081cad514d27ed67f0e348e9db56eddb296cc1d (diff)
downloadrneovim-dc256e376dda51ac1cc7a5fe44a512c8677597d5.tar.gz
rneovim-dc256e376dda51ac1cc7a5fe44a512c8677597d5.tar.bz2
rneovim-dc256e376dda51ac1cc7a5fe44a512c8677597d5.zip
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?
-rw-r--r--runtime/autoload/man.vim4
1 files changed, 4 insertions, 0 deletions
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