man.vim 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. " Maintainer: Anmol Sethi <hi@nhooyr.io>
  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. setlocal noexpandtab tabstop=8 softtabstop=8 shiftwidth=8
  8. setlocal wrap breakindent linebreak
  9. " Parentheses and '-' for references like `git-ls-files(1)`; '@' for systemd
  10. " pages; ':' for Perl and C++ pages. Here, I intentionally omit the locale
  11. " specific characters matched by `@`.
  12. setlocal iskeyword=@-@,:,a-z,A-Z,48-57,_,.,-,(,)
  13. setlocal nonumber norelativenumber
  14. setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable
  15. setlocal tagfunc=v:lua.require'man'.goto_tag
  16. if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
  17. nnoremap <silent> <buffer> j gj
  18. nnoremap <silent> <buffer> k gk
  19. nnoremap <silent> <buffer> gO :lua require'man'.show_toc()<CR>
  20. nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
  21. if get(g:, 'pager')
  22. nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
  23. else
  24. nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
  25. endif
  26. endif
  27. if get(g:, 'ft_man_folding_enable', 0)
  28. setlocal foldenable
  29. setlocal foldmethod=indent
  30. setlocal foldnestmax=1
  31. endif
  32. let b:undo_ftplugin = ''
  33. " vim: set sw=2: