2004-06-13 20:20:40 +00:00
|
|
|
" Vim filetype plugin file
|
|
|
|
" Language: man
|
2020-05-01 16:07:38 +02:00
|
|
|
" Maintainer: Jason Franklin <vim@justemail.net>
|
2020-05-07 18:56:00 +02:00
|
|
|
" Maintainer: SungHyun Nam <goweol@gmail.com>
|
2022-06-20 11:17:32 +01:00
|
|
|
" Autoload Split: Bram Moolenaar
|
2024-06-06 19:06:38 +02:00
|
|
|
" Last Change: 2024 Jun 06 (disabled the q mapping, #8210)
|
2024-07-06 16:56:02 +02:00
|
|
|
" 2024 Jul 06 (use nnoremap, #15130)
|
2024-08-23 18:34:41 +02:00
|
|
|
" 2024 Aug 23 (improve the <Plug>ManBS mapping, #15547, #15556)
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
" To make the ":Man" command available before editing a manual page, source
|
|
|
|
" this script from your startup vimrc file.
|
|
|
|
|
2022-06-20 11:17:32 +01:00
|
|
|
" If 'filetype' isn't "man", we must have been called to define ":Man" and not
|
|
|
|
" to do the filetype plugin stuff.
|
2004-06-13 20:20:40 +00:00
|
|
|
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
|
2018-07-29 15:07:52 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
let s:cpo_save = &cpo
|
|
|
|
set cpo-=C
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2018-07-29 15:07:52 +02:00
|
|
|
if &filetype == "man"
|
2022-10-03 18:04:35 +01:00
|
|
|
" Allow hyphen, plus, colon, dot, and commercial at in manual page name.
|
2023-04-22 22:40:14 +01:00
|
|
|
" Parentheses are not here but in dist#man#PreGetPage()
|
|
|
|
setlocal iskeyword=48-57,_,a-z,A-Z,-,+,:,.,@-@
|
2018-07-29 15:07:52 +02:00
|
|
|
let b:undo_ftplugin = "setlocal iskeyword<"
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
" 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
|
2018-07-29 15:07:52 +02:00
|
|
|
let b:undo_ftplugin = b:undo_ftplugin
|
|
|
|
\ . '|silent! nunmap <buffer> <LocalLeader>h'
|
2004-06-13 20:20:40 +00:00
|
|
|
endif
|
2024-08-23 18:34:41 +02:00
|
|
|
|
|
|
|
nnoremap <buffer> <silent> <Plug>ManBS :setl ma<Bar>%s/.\b//g
|
|
|
|
\ <Bar>setl noma<CR>`'
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2022-06-20 11:17:32 +01:00
|
|
|
nnoremap <buffer> <silent> <c-]> :call dist#man#PreGetPage(v:count)<CR>
|
|
|
|
nnoremap <buffer> <silent> <c-t> :call dist#man#PopPage()<CR>
|
2018-07-29 15:07:52 +02:00
|
|
|
|
|
|
|
" 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>'
|
2015-11-24 19:18:36 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)
|
|
|
|
setlocal foldmethod=indent foldnestmax=1 foldenable
|
2018-07-29 15:07:52 +02:00
|
|
|
let b:undo_ftplugin = b:undo_ftplugin
|
|
|
|
\ . '|silent! setl fdm< fdn< fen<'
|
2004-06-13 20:20:40 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
if exists(":Man") != 2
|
2022-06-20 11:17:32 +01:00
|
|
|
com -nargs=+ -complete=shellcmd Man call dist#man#GetPage(<q-mods>, <f-args>)
|
2024-07-06 16:16:40 +02:00
|
|
|
nnoremap <Leader>K :call dist#man#PreGetPage(0)<CR>
|
|
|
|
nnoremap <Plug>ManPreGetPage :call dist#man#PreGetPage(0)<CR>
|
2004-06-13 20:20:40 +00:00
|
|
|
endif
|
|
|
|
|
2018-07-29 15:07:52 +02:00
|
|
|
let &cpo = s:cpo_save
|
|
|
|
unlet s:cpo_save
|
|
|
|
|
2016-06-20 11:22:54 +02:00
|
|
|
" vim: set sw=2 ts=8 noet:
|