To: vim_dev@googlegroups.com Subject: Patch 7.4.1804 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1804 Problem: Can't use Vim as MANPAGER. Solution: Add manpager.vim. (Enno Nagel, closes #491) Files: runtime/doc/filetype.txt, runtime/plugin/manpager.vim *** ../vim-7.4.1803/runtime/doc/filetype.txt 2013-08-10 13:24:53.000000000 +0200 --- runtime/doc/filetype.txt 2016-04-30 14:10:13.212192595 +0200 *************** *** 550,556 **** to the end of the file in Normal mode. This means "> " is inserted in each line. ! MAN *ft-man-plugin* *:Man* Displays a manual page in a nice way. Also see the user manual |find-manpage|. --- 552,558 ---- to the end of the file in Normal mode. This means "> " is inserted in each line. ! MAN *ft-man-plugin* *:Man* *man.vim* Displays a manual page in a nice way. Also see the user manual |find-manpage|. *************** *** 575,581 **** --- 577,625 ---- Local mappings: CTRL-] Jump to the manual page for the word under the cursor. CTRL-T Jump back to the previous manual page. + q Same as ":quit" + To enable folding use this: > + let g:ft_man_folding_enable = 1 + If you do not like the default folding, use an autocommand to add your desired + folding style instead. For example: > + autocmd FileType man setlocal foldmethod=indent foldenable + + + MANPAGER *manpager.vim* + + The :Man command allows you to turn Vim into a manpager (that syntax highlights + manpages and follows linked manpages on hitting CTRL-]). + + Works on: + + - Linux + - Mac OS + - FreeBSD + - Cygwin + - Win 10 under Bash + + Untested: + + - Amiga OS + - BeOS + - OS/2 + + For bash,zsh,ksh or dash by adding to the config file (.bashrc,.zshrc, ...) + + export MANPAGER="env MAN_PN=1 vim -M +MANPAGER -" + + For (t)csh by adding to the config file + + setenv MANPAGER "env MAN_PN=1 vim -M +MANPAGER -" + + For fish by adding to the config file + + set -x MANPAGER "env MAN_PN=1 vim -M +MANPAGER -" + + If man sets the $MAN_PN environment variable, like man-db, the most common + implementation on Linux and Mac OS, then the "env MAN_PN=1 " part above is + superfluous. PDF *ft-pdf-plugin* *** ../vim-7.4.1803/runtime/plugin/manpager.vim 2016-04-30 14:14:33.413173165 +0200 --- runtime/plugin/manpager.vim 2016-04-30 14:11:14.315483238 +0200 *************** *** 0 **** --- 1,29 ---- + " Vim plugin for using Vim as manpager. + " Maintainer: Enno Nagel + " Last Change: 2016 Apr 30 + + " $MAN_PN is supposed to be set by MANPAGER, see ":help manpager.vim". + if empty($MAN_PN) + finish + endif + + command! -nargs=0 MANPAGER call s:MANPAGER() | delcommand MANPAGER + + function! s:MANPAGER() + let page_pattern = '\v\w+%([-_.]\w+)*' + let sec_pattern = '\v\w+%(\+\w+)*' + let pagesec_pattern = '\v(' . page_pattern . ')\((' . sec_pattern . ')\)' + + if $MAN_PN is '1' + let manpage = matchstr( getline(1), '^' . pagesec_pattern ) + else + let manpage = expand('$MAN_PN') + endif + + let page_sec = matchlist( manpage, '^' . pagesec_pattern . '$') + + bwipe! + + setlocal filetype=man + exe 'Man' page_sec[3] page_sec[1] + endfunction *** ../vim-7.4.1803/src/version.c 2016-04-30 13:26:10.266720263 +0200 --- src/version.c 2016-04-30 14:12:15.130777409 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1804, /**/ -- ARTHUR: No, hang on! Just answer the five questions ... GALAHAD: Three questions ... ARTHUR: Three questions ... And we shall watch ... and pray. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///