Mercurial > vim
comparison runtime/ftplugin/man.vim @ 14421:2f7e67dd088c
Update runtime files.
commit https://github.com/vim/vim/commit/91f84f6e11cd879d43d651c0903d85bff95f0716
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 29 15:07:52 2018 +0200
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 Jul 2018 15:15:06 +0200 |
parents | e751b5c9dff3 |
children | 7cfe57329284 |
comparison
equal
deleted
inserted
replaced
14420:9114cf8a3e07 | 14421:2f7e67dd088c |
---|---|
1 " Vim filetype plugin file | 1 " Vim filetype plugin file |
2 " Language: man | 2 " Language: man |
3 " Maintainer: SungHyun Nam <goweol@gmail.com> | 3 " Maintainer: SungHyun Nam <goweol@gmail.com> |
4 " Last Change: 2018 May 2 | 4 " Last Change: 2018 Jul 25 |
5 | 5 |
6 " To make the ":Man" command available before editing a manual page, source | 6 " To make the ":Man" command available before editing a manual page, source |
7 " this script from your startup vimrc file. | 7 " this script from your startup vimrc file. |
8 | 8 |
9 " If 'filetype' isn't "man", we must have been called to only define ":Man". | 9 " If 'filetype' isn't "man", we must have been called to only define ":Man". |
12 " Only do this when not done yet for this buffer | 12 " Only do this when not done yet for this buffer |
13 if exists("b:did_ftplugin") | 13 if exists("b:did_ftplugin") |
14 finish | 14 finish |
15 endif | 15 endif |
16 let b:did_ftplugin = 1 | 16 let b:did_ftplugin = 1 |
17 | 17 endif |
18 | |
19 let s:cpo_save = &cpo | |
20 set cpo-=C | |
21 | |
22 if &filetype == "man" | |
18 " allow dot and dash in manual page name. | 23 " allow dot and dash in manual page name. |
19 setlocal iskeyword+=\.,- | 24 setlocal iskeyword+=\.,- |
25 let b:undo_ftplugin = "setlocal iskeyword<" | |
20 | 26 |
21 " Add mappings, unless the user didn't want this. | 27 " Add mappings, unless the user didn't want this. |
22 if !exists("no_plugin_maps") && !exists("no_man_maps") | 28 if !exists("no_plugin_maps") && !exists("no_man_maps") |
23 if !hasmapto('<Plug>ManBS') | 29 if !hasmapto('<Plug>ManBS') |
24 nmap <buffer> <LocalLeader>h <Plug>ManBS | 30 nmap <buffer> <LocalLeader>h <Plug>ManBS |
31 let b:undo_ftplugin = b:undo_ftplugin | |
32 \ . '|silent! nunmap <buffer> <LocalLeader>h' | |
25 endif | 33 endif |
26 nnoremap <buffer> <Plug>ManBS :%s/.\b//g<CR>:setl nomod<CR>'' | 34 nnoremap <buffer> <Plug>ManBS :%s/.\b//g<CR>:setl nomod<CR>'' |
27 | 35 |
28 nnoremap <buffer> <c-]> :call <SID>PreGetPage(v:count)<CR> | 36 nnoremap <buffer> <c-]> :call <SID>PreGetPage(v:count)<CR> |
29 nnoremap <buffer> <c-t> :call <SID>PopPage()<CR> | 37 nnoremap <buffer> <c-t> :call <SID>PopPage()<CR> |
30 nnoremap <buffer> <silent> q :q<CR> | 38 nnoremap <buffer> <silent> q :q<CR> |
39 | |
40 " Add undo commands for the maps | |
41 let b:undo_ftplugin = b:undo_ftplugin | |
42 \ . '|silent! nunmap <buffer> <Plug>ManBS' | |
43 \ . '|silent! nunmap <buffer> <c-]>' | |
44 \ . '|silent! nunmap <buffer> <c-t>' | |
45 \ . '|silent! nunmap <buffer> q' | |
31 endif | 46 endif |
32 | 47 |
33 if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) | 48 if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) |
34 setlocal foldmethod=indent foldnestmax=1 foldenable | 49 setlocal foldmethod=indent foldnestmax=1 foldenable |
35 endif | 50 let b:undo_ftplugin = b:undo_ftplugin |
36 | 51 \ . '|silent! setl fdm< fdn< fen<' |
37 let b:undo_ftplugin = "setlocal iskeyword<" | 52 endif |
38 | 53 |
39 endif | 54 endif |
40 | 55 |
41 if exists(":Man") != 2 | 56 if exists(":Man") != 2 |
42 com -nargs=+ -complete=shellcmd Man call s:GetPage(<f-args>) | 57 com -nargs=+ -complete=shellcmd Man call s:GetPage(<q-mods>, <f-args>) |
43 nmap <Leader>K :call <SID>PreGetPage(0)<CR> | 58 nmap <Leader>K :call <SID>PreGetPage(0)<CR> |
44 nmap <Plug>ManPreGetPage :call <SID>PreGetPage(0)<CR> | 59 nmap <Plug>ManPreGetPage :call <SID>PreGetPage(0)<CR> |
45 endif | 60 endif |
46 | 61 |
47 " Define functions only once. | 62 " Define functions only once. |
98 endif | 113 endif |
99 endif | 114 endif |
100 return 1 | 115 return 1 |
101 endfunc | 116 endfunc |
102 | 117 |
103 func <SID>GetPage(...) | 118 func <SID>GetPage(cmdmods, ...) |
104 if a:0 >= 2 | 119 if a:0 >= 2 |
105 let sect = a:1 | 120 let sect = a:1 |
106 let page = a:2 | 121 let page = a:2 |
107 elseif a:0 >= 1 | 122 elseif a:0 >= 1 |
108 let sect = "" | 123 let sect = "" |
152 tabnew | 167 tabnew |
153 else | 168 else |
154 new | 169 new |
155 endif | 170 endif |
156 else | 171 else |
157 new | 172 if a:cmdmods != '' |
173 exe a:cmdmods . ' new' | |
174 else | |
175 new | |
176 endif | |
158 endif | 177 endif |
159 setl nonu fdc=0 | 178 setl nonu fdc=0 |
160 endif | 179 endif |
161 endif | 180 endif |
162 silent exec "edit $HOME/".page.".".sect."~" | 181 silent exec "edit $HOME/".page.".".sect."~" |
216 endif | 235 endif |
217 endfunc | 236 endfunc |
218 | 237 |
219 endif | 238 endif |
220 | 239 |
240 let &cpo = s:cpo_save | |
241 unlet s:cpo_save | |
242 | |
221 " vim: set sw=2 ts=8 noet: | 243 " vim: set sw=2 ts=8 noet: |