feat: new leader keybinds, optionally disable chord

This commit is contained in:
əlemi 2024-02-08 15:19:45 +01:00
parent 15a9acafb8
commit e595a6c939
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -115,9 +115,8 @@ function KEYBINDS:set_telescope_keys(opts)
local telescope = require('telescope.builtin') local telescope = require('telescope.builtin')
local theme = require('telescope.themes') local theme = require('telescope.themes')
-- File navigation -- File navigation
vim.keymap.set('n', '<C-ESC>', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts) vim.keymap.set('n', '<leader><leader>p', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts)
vim.keymap.set('n', '<M-!>', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts) -- fallback for windows... even <M-Esc> is used vim.keymap.set('n', '<leader>p', telescope.find_files, opts)
vim.keymap.set('n', '<C-f>', telescope.find_files, opts)
vim.keymap.set('n', '<M-f>', telescope.find_files, opts) -- fallback for windows vim.keymap.set('n', '<M-f>', telescope.find_files, opts) -- fallback for windows
vim.keymap.set('n', '<C-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts) vim.keymap.set('n', '<C-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts)
vim.keymap.set('n', '<M-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts) -- fallback for windows vim.keymap.set('n', '<M-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts) -- fallback for windows
@ -143,6 +142,37 @@ function KEYBINDS:set_telescope_keys(opts)
vim.keymap.set('n', '<M-CR>', telescope.resume, opts) vim.keymap.set('n', '<M-CR>', telescope.resume, opts)
-- Error list with telescope -- Error list with telescope
vim.keymap.set('n', '<C-PageDown>', wrap(telescope.diagnostics, theme.get_ivy({bufnr=0})), opts) vim.keymap.set('n', '<C-PageDown>', wrap(telescope.diagnostics, theme.get_ivy({bufnr=0})), opts)
if not vim.g.disable_legacy_keybinds then
-- File navigation
vim.keymap.set('n', '<C-ESC>', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts)
vim.keymap.set('n', '<M-!>', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts) -- fallback for windows... even <M-Esc> is used
vim.keymap.set('n', '<C-f>', telescope.find_files, opts)
vim.keymap.set('n', '<M-f>', telescope.find_files, opts) -- fallback for windows
vim.keymap.set('n', '<C-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts)
vim.keymap.set('n', '<M-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts) -- fallback for windows
vim.keymap.set('n', '<M-]>', wrap(telescope.lsp_references, theme.get_cursor()), opts)
vim.keymap.set('n', '<M-[>', wrap(telescope.jumplist, theme.get_dropdown()), opts)
vim.keymap.set('n', '<C-;>', telescope.git_bcommits, opts)
vim.keymap.set('n', '<M-;>', telescope.git_bcommits, opts) -- fallback for windows
vim.keymap.set('n', '<M-=>', wrap(telescope.registers, theme.get_dropdown()), opts) -- fallback for windows
-- Marks and buffers with telescope
vim.keymap.set('n', '<C-End>', telescope.buffers, opts)
vim.keymap.set('n', '<C-\'>', wrap(telescope.marks, theme.get_dropdown()), opts)
vim.keymap.set('n', '<M-\'>', wrap(telescope.marks, theme.get_dropdown()), opts) -- fallback for windows
vim.keymap.set('n', '<C-/>', wrap(telescope.current_buffer_fuzzy_find, {layout_strategy = 'vertical'}), opts)
vim.keymap.set('n', '<M-/>', wrap(telescope.current_buffer_fuzzy_find, {layout_strategy = 'vertical'}), opts) -- fallback for windows
-- Symbols with telescope
vim.keymap.set('n', '<C-\\>', telescope.lsp_document_symbols, opts)
vim.keymap.set('n', '<leader>/', telescope.lsp_document_symbols, opts)
vim.keymap.set('n', '<leader>s', wrap(telescope.lsp_dynamic_workspace_symbols, {layout_strategy = 'vertical'}), opts)
vim.keymap.set('n', '<C-|>', wrap(telescope.lsp_dynamic_workspace_symbols, {layout_strategy = 'vertical'}), opts)
vim.keymap.set('n', '<M-|>', wrap(telescope.lsp_dynamic_workspace_symbols, {layout_strategy = 'vertical'}), opts)
-- Resule last
vim.keymap.set('n', '<C-CR>', telescope.resume, opts)
vim.keymap.set('n', '<M-CR>', telescope.resume, opts)
-- Error list with telescope
vim.keymap.set('n', '<C-PageDown>', wrap(telescope.diagnostics, theme.get_ivy({bufnr=0})), opts)
end
end end
function KEYBINDS:set_dap_keys(opts) function KEYBINDS:set_dap_keys(opts)