robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

xudyang1feat(man.vim): "q" always closes window #30819ea5b748f24

master
1.3 KiB41 linesraw
1" Maintainer:          Anmol Sethi <hi@nhooyr.io>
2" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
3
4if exists('b:did_ftplugin') || &filetype !=# 'man'
5  finish
6endif
7let b:did_ftplugin = 1
8
9setlocal noexpandtab tabstop=8 softtabstop=8 shiftwidth=8
10setlocal wrap breakindent linebreak
11setlocal colorcolumn=0 nolist
12
13" Parentheses and '-' for references like `git-ls-files(1)`; '@' for systemd
14" pages; ':' for Perl and C++ pages.  Here, I intentionally omit the locale
15" specific characters matched by `@`.
16setlocal iskeyword=@-@,:,a-z,A-Z,48-57,_,.,-,(,)
17
18" man page content is likely preformatted for the terminal width, so
19" narrowing display by any additional columns leads to Embarrassing Line Wrap
20setlocal nonumber norelativenumber foldcolumn=0 signcolumn=auto
21
22setlocal tagfunc=v:lua.require'man'.goto_tag
23
24if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
25  nnoremap <silent> <buffer> j             gj
26  nnoremap <silent> <buffer> k             gk
27  nnoremap <silent> <buffer> gO            :lua require'man'.show_toc()<CR>
28  nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
29  nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
30endif
31
32if get(g:, 'ft_man_folding_enable', 0)
33  setlocal foldenable
34  setlocal foldmethod=indent
35  setlocal foldnestmax=1
36else
37  setlocal nofoldenable
38endif
39
40let b:undo_ftplugin = ''
41" vim: set sw=2: