mirror of
https://github.com/neovim/neovim.git
synced 2025-11-19 08:41:31 +00:00
- fix synopsis highlighting in other locales. Cannot always rely on the first line for the section in some locales; instead, use the file path and explicitly set b:man_sect to the actual section. - eliminate separate s:man_args function - simplify logic: do not reuse buffer content - introduce b:man_default_sects Fixes #5233 - introduce <Plug>(man_vsplit), <Plug>(man_tab) - simplify regexps
22 lines
722 B
VimL
22 lines
722 B
VimL
" Maintainer: Anmol Sethi <anmol@aubble.com>
|
|
|
|
if exists('g:loaded_man')
|
|
finish
|
|
endif
|
|
let g:loaded_man = 1
|
|
|
|
command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>)
|
|
|
|
function! s:cword() abort
|
|
return &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>')
|
|
endfunction
|
|
|
|
nnoremap <silent> <Plug>(man) :<C-U>execute 'Man ' .<SID>cword()<CR>
|
|
nnoremap <silent> <Plug>(man_vsplit) :<C-U>execute 'vertical Man '.<SID>cword()<CR>
|
|
nnoremap <silent> <Plug>(man_tab) :<C-U>execute 'tab Man ' .<SID>cword()<CR>
|
|
|
|
augroup man
|
|
autocmd!
|
|
autocmd BufReadCmd man://* call man#read_page(matchstr(expand('<amatch>'), 'man://\zs.*'))
|
|
augroup END
|