Greetings:

The ":Man" command uses "cat" as the pager.  This can result in troff
errors showing up in the man page buffer.  On Debian-based systems, you
can see this with the following:

1. vim
2. :vsplit
3. * set width of window to ~70 cells
4. Open one of these pages...
   man keytool
   man nm-settings
   man readelf

You can see that several errors show up (screenshot attached).

Since these don't do the user any good, and the output is, usually still
legible, we can silence them.

This patch will silence these errors by sending them to /dev/null:


diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index f627035eb..b5de1d60a 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language:    man
 " Maintainer:  SungHyun Nam <[email protected]>
-" Last Change:         2020 Apr 13
+" Last Change:         2020 Apr 23

 " To make the ":Man" command available before editing a manual page, source
 " this script from your startup vimrc file.
@@ -205,11 +205,11 @@ func <SID>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'
-  silent exec "r !" . man_cmd
+  let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . '
2>/dev/null | col -b'
+  silent exec 'r !' . man_cmd

   if unsetwidth
-    let $MANWIDTH = ''
+    unlet $MANWIDTH
   endif
   " Remove blank lines from top and bottom.
   while line('$') > 1 && getline(1) =~ '^\s*$'


-- 
Jason Franklin

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/1e7264f0-13f8-a508-6e0c-522ecd1fe8de%40quoininc.com.

Raspunde prin e-mail lui