diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-08 23:13:05 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-08 23:13:05 +0100 |
commit | c9e2adbbc8fd7a5398c8c66d21f0e02dc7b60203 (patch) | |
tree | 274263ba15e0197180af8bb681e22c4780d5de05 /.config/nvim/lua/keymappings.lua | |
parent | e4ea22e223bbd6b4091610c6fa093862cbd32f75 (diff) |
Add new lunarvin updates
Diffstat (limited to '.config/nvim/lua/keymappings.lua')
-rw-r--r-- | .config/nvim/lua/keymappings.lua | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua index cc6865a..5d71b97 100644 --- a/.config/nvim/lua/keymappings.lua +++ b/.config/nvim/lua/keymappings.lua @@ -57,13 +57,14 @@ end -- Load key mappings for all provided modes -- @param keymaps A list of key mappings for each mode function M.load(keymaps) + keymaps = keymaps or {} for mode, mapping in pairs(keymaps) do M.load_mode(mode, mapping) end end -function M.config() - options.keys = { +function M.get_defaults() + local keys = { ---@usage change or add keymappings for insert mode insert_mode = { -- 'jk' for quitting insert mode @@ -81,16 +82,6 @@ function M.config() ["<A-Down>"] = "<C-\\><C-N><C-w>j", ["<A-Left>"] = "<C-\\><C-N><C-w>h", ["<A-Right>"] = "<C-\\><C-N><C-w>l", - -- navigate tab completion with <c-j> and <c-k> - -- runs conditionally - ["<C-j>"] = { - 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', - { expr = true, noremap = true }, - }, - ["<C-k>"] = { - 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', - { expr = true, noremap = true }, - }, }, ---@usage change or add keymappings for normal mode @@ -167,12 +158,14 @@ function M.config() } if vim.fn.has "mac" == 1 then - options.keys.normal_mode["<A-Up>"] = options.keys.normal_mode["<C-Up>"] - options.keys.normal_mode["<A-Down>"] = options.keys.normal_mode["<C-Down>"] - options.keys.normal_mode["<A-Left>"] = options.keys.normal_mode["<C-Left>"] - options.keys.normal_mode["<A-Right>"] = options.keys.normal_mode["<C-Right>"] + keys.normal_mode["<A-Up>"] = keys.normal_mode["<C-Up>"] + keys.normal_mode["<A-Down>"] = keys.normal_mode["<C-Down>"] + keys.normal_mode["<A-Left>"] = keys.normal_mode["<C-Left>"] + keys.normal_mode["<A-Right>"] = keys.normal_mode["<C-Right>"] Log:debug "Activated mac keymappings" end + + return keys end function M.print(mode) @@ -184,9 +177,4 @@ function M.print(mode) end end -function M.setup() - vim.g.mapleader = (options.leader == "space" and " ") or options.leader - M.load(options.keys) -end - return M |