Sfoglia il codice sorgente

fix: make telescope default mappings overrideable

ChristianChiarulli 3 anni fa
parent
commit
f3d9ef138d
1 ha cambiato i file con 17 aggiunte e 0 eliminazioni
  1. 17 0
      lua/lvim/core/telescope.lua

+ 17 - 0
lua/lvim/core/telescope.lua

@@ -8,6 +8,7 @@ function M.config()
     on_config_done = nil,
   }
 
+  local actions = require "telescope.actions"
   lvim.builtin.telescope = vim.tbl_extend("force", lvim.builtin.telescope, {
     defaults = {
       prompt_prefix = " ",
@@ -33,6 +34,22 @@ function M.config()
         "--smart-case",
         "--hidden",
       },
+      mappings = {
+        i = {
+          ["<C-n>"] = actions.move_selection_next,
+          ["<C-p>"] = actions.move_selection_previous,
+          ["<C-c>"] = actions.close,
+          ["<C-j>"] = actions.cycle_history_next,
+          ["<C-k>"] = actions.cycle_history_prev,
+          ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
+          ["<CR>"] = actions.select_default + actions.center,
+        },
+        n = {
+          ["<C-n>"] = actions.move_selection_next,
+          ["<C-p>"] = actions.move_selection_previous,
+          ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
+        },
+      },
       file_ignore_patterns = {},
       path_display = { shorten = 5 },
       winblend = 0,