summaryrefslogtreecommitdiff
path: root/.config/nvim/after/ftplugin/c.vim
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-18 15:23:47 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-18 15:23:47 +0200
commit3b209dc0f967e469207beea7d6478ebe1e075c76 (patch)
treed082d529b394411ec97124ee0b34baa05585dd47 /.config/nvim/after/ftplugin/c.vim
parent7ec58aa28b5ddbfd88270710e3b6ae5b094d4424 (diff)
nvim: Prefer *.vim to *.lua
Diffstat (limited to '.config/nvim/after/ftplugin/c.vim')
-rw-r--r--.config/nvim/after/ftplugin/c.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/c.vim b/.config/nvim/after/ftplugin/c.vim
new file mode 100644
index 0000000..40ecaf8
--- /dev/null
+++ b/.config/nvim/after/ftplugin/c.vim
@@ -0,0 +1,16 @@
+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
+
+xnoremap <buffer> <silent> <LocalLeader>q <Cmd>!clang-format -style=file<CR>
+nnoremap <buffer> <silent> K :call <SID>ManpageAtPoint()<CR>