aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/man.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/autoload/man.vim')
-rw-r--r--runtime/autoload/man.vim9
1 files changed, 4 insertions, 5 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index af5c4dbd60..00ce1c77d7 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -148,7 +148,8 @@ function! s:get_page(path) abort
let manwidth = empty($MANWIDTH) ? winwidth(0) : $MANWIDTH
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085
- let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'man']
+ " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
+ let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'MAN_KEEP_FORMATTING=1', 'man']
return s:system(cmd + (s:localfile_arg ? ['-l', a:path] : [a:path]))
endfunction
@@ -157,11 +158,10 @@ function! s:put_page(page) abort
setlocal noreadonly
silent keepjumps %delete _
silent put =a:page
- " Remove all backspaced/escape characters.
- execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g')
while getline(1) =~# '^\s*$'
silent keepjumps 1delete _
endwhile
+ lua require("man").highlight_man_page()
setlocal filetype=man
endfunction
@@ -370,13 +370,12 @@ function! s:format_candidate(path, psect) abort
endfunction
function! man#init_pager() abort
- " Remove all backspaced/escape characters.
- execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g')
if getline(1) =~# '^\s*$'
silent keepjumps 1delete _
else
keepjumps 1
endif
+ lua require("man").highlight_man_page()
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
" all caps it is impossible to tell what the original capitilization was.
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')