[vim]update man ftplugin
This commit is contained in:
parent
299de4078f
commit
063c081b25
@ -1,7 +1,7 @@
|
|||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: man
|
" Language: man
|
||||||
" Maintainer: Nam SungHyun <namsh@kldp.org>
|
" Maintainer: SungHyun Nam <goweol@gmail.com>
|
||||||
" Last Change: 2007 Nov 30
|
" Last Change: 2014 Dec 29
|
||||||
|
|
||||||
" To make the ":Man" command available before editing a manual page, source
|
" To make the ":Man" command available before editing a manual page, source
|
||||||
" this script from your startup vimrc file.
|
" this script from your startup vimrc file.
|
||||||
@ -15,6 +15,12 @@ if &filetype == "man"
|
|||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Ensure Vim is not recursively invoked (man-db does this)
|
||||||
|
" when doing ctrl-[ on a man page reference.
|
||||||
|
if exists("$MANPAGER")
|
||||||
|
let $MANPAGER = ""
|
||||||
|
endif
|
||||||
|
|
||||||
" allow dot and dash in manual page name.
|
" allow dot and dash in manual page name.
|
||||||
setlocal iskeyword+=\.,-
|
setlocal iskeyword+=\.,-
|
||||||
|
|
||||||
@ -29,6 +35,8 @@ if &filetype == "man"
|
|||||||
nnoremap <buffer> <c-t> :call <SID>PopPage()<CR>
|
nnoremap <buffer> <c-t> :call <SID>PopPage()<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setlocal iskeyword<"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists(":Man") != 2
|
if exists(":Man") != 2
|
||||||
@ -55,7 +63,9 @@ endtry
|
|||||||
func <SID>PreGetPage(cnt)
|
func <SID>PreGetPage(cnt)
|
||||||
if a:cnt == 0
|
if a:cnt == 0
|
||||||
let old_isk = &iskeyword
|
let old_isk = &iskeyword
|
||||||
setl iskeyword+=(,)
|
if &ft == 'man'
|
||||||
|
setl iskeyword+=(,)
|
||||||
|
endif
|
||||||
let str = expand("<cword>")
|
let str = expand("<cword>")
|
||||||
let &l:iskeyword = old_isk
|
let &l:iskeyword = old_isk
|
||||||
let page = substitute(str, '(*\(\k\+\).*', '\1', '')
|
let page = substitute(str, '(*\(\k\+\).*', '\1', '')
|
||||||
@ -143,16 +153,16 @@ func <SID>GetPage(...)
|
|||||||
" Avoid warning for editing the dummy file twice
|
" Avoid warning for editing the dummy file twice
|
||||||
setl buftype=nofile noswapfile
|
setl buftype=nofile noswapfile
|
||||||
|
|
||||||
setl ma
|
setl ma nonu nornu nofen
|
||||||
silent exec "norm 1GdG"
|
silent exec "norm 1GdG"
|
||||||
let $MANWIDTH = winwidth(0)
|
let $MANWIDTH = winwidth(0)
|
||||||
silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b"
|
silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b"
|
||||||
" Remove blank lines from top and bottom.
|
" Remove blank lines from top and bottom.
|
||||||
while getline(1) =~ '^\s*$'
|
while getline(1) =~ '^\s*$'
|
||||||
silent norm ggdd
|
silent keepj norm ggdd
|
||||||
endwhile
|
endwhile
|
||||||
while getline('$') =~ '^\s*$'
|
while getline('$') =~ '^\s*$'
|
||||||
silent norm Gdd
|
silent keepj norm Gdd
|
||||||
endwhile
|
endwhile
|
||||||
1
|
1
|
||||||
setl ft=man nomod
|
setl ft=man nomod
|
||||||
|
Loading…
Reference in New Issue
Block a user