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.vim74
1 files changed, 47 insertions, 27 deletions
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index 04ab539fb1..a45a380eb2 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -1,41 +1,61 @@
-" 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')
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
-
-setlocal iskeyword+=\.,-,(,)
-
-setlocal buftype=nofile noswapfile
-setlocal nomodifiable readonly bufhidden=hide nobuflisted tabstop=8
+let s:pager = 0
-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>
+if has('vim_starting')
+ let s:pager = 1
+ " remove all those backspaces
+ silent keeppatterns keepjumps %substitute,.\b,,ge
+ if getline(1) =~# '^\s*$'
+ silent keepjumps 1delete _
+ else
+ keepjumps 1
endif
+ " This is not perfect.See `man glDrawArraysInstanced`. Since the title is
+ " all caps it is impossible to tell what the original capitilization was.
+ execute 'file '.'man://'.tolower(matchstr(getline(1), '^\S\+'))
endif
-if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)
- setlocal foldmethod=indent foldnestmax=1 foldenable
+setlocal buftype=nofile
+setlocal noswapfile
+setlocal bufhidden=hide
+setlocal nobuflisted
+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')
+ nmap <silent> <buffer> <C-]> <Plug>(Man)
+ nmap <silent> <buffer> K <Plug>(Man)
+ if s:pager
+ nnoremap <silent> <buffer> <nowait> q :q<CR>
+ else
+ nnoremap <silent> <buffer> <nowait> q <C-W>c
+ endif
endif
-let b:undo_ftplugin = 'setlocal iskeyword<'
+if get(g:, 'ft_man_folding_enable', 0)
+ setlocal foldenable
+ setlocal foldmethod=indent
+ setlocal foldnestmax=1
+endif
+let b:undo_ftplugin = ''
" vim: set sw=2: