diff options
Diffstat (limited to '.config/nvim/after')
-rw-r--r-- | .config/nvim/after/ftplugin/yacc.vim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/yacc.vim b/.config/nvim/after/ftplugin/yacc.vim new file mode 100644 index 0000000..151daa8 --- /dev/null +++ b/.config/nvim/after/ftplugin/yacc.vim @@ -0,0 +1,15 @@ +setlocal commentstring=//\ %s + +function! s:ManpageAtPoint() + let l:w = expand('<cword>') + call system(['env', 'MANSECT=3,2,3p', 'man', l:w]) + if v:shell_error == 0 + execute "silent !MANSECT=3,2,3p man -Tpdf '" . l:w . "' | zathura - &" + elseif v:shell_error == 16 + echomsg 'No manual for ‘' . l:w . '’ found' + else + echomsg 'An error occured running ‘man’' + endif +endfunction + +nnoremap <buffer> <silent> K :call <SID>ManpageAtPoint()<CR> |