man.vim 1.3 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. setlocal colorcolumn=0 nolist
  10. " Parentheses and '-' for references like `git-ls-files(1)`; '@' for systemd
  11. " pages; ':' for Perl and C++ pages. Here, I intentionally omit the locale
  12. " specific characters matched by `@`.
  13. setlocal iskeyword=@-@,:,a-z,A-Z,48-57,_,.,-,(,)
  14. " man page content is likely preformatted for the terminal width, so
  15. " narrowing display by any additional columns leads to Embarrassing Line Wrap
  16. setlocal nonumber norelativenumber foldcolumn=0 signcolumn=auto
  17. setlocal tagfunc=v:lua.require'man'.goto_tag
  18. if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
  19. nnoremap <silent> <buffer> j gj
  20. nnoremap <silent> <buffer> k gk
  21. nnoremap <silent> <buffer> gO :lua require'man'.show_toc()<CR>
  22. nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
  23. nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
  24. endif
  25. if get(g:, 'ft_man_folding_enable', 0)
  26. setlocal foldenable
  27. setlocal foldmethod=indent
  28. setlocal foldnestmax=1
  29. else
  30. setlocal nofoldenable
  31. endif
  32. let b:undo_ftplugin = ''
  33. " vim: set sw=2: