summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-09-06 23:20:39 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-09-06 23:20:39 +0200
commit125bc23a1b9a4d2568c800be5e1a7ba0452aafe5 (patch)
treed6d587c4b77bf6229e78024473494946df8c9686 /.config
parent550630d8d3fb0d1c2b73dcd9690f0296eae01e30 (diff)
nvim: Add configuration for yacc/bison
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/after/ftplugin/yacc.vim15
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>