vim/telescope: add mappings and unify insert/normal modes

This commit is contained in:
Fernando Schauenburg 2023-07-15 23:02:33 +02:00
parent 96e906a8ab
commit 7cf8b4d250

View file

@ -4,17 +4,18 @@ local config = function()
local actions_layout = require 'telescope.actions.layout' local actions_layout = require 'telescope.actions.layout'
local builtin = require 'telescope.builtin' local builtin = require 'telescope.builtin'
local mappings = { local keymap = {
['<c-l>'] = actions_layout.cycle_layout_next, ['<c-l>'] = actions_layout.cycle_layout_next,
['<c-o>'] = actions_layout.toggle_mirror, ['<c-o>'] = actions_layout.toggle_mirror,
['<c-q>'] = actions.smart_send_to_qflist + actions.open_qflist, ['<c-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
} ['<c-c>'] = actions.close,
['<s-down>'] = actions.preview_scrolling_down,
['<s-up>'] = actions.preview_scrolling_up,
local mappings_normal_mode = mappings
local mappings_insert_mode = vim.tbl_extend('force', mappings, {
['<c-j>'] = actions.cycle_history_next, ['<c-j>'] = actions.cycle_history_next,
['<c-k>'] = actions.cycle_history_prev, ['<c-k>'] = actions.cycle_history_prev,
}) }
telescope.setup { telescope.setup {
defaults = { defaults = {
@ -49,8 +50,8 @@ local config = function()
}, },
mappings = { mappings = {
i = mappings_insert_mode, i = keymap,
n = mappings_normal_mode, n = keymap,
}, },
}, },