diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-07-15 17:39:53 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-07-15 17:39:53 -0400 |
| commit | cd7a32285b864f1fa9c453b74111775103b20483 (patch) | |
| tree | c7a9f50751fdad196b4403f0db9accbaeab3c79d /nvim/lua/keymap.lua | |
| parent | d3d3d729a71820fc2a74ef44c055bf8dbb7cf8e7 (diff) | |
installed oil file explorer for nvim
Diffstat (limited to 'nvim/lua/keymap.lua')
| -rw-r--r-- | nvim/lua/keymap.lua | 43 |
1 files changed, 10 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 |
