-- Adi's custom section local map = vim.keymap.set --local unmap = vim.keymap.del -- Neovim 0.11+ ships default LSP keymaps in `vim/_defaults.lua` (e.g. `grr`, `gri`, `grt`), -- but those use the built-in UI (often a locations list / read-only buffer). -- Override them here to prefer Telescope pickers. local function telescope_lsp(picker, fallback, picker_opts) return function() local ok, builtin = pcall(require, 'telescope.builtin') if ok and type(builtin[picker]) == 'function' then return builtin[picker](picker_opts or {}) end return fallback() end end map('n', 'gr', telescope_lsp('lsp_references', vim.lsp.buf.references), { desc = 'LSP: references (telescope)' }) map('n', 'gi', telescope_lsp('lsp_implementations', vim.lsp.buf.implementation), { desc = 'LSP: implementations (telescope)' }) map('n', 'gt', telescope_lsp('lsp_type_definitions', vim.lsp.buf.type_definition), { desc = 'LSP: type definitions (telescope)' }) map('n', 'gO', telescope_lsp('lsp_document_symbols', vim.lsp.buf.document_symbol), { desc = 'LSP: document symbols (telescope)' }) map('n', 'gd', telescope_lsp('lsp_definitions', vim.lsp.buf.document_symbol), { desc = 'LSP: Go to definition' }) map('n', ';', ':', { desc = 'CMD enter command mode' }) map('i', 'jk', '') map('n', 'lw', function() vim.diagnostic.setloclist() end, { desc = 'Diagnostic setloclist' }) map('n', 'h', 'nohlsearch', { desc = 'set no highlight search' }) map('n', '', ' m .+1==', { desc = 'Move line down' }) map('n', '', ' m .-2==', { desc = 'Move line up' }) map('v', '', ":m '>+1gv=gv", { desc = 'Move selected block down' }) map('v', '', ":m '<-2gv=gv", { desc = 'Move selected block up' }) map('v', 'y', '"*y', { desc = 'Yank to clipboard' }) map('n', 'w', ':w ', { desc = 'alias to :w' }) map('n', '', 'NvimTmuxNavigateLeft', { silent = true }) map('n', '', 'NvimTmuxNavigateDown', { silent = true }) map('n', '', 'NvimTmuxNavigateUp', { silent = true }) map('n', '', 'NvimTmuxNavigateRight', { silent = true }) map('n', '', 'NvimTmuxNavigateLastActive', { silent = true }) map('n', 'm', 'MarkdownPreview', { silent = true }) map('n', 'gg', ' LazyGit ', { desc = 'start LazyGit' }) map('n', 'd', ' Run/Debug') map('n', 'fe', 'Telescope emoji', { desc = '😃 [F]ind [E]moji' }) map('n', 'l', ' Lsp') map('n', 't', ' Telescope or  Trouble') map('n', 'tr', 'Telescope resume') map('n', 'o', ' Obsidian') map('n', 'r', ' Render Markdown') map('n', 'rt', 'RenderMarkdown toggle', { desc = 'toggle render markdown', silent = true }) map('n', 're', 'RenderMarkdown expand', { desc = 'Increase anti-conceal margin above and below by 1', silent = true }) map('n', 're', 'RenderMarkdown expand', { desc = 'Decrease anti-conceal margin above and below by 1', silent = true }) map('n', 'os', 'ObsidianSearch', { silent = true }) map('n', 'ob', 'ObsidianBacklink', { silent = true }) map('n', 'ot', 'ObsidianToday', { silent = true }) map('n', 'od', 'ObsidianDailies', { silent = true }) map('n', 'oq', 'ObsidianQuickSwitch', { silent = true }) map('n', 'on', 'ObsidianNew', { silent = true }) map('n', 'e', 'NvimTreeFindFileToggle', { silent = true }) map('n', '', 'bn', { desc = 'next buffer' }) map('n', '', 'bp', { desc = 'previous buffer' }) map('n', 'x', 'bd', { desc = 'delete buffer' }) map('n', 'X', ':only', { desc = 'Close other panes' }) -- TJs kickstart -- -- -- [[ Basic Keymaps ]] -- See `:help map()` -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` --map('n', '', 'nohlsearch') -- Diagnostic keymaps map('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. -- -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- or just use to exit terminal mode map('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode -- map('n', '', 'echo "Use h to move!!"') -- map('n', '', 'echo "Use l to move!!"') -- map('n', '', 'echo "Use k to move!!"') -- map('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands -- map('n', '', '', { desc = 'Move focus to the left window' }) -- map('n', '', '', { desc = 'Move focus to the right window' }) -- map('n', '', '', { desc = 'Move focus to the lower window' }) -- map('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode -- See `:help vim.highlight.on_yank()` vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() vim.highlight.on_yank() end, })