mirror of
https://github.com/kossLAN/nvim-flake.git
synced 2025-11-05 02:09:49 -05:00
telescope & keybind: add multi file select & search esape bind
This commit is contained in:
parent
b0a50ecca1
commit
a5108f68c1
2 changed files with 16 additions and 0 deletions
|
|
@ -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 <Esc> in normal mode
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- 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' })
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
-- ['<esc>'] = actions.close,
|
||||
['<C-s>'] = actions.cycle_previewers_next,
|
||||
['<C-a>'] = actions.cycle_previewers_prev,
|
||||
|
||||
-- Multi File select
|
||||
['<CR>'] = 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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue