vim: better telescope key mappings (match fzf)

This commit is contained in:
Fernando Schauenburg 2024-03-17 23:36:44 +01:00
parent 7392fed0d5
commit fee0d0f5c7

View file

@ -113,25 +113,33 @@ return {
local actions = require("telescope.actions")
local layout = require("telescope.actions.layout")
local state = require("telescope.actions.state")
local trouble = vim.F.npcall(require, "trouble.providers.telescope") or {}
local clear_prompt = function(prompt_bufnr)
state.get_current_picker(prompt_bufnr):reset_prompt()
end
local mappings = {
["<c-u>"] = function(prompt_bufnr)
state.get_current_picker(prompt_bufnr):reset_prompt()
end,
["<c-j>"] = actions.cycle_history_next,
["<c-k>"] = actions.cycle_history_prev,
["<c-y>"] = layout.cycle_layout_next,
["<c-u>"] = clear_prompt,
["<c-i>"] = actions.toggle_selection + actions.move_selection_next,
["<c-o>"] = actions.toggle_selection + actions.move_selection_previous,
["<c-p>"] = layout.toggle_preview,
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
["<c-f>"] = actions.results_scrolling_down,
["<c-b>"] = actions.results_scrolling_up,
["<s-down>"] = actions.preview_scrolling_down,
["<s-up>"] = actions.preview_scrolling_up,
["<c-y>"] = layout.cycle_layout_next,
["<c-o>"] = layout.toggle_mirror,
["<c-h>"] = layout.toggle_preview,
["<c-s>"] = actions.select_horizontal,
["<c-x>"] = false,
["<c-c>"] = actions.close,
["<c-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
["<c-l>"] = actions.smart_send_to_loclist + actions.open_loclist,
["<c-b>"] = trouble.smart_open_with_trouble,
}
return vim.tbl_deep_extend("force", opts or {}, {
@ -163,6 +171,7 @@ return {
buffers = {
mappings = {
n = { x = actions.delete_buffer },
i = { ["<c-x>"] = actions.delete_buffer },
},
},
colorscheme = { theme = "dropdown" },