Explorar el Código

fix: no preselect for up/down, c-j/c-k and tab/s-tab

Christian Chiarulli hace 3 años
padre
commit
f0b30f0a83
Se han modificado 2 ficheros con 4 adiciones y 4 borrados
  1. 2 2
      lua/core/cmp.lua
  2. 2 2
      lua/keymappings.lua

+ 2 - 2
lua/core/cmp.lua

@@ -78,7 +78,7 @@ M.config = function()
       -- TODO: potentially fix emmet nonsense
       ["<Tab>"] = cmp.mapping(function()
         if vim.fn.pumvisible() == 1 then
-          vim.fn.feedkeys(T "<C-n>", "n")
+          vim.fn.feedkeys(T "<down>", "n")
         elseif luasnip.expand_or_jumpable() then
           vim.fn.feedkeys(T "<Plug>luasnip-expand-or-jump", "")
         elseif check_backspace() then
@@ -94,7 +94,7 @@ M.config = function()
       }),
       ["<S-Tab>"] = cmp.mapping(function(fallback)
         if vim.fn.pumvisible() == 1 then
-          vim.fn.feedkeys(T "<C-p>", "n")
+          vim.fn.feedkeys(T "<up>", "n")
         elseif luasnip.jumpable(-1) then
           vim.fn.feedkeys(T "<Plug>luasnip-jump-prev", "")
         else

+ 2 - 2
lua/keymappings.lua

@@ -83,8 +83,8 @@ function M.config()
       ["<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 } },
+      ["<C-j>"] = { 'pumvisible() ? "\\<down>" : "\\<C-j>"', { expr = true, noremap = true } },
+      ["<C-k>"] = { 'pumvisible() ? "\\<up>" : "\\<C-k>"', { expr = true, noremap = true } },
     },
 
     ---@usage change or add keymappings for normal mode