summaryrefslogtreecommitdiff
path: root/.config/nvim/after/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/after/ftplugin')
-rw-r--r--.config/nvim/after/ftplugin/c.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua
index 6058e31..2c378f4 100644
--- a/.config/nvim/after/ftplugin/c.lua
+++ b/.config/nvim/after/ftplugin/c.lua
@@ -5,6 +5,15 @@ vim.keymap.set('v', '<localleader>=', ":'<'>!clang-format -style=file -<CR>", {
})
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 - &"
]]