diff options
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/lua/keymap.lua | 43 | ||||
| -rw-r--r-- | nvim/lua/plugins/oil.lua | 13 |
2 files changed, 23 insertions, 33 deletions
diff --git a/nvim/lua/keymap.lua b/nvim/lua/keymap.lua index e28c003..b816776 100644 --- a/nvim/lua/keymap.lua +++ b/nvim/lua/keymap.lua @@ -1,42 +1,19 @@ --- Provides convienent lua methods for binding keys --- Source: Primeagen local M = {} -local function bind(op, outer_opts) - outer_opts = outer_opts or {noremap = true} - return function(lhs, rhs, opts) - opts = vim.tbl_extend("force", - outer_opts, - opts or {} - ) - vim.keymap.set(op, lhs, rhs, opts) +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 -M.nmap = bind("n", {noremap = false}) -M.nnoremap = bind("n") -M.vnoremap = bind("v") -M.xnoremap = bind("x") -M.inoremap = bind("i") - -M.nnoremap("gf", function() vim.cmd([[:e <cfile>]]) end) -M.nnoremap("<Leader>q", function() vim.cmd(':botright cope') end) -M.nnoremap("<Leader>l", function() - local success, err_msg = pcall(function() - vim.cmd(':aboveleft lope') - end) - if not success then - err_msg = string.match(tostring(err_msg), "E%d+.*") - vim.api.nvim_err_writeln(err_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) -M.nnoremap("<leader>ef", function() - vim.cmd('Lexplore') -end) +vim.keymap.set('n',"<Leader>k", function() vim.cmd("make") end) -M.nnoremap("<Leader>k", function() - vim.cmd("make") -end) +vim.keymap.set('t', "<ESC><ESC>", "<c-\\><c-n>") return M diff --git a/nvim/lua/plugins/oil.lua b/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..40a485e --- /dev/null +++ b/nvim/lua/plugins/oil.lua @@ -0,0 +1,13 @@ +return { + 'stevearc/oil.nvim', + dependencies = 'nvim-tree/nvim-web-devicons', + opts = {}, + keys = { { + "<leader>ef", + function() + vim.cmd('topleft vsplit +Oil') + end, + desc = "Open Oil file explorer in a far left split, similar to :Lexplore" + } }, + cmd = "Oil" +} |
