chore: cleanup telescope keybinds

This commit is contained in:
əlemi 2024-12-04 01:38:25 +01:00
parent b89e94a3ba
commit 26c0af4040
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -116,43 +116,28 @@ end
function KEYBINDS:set_telescope_keys(opts) 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
vim.keymap.set('n', '<leader><leader>p', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts) vim.keymap.set('n', '<leader>p', telescope.find_files, opts)
vim.keymap.set('n', '<leader>p', telescope.find_files, opts) vim.keymap.set('n', '<leader>', wrap(telescope.lsp_dynamic_workspace_symbols, {layout_strategy = 'vertical'}), opts)
vim.keymap.set('n', '<M-f>', telescope.find_files, opts) -- fallback for windows vim.keymap.set('n', '<leader>/', 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', '<leader>]', wrap(telescope.lsp_references, theme.get_dropdown()), opts)
vim.keymap.set('n', '<M-,>', wrap(telescope.live_grep, {layout_strategy = 'vertical'}), opts) -- fallback for windows vim.keymap.set('n', '<leader>r', wrap(telescope.lsp_references, theme.get_dropdown()), opts) -- overrule lsp bind
vim.keymap.set('n', '<M-]>', wrap(telescope.lsp_references, theme.get_cursor()), opts) vim.keymap.set('n', '<leader>;', telescope.git_bcommits, 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)
if not vim.g.disable_legacy_keybinds then if not vim.g.disable_legacy_keybinds then
-- File navigation -- File navigation
vim.keymap.set('n', '<leader>|', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts)
vim.keymap.set('n', '<C-ESC>', wrap(telescope.oldfiles, {layout_strategy = 'vertical' }), opts) 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', '<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', '<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
vim.keymap.set('n', '<M-]>', wrap(telescope.lsp_references, theme.get_cursor()), opts) 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', '<M-[>', wrap(telescope.jumplist, theme.get_dropdown()), opts)
vim.keymap.set('n', '<C-;>', telescope.git_bcommits, 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-;>', telescope.git_bcommits, opts) -- fallback for windows