From 029f72b1a93430b24b88eb3a72c6114d9f149737 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 22:09:20 +0200 Subject: Adding upstream version 2:9.1.0016. Signed-off-by: Daniel Baumann --- runtime/ftplugin/man.vim | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 runtime/ftplugin/man.vim (limited to 'runtime/ftplugin/man.vim') diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim new file mode 100644 index 0000000..a2c33bc --- /dev/null +++ b/runtime/ftplugin/man.vim @@ -0,0 +1,69 @@ +" Vim filetype plugin file +" Language: man +" Maintainer: Jason Franklin +" Maintainer: SungHyun Nam +" Autoload Split: Bram Moolenaar +" Last Change: 2023 Mar 21 + +" To make the ":Man" command available before editing a manual page, source +" this script from your startup vimrc file. + +" If 'filetype' isn't "man", we must have been called to define ":Man" and not +" to do the filetype plugin stuff. +if &filetype == "man" + + " Only do this when not done yet for this buffer + if exists("b:did_ftplugin") + finish + endif + let b:did_ftplugin = 1 +endif + +let s:cpo_save = &cpo +set cpo-=C + +if &filetype == "man" + " Allow hyphen, plus, colon, dot, and commercial at in manual page name. + " Parentheses are not here but in dist#man#PreGetPage() + setlocal iskeyword=48-57,_,a-z,A-Z,-,+,:,.,@-@ + let b:undo_ftplugin = "setlocal iskeyword<" + + " Add mappings, unless the user didn't want this. + if !exists("no_plugin_maps") && !exists("no_man_maps") + if !hasmapto('ManBS') + nmap h ManBS + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! nunmap h' + endif + nnoremap ManBS :%s/.\b//g:setl nomod'' + + nnoremap :call dist#man#PreGetPage(v:count) + nnoremap :call dist#man#PopPage() + nnoremap q :q + + " Add undo commands for the maps + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! nunmap ManBS' + \ . '|silent! nunmap ' + \ . '|silent! nunmap ' + \ . '|silent! nunmap q' + endif + + if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) + setlocal foldmethod=indent foldnestmax=1 foldenable + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! setl fdm< fdn< fen<' + endif + +endif + +if exists(":Man") != 2 + com -nargs=+ -complete=shellcmd Man call dist#man#GetPage(, ) + nmap K :call dist#man#PreGetPage(0) + nmap ManPreGetPage :call dist#man#PreGetPage(0) +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: set sw=2 ts=8 noet: -- cgit v1.2.3