Files
neovim/runtime/ftplugin/man.vim
Justin M. Keyes 4fb75d61c2 man.vim: convert ftplugin to actual plugin.
- do not create leader maps
- :norm! instead of :norm
- :keepjumps during layout
- use blackhole reg to avoid polluting unnamed reg
- format buffer name as "man://foo(2)"
- simulate behavior of `man`
    - buffer-local mapping of q to quit
    - open in new tab instead of new window
    - set 'nolist'
    - set tabstop=8
2015-09-23 00:05:33 -04:00

38 lines
1.0 KiB
VimL

" Vim filetype plugin file
" Language: man
" Maintainer: SungHyun Nam <goweol@gmail.com>
" Only do this when not done yet for this buffer
if exists('b:did_ftplugin')
finish
endif
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.
setlocal iskeyword+=\.,-,(,)
" Avoid warning for editing the dummy file twice
setlocal buftype=nofile noswapfile
setlocal nomodifiable readonly bufhidden=hide nobuflisted
setlocal tabstop=8 colorcolumn=0
if !exists("g:no_plugin_maps") && !exists("g:no_man_maps")
nnoremap <silent> <buffer> <C-]> :call man#pre_get_page(v:count)<CR>
nnoremap <silent> <buffer> <C-T> :call man#pop_page()<CR>
nnoremap <silent> <nowait><buffer> q <C-W>c
if &keywordprg !=# ':Man'
nnoremap <silent> <buffer> K :call man#pre_get_page(v:count)<CR>
endif
endif
let b:undo_ftplugin = 'setlocal iskeyword<'
" vim: set sw=2: