summaryrefslogtreecommitdiff
path: root/.config/nvim/after/ftplugin/c.lua
blob: 2c378f4fa66ab328dce4f6d9dc5ee2ffd2e8fd30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
vim.bo.commentstring = '/* %s */'

vim.keymap.set('v', '<localleader>=', ":'<'>!clang-format -style=file -<CR>", {
	desc = 'Format the current selection with Clang Format',
})

vim.keymap.set('n', 'K', function()
	local w = vim.fn.expand('<cword>')
	local proc = vim.system({'man', w}):wait()
	if proc.code == 16 then
		print('No manual for ‘' .. w .. '’ found')
		return
	elseif proc.code ~= 0 then
		print('An error occured')
		return
	end
	vim.cmd [[
		execute "silent !man -Tpdf '" . expand('<cword>') . "' | zathura - &"
	]]
end, {
	buffer = 0,
	desc = 'View the manual page for the word under the cursor',
})