codekingpro/portable-devtools
114k
1" Vim filetype plugin file2" Language: man3" Maintainer: Jason Franklin <vim@justemail.net>4" Maintainer: SungHyun Nam <goweol@gmail.com>5" Autoload Split: Bram Moolenaar6" Last Change: 2024 Jun 06 (disabled the q mapping, #8210)7" 2024 Jul 06 (use nnoremap, #15130)8" 2024 Aug 23 (improve the <Plug>ManBS mapping, #15547, #15556)9" 2025 Mar 09 (improve :Man completion for man-db, #16843)10 11" To make the ":Man" command available before editing a manual page, source12" this script from your startup vimrc file.13 14" If 'filetype' isn't "man", we must have been called to define ":Man" and not15" to do the filetype plugin stuff.16if &filetype == "man"17 18 " Only do this when not done yet for this buffer19 if exists("b:did_ftplugin")20 finish21 endif22 let b:did_ftplugin = 123endif24 25let s:cpo_save = &cpo26set cpo-=C27 28if !exists('g:ft_man_implementation')29 if executable('mandb') > 030 let g:ft_man_implementation = 'man-db'31 else32 let g:ft_man_implementation = ''33 endif34endif35 36if &filetype == "man"37 " Allow hyphen, plus, colon, dot, and commercial at in manual page name.38 " Parentheses are not here but in dist#man#PreGetPage()39 setlocal iskeyword=48-57,_,a-z,A-Z,-,+,:,.,@-@40 let b:undo_ftplugin = "setlocal iskeyword<"41 42 " Add mappings, unless the user didn't want this.43 if !exists("no_plugin_maps") && !exists("no_man_maps")44 if !hasmapto('<Plug>ManBS')45 nmap <buffer> <LocalLeader>h <Plug>ManBS46 let b:undo_ftplugin = b:undo_ftplugin47 \ . '|silent! nunmap <buffer> <LocalLeader>h'48 endif49 50 nnoremap <buffer> <silent> <Plug>ManBS :setl ma<Bar>%s/.\b//g51 \ <Bar>setl noma<CR>`'52 53 nnoremap <buffer> <silent> <c-]> :call dist#man#PreGetPage(v:count)<CR>54 nnoremap <buffer> <silent> <c-t> :call dist#man#PopPage()<CR>55 56 " Add undo commands for the maps57 let b:undo_ftplugin = b:undo_ftplugin58 \ . '|silent! nunmap <buffer> <Plug>ManBS'59 \ . '|silent! nunmap <buffer> <c-]>'60 \ . '|silent! nunmap <buffer> <c-t>'61 endif62 63 if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)64 setlocal foldmethod=indent foldnestmax=1 foldenable65 let b:undo_ftplugin = b:undo_ftplugin66 \ . '|silent! setl fdm< fdn< fen<'67 endif68 69endif70 71if exists(":Man") != 272 if g:ft_man_implementation ==# 'man-db'73 com -nargs=+ -complete=customlist,dist#man#ManDbComplete Man call dist#man#GetPage(<q-mods>, <f-args>)74 else75 com -nargs=+ -complete=shellcmd Man call dist#man#GetPage(<q-mods>, <f-args>)76 endif77 nnoremap <Leader>K :call dist#man#PreGetPage(0)<CR>78 nnoremap <Plug>ManPreGetPage :call dist#man#PreGetPage(0)<CR>79endif80 81if exists(":ManReload") != 282 com ManReload call dist#man#Reload()83endif84 85let &cpo = s:cpo_save86unlet s:cpo_save87 88" vim: set sw=2 ts=8 noet:89 