Skip to content
Yunpeng Luo edited this page Aug 20, 2019 · 1 revision

Plugin:

lambdalisue/vim-manpager

vim function:

function! te#utils#find_mannel() abort
    let l:man_cmd=':Man'
    if !exists(l:man_cmd)
        call te#utils#EchoWarning('You must install lambdalisue/vim-manpager first!')
        return -1
    endif
    let l:cur_word=expand('<cword>')
    let l:ret = te#utils#GetError(l:man_cmd.' 3 '.l:cur_word,'\cno \(manual\|entry\).*')
    "make sure index valid
    if l:ret != 0
        let l:ret = te#utils#GetError(l:man_cmd.' 2 '.l:cur_word,'\cno \(manual\|entry\).*')
        if l:ret != 0
            execute 'silent! help '.l:cur_word
        endif
    endif
endfunction

keymapping:

nnoremap <buffer> <silent> K :call te#utils#find_mannel()<cr>

shell config:

export MANPAGER="vim -c MANPAGER -"
Clone this wiki locally