diff --git a/nvim/plugin/keymaps.lua b/nvim/plugin/keymaps.lua index 5980464..e11bf5b 100644 --- a/nvim/plugin/keymaps.lua +++ b/nvim/plugin/keymaps.lua @@ -8,6 +8,9 @@ local keymap = vim.keymap -- Yank from current position till end of current line keymap.set('n', 'Y', 'y$', { silent = true, desc = '[Y]ank to end of line' }) +-- Clear highlights on search when pressing in normal mode +vim.keymap.set('n', '', 'nohlsearch') + -- Buffer list navigation keymap.set('n', '[b', vim.cmd.bprevious, { silent = true, desc = 'previous [b]uffer' }) keymap.set('n', ']b', vim.cmd.bnext, { silent = true, desc = 'next [b]uffer' }) diff --git a/nvim/plugin/telescope.lua b/nvim/plugin/telescope.lua index c199cca..f8769d6 100644 --- a/nvim/plugin/telescope.lua +++ b/nvim/plugin/telescope.lua @@ -5,6 +5,7 @@ vim.g.did_load_telescope_plugin = true local telescope = require('telescope') local actions = require('telescope.actions') +local action_state = require('telescope.actions.state') local builtin = require('telescope.builtin') @@ -43,6 +44,18 @@ telescope.setup { -- [''] = actions.close, [''] = actions.cycle_previewers_next, [''] = actions.cycle_previewers_prev, + + -- Multi File select + [''] = function(pb) + local picker = action_state.get_current_picker(pb) + local multi = picker:get_multi_selection() + actions.select_default(pb) -- the normal enter behaviour + for _, j in pairs(multi) do + if j.path ~= nil then -- is it a file -> open it as well: + vim.cmd(string.format('%s %s', 'edit', j.path)) + end + end + end, }, n = { q = actions.close,