aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/keymap.lua
blob: 5fff17b22920ec77039f0b3a06f206ec543b40f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local M = {}

local cmd_pcall = function (string)
    local success, msg = pcall(function() vim.cmd(string) end)
    if not success then
        msg = string.match(tostring(msg), "E%d+.*")
        vim.api.nvim_err_writeln(msg)
    end
end

vim.keymap.set('n', 'gf', function() cmd_pcall(':e <cfile>') end, {noremap = true})
vim.keymap.set('n', "<Leader>q", function() vim.cmd(':botright cope') end)
vim.keymap.set('n', "<Leader>l", function() cmd_pcall(':aboveleft lope') end)
vim.keymap.set('n', "<Leader>dk", function () vim.diagnostic.open_float() end)

vim.keymap.set('n',"<Leader>k", function() vim.cmd("make") end)

vim.keymap.set('t', "<ESC><ESC>", "<c-\\><c-n>")

return M