aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin/man.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ftplugin/man.vim')
-rw-r--r--runtime/ftplugin/man.vim66
1 files changed, 38 insertions, 28 deletions
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index 04ab539fb1..5d83886f56 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -1,41 +1,51 @@
-" Vim filetype plugin file
-" Language: man
-" Maintainer: SungHyun Nam <goweol@gmail.com>
+" Maintainer: Anmol Sethi <anmol@aubble.com>
+" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
-if has('vim_starting') && &filetype !=# 'man'
- finish
-endif
-
-" Only do this when not done yet for this buffer
-if exists('b:did_ftplugin')
+if exists('b:did_ftplugin') || &filetype !=# 'man'
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
+let s:pager = !exists('b:man_sect')
-setlocal iskeyword+=\.,-,(,)
-
-setlocal buftype=nofile noswapfile
-setlocal nomodifiable readonly bufhidden=hide nobuflisted tabstop=8
+if s:pager
+ call man#init_pager()
+endif
-if !exists("g:no_plugin_maps") && !exists("g:no_man_maps")
- nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count, expand('<cword>'))<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#get_page(v:count, expand('<cword>'))<CR>
+setlocal buftype=nofile
+setlocal noswapfile
+setlocal bufhidden=hide
+setlocal nomodified
+setlocal readonly
+setlocal nomodifiable
+setlocal noexpandtab
+setlocal tabstop=8
+setlocal softtabstop=8
+setlocal shiftwidth=8
+
+setlocal nonumber
+setlocal norelativenumber
+setlocal foldcolumn=0
+setlocal colorcolumn=0
+setlocal nolist
+setlocal nofoldenable
+
+if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
+ nnoremap <silent> <buffer> <C-]> :Man<CR>
+ nnoremap <silent> <buffer> K :Man<CR>
+ nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
+ if s:pager
+ nnoremap <silent> <buffer> <nowait> q :q<CR>
+ else
+ nnoremap <silent> <buffer> <nowait> q <C-W>c
endif
endif
-if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)
- setlocal foldmethod=indent foldnestmax=1 foldenable
+if get(g:, 'ft_man_folding_enable', 0)
+ setlocal foldenable
+ setlocal foldmethod=indent
+ setlocal foldnestmax=1
endif
-let b:undo_ftplugin = 'setlocal iskeyword<'
-
+let b:undo_ftplugin = ''
" vim: set sw=2: