diff --git a/lua/keybinds.lua b/lua/keybinds.lua index 2c3e35a..816f79c 100644 --- a/lua/keybinds.lua +++ b/lua/keybinds.lua @@ -21,6 +21,13 @@ &&& ]]-- +local function wrap(func, ...) + local args = {...} + return function() + func(unpack(args)) + end +end + local KEYBINDS = { foldcolumn = false, } @@ -87,28 +94,33 @@ function KEYBINDS:set_lsp_keys(opts) end function KEYBINDS:set_telescope_keys(opts) + local telescope = require('telescope.builtin') + local theme = require('telescope.themes') -- File navigation - vim.keymap.set('n', '', ':Telescope oldfiles', opts) - vim.keymap.set('n', '', ':Telescope find_files', opts) - vim.keymap.set('n', 'F', ':Telescope find_files', opts) -- fallback for windows - vim.keymap.set('n', '', ':Telescope live_grep', opts) - vim.keymap.set('n', '', ':Telescope live_grep', opts) -- fallback for windows - vim.keymap.set('n', '', ':Telescope lsp_references', opts) - vim.keymap.set('n', '', ':Telescope git_bcommits', opts) - vim.keymap.set('n', '', ':Telescope git_bcommits', opts) -- fallback for windows + vim.keymap.set('n', '', telescope.oldfiles, opts) + vim.keymap.set('n', '', telescope.oldfiles, opts) -- fallback for windows + vim.keymap.set('n', '', telescope.find_files, opts) + vim.keymap.set('n', '', telescope.find_files, opts) -- fallback for windows + vim.keymap.set('n', '', telescope.live_grep, opts) + vim.keymap.set('n', '', telescope.live_grep, opts) -- fallback for windows + vim.keymap.set('n', '', wrap(telescope.lsp_references, theme.get_cursor()), opts) + vim.keymap.set('n', '', wrap(telescope.lsp_references, theme.get_cursor()), opts) -- fallback for windows + vim.keymap.set('n', '', telescope.git_bcommits, opts) + vim.keymap.set('n', '', telescope.git_bcommits, opts) -- fallback for windows + vim.keymap.set('n', '', telescope.registers, opts) -- fallback for windows -- Marks and buffers with telescope - vim.keymap.set('n', '', ':Telescope buffers', opts) - vim.keymap.set('n', '', ':Telescope marks', opts) - vim.keymap.set('n', '', ':Telescope marks', opts) -- fallback for windows - vim.keymap.set('n', '', ':Telescope current_buffer_fuzzy_find', opts) - vim.keymap.set('n', '', ':Telescope current_buffer_fuzzy_find', opts) -- fallback for windows + vim.keymap.set('n', '', telescope.buffers, opts) + vim.keymap.set('n', '', wrap(telescope.marks, theme.get_dropdown()), opts) + vim.keymap.set('n', '', wrap(telescope.marks, theme.get_dropdown()), opts) -- fallback for windows + vim.keymap.set('n', '', wrap(telescope.current_buffer_fuzzy_find, theme.get_dropdown()), opts) + vim.keymap.set('n', '', wrap(telescope.current_buffer_fuzzy_find, theme.get_dropdown()), opts) -- fallback for windows -- Symbols with telescope - vim.keymap.set('n', '', ':Telescope lsp_document_symbols', opts) - vim.keymap.set('n', '', ':Telescope lsp_workspace_symbols', opts) - vim.keymap.set('n', '', ':Telescope lsp_workspace_symbols', opts) -- fallback for windows + vim.keymap.set('n', '', telescope.lsp_document_symbols, opts) + vim.keymap.set('n', '', telescope.lsp_workspace_symbols, opts) + vim.keymap.set('n', '', telescope.lsp_workspace_symbols, opts) -- fallback for windows -- Error list with telescope - vim.keymap.set('n', '', ':Telescope diagnostics', opts) - vim.keymap.set('n', '', ':Telescope diagnostics bufnr=0', opts) + vim.keymap.set('n', '', wrap(telescope.diagnostics, theme.get_ivy()), opts) + vim.keymap.set('n', '', wrap(telescope.diagnostics, theme.get_ivy({bufnr=0})), opts) end function KEYBINDS:set_dap_keys(opts)