diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:44:22 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:44:22 +0300 |
| commit | 934382c8a1ce738589dee9ee0f14e1cec812770e (patch) | |
| tree | f13715762efd06518f8aec3a2bf39ac8a615987f /uvim/runtime/ftplugin/man.vim | |
| parent | 0b24459ac12b6cf9fd5a401d647796ca254a8fa8 (diff) | |
| parent | 7088926316d8d4a7572a242d0765e99adfc8b083 (diff) | |
| download | Project-Tick-934382c8a1ce738589dee9ee0f14e1cec812770e.tar.gz Project-Tick-934382c8a1ce738589dee9ee0f14e1cec812770e.zip | |
Add 'uvim/' from commit '7088926316d8d4a7572a242d0765e99adfc8b083'
git-subtree-dir: uvim
git-subtree-mainline: 0b24459ac12b6cf9fd5a401d647796ca254a8fa8
git-subtree-split: 7088926316d8d4a7572a242d0765e99adfc8b083
Diffstat (limited to 'uvim/runtime/ftplugin/man.vim')
| -rw-r--r-- | uvim/runtime/ftplugin/man.vim | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/uvim/runtime/ftplugin/man.vim b/uvim/runtime/ftplugin/man.vim new file mode 100644 index 0000000000..3edbb27e78 --- /dev/null +++ b/uvim/runtime/ftplugin/man.vim @@ -0,0 +1,88 @@ +" Vim filetype plugin file +" Language: man +" Maintainer: Jason Franklin <vim@justemail.net> +" Maintainer: SungHyun Nam <goweol@gmail.com> +" Autoload Split: Bram Moolenaar +" Last Change: 2024 Jun 06 (disabled the q mapping, #8210) +" 2024 Jul 06 (use nnoremap, #15130) +" 2024 Aug 23 (improve the <Plug>ManBS mapping, #15547, #15556) +" 2025 Mar 09 (improve :Man completion for man-db, #16843) + +" 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 !exists('g:ft_man_implementation') + if executable('mandb') > 0 + let g:ft_man_implementation = 'man-db' + else + let g:ft_man_implementation = '' + endif +endif + +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('<Plug>ManBS') + nmap <buffer> <LocalLeader>h <Plug>ManBS + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! nunmap <buffer> <LocalLeader>h' + endif + + nnoremap <buffer> <silent> <Plug>ManBS :setl ma<Bar>%s/.\b//g + \ <Bar>setl noma<CR>`' + + nnoremap <buffer> <silent> <c-]> :call dist#man#PreGetPage(v:count)<CR> + nnoremap <buffer> <silent> <c-t> :call dist#man#PopPage()<CR> + + " Add undo commands for the maps + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! nunmap <buffer> <Plug>ManBS' + \ . '|silent! nunmap <buffer> <c-]>' + \ . '|silent! nunmap <buffer> <c-t>' + 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 + if g:ft_man_implementation ==# 'man-db' + com -nargs=+ -complete=customlist,dist#man#ManDbComplete Man call dist#man#GetPage(<q-mods>, <f-args>) + else + com -nargs=+ -complete=shellcmd Man call dist#man#GetPage(<q-mods>, <f-args>) + endif + nnoremap <Leader>K :call dist#man#PreGetPage(0)<CR> + nnoremap <Plug>ManPreGetPage :call dist#man#PreGetPage(0)<CR> +endif + +if exists(":ManReload") != 2 + com ManReload call dist#man#Reload() +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: set sw=2 ts=8 noet: |
