man.vim 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. " Maintainer: Anmol Sethi <anmol@aubble.com>
  2. " Previous Maintainer: SungHyun Nam <goweol@gmail.com>
  3. if exists('b:did_ftplugin') || &filetype !=# 'man'
  4. finish
  5. endif
  6. let b:did_ftplugin = 1
  7. let s:pager = get(s:, 'pager', 0) || !exists('b:man_sect')
  8. if s:pager
  9. call man#init_pager()
  10. endif
  11. setlocal buftype=nofile
  12. setlocal noswapfile
  13. setlocal bufhidden=hide
  14. setlocal nomodified
  15. setlocal readonly
  16. setlocal nomodifiable
  17. setlocal noexpandtab
  18. setlocal tabstop=8
  19. setlocal softtabstop=8
  20. setlocal shiftwidth=8
  21. setlocal wrap
  22. setlocal breakindent
  23. setlocal nonumber
  24. setlocal norelativenumber
  25. setlocal foldcolumn=0
  26. setlocal colorcolumn=0
  27. setlocal nolist
  28. setlocal nofoldenable
  29. if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
  30. nnoremap <silent> <buffer> j gj
  31. nnoremap <silent> <buffer> k gk
  32. nnoremap <silent> <buffer> gO :call man#show_toc()<CR>
  33. nnoremap <silent> <buffer> <C-]> :Man<CR>
  34. nnoremap <silent> <buffer> K :Man<CR>
  35. nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
  36. if 1 == bufnr('%') || s:pager
  37. nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR>
  38. else
  39. nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
  40. endif
  41. endif
  42. if get(g:, 'ft_man_folding_enable', 0)
  43. setlocal foldenable
  44. setlocal foldmethod=indent
  45. setlocal foldnestmax=1
  46. endif
  47. let b:undo_ftplugin = ''
  48. " vim: set sw=2: