--[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣷⣦⣄⡀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠚⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠗⢀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣤⣀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣶⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⢿⣿⣿⣿⣿⣿⣿⡿⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣶⣤ ⠀⠀⠀⠀⠀⠀⠀⠀⠐⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠓⠦⣌⡙⠻⠟⢋⣡⠴⠚⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⠂ ⠀⠀⠀⠀⢀⣠⣴⣆⡈⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠃⠘⢉⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢁⣰⣦⣄⡀ ⠀⠀⠐⠾⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠷⠂ ⠀⢸⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⡇ ⠀⢸⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⣦⣄⡉⠛⠿⠿⠛⢉⣠⣴⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⡇ ⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠻⢿⣿⣷⡆⢰⣾⣿⡿⠟⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ ⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣌⡙⠃⠘⢋⣡⣴⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⣿⣷⣾⣿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⠛⠿⣿⣿⣿⣿⠿⠛⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣷⣦⣄⡉⢉⣠⣴⣾⣿⣿⣿⣿⣿⠿⠛⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⡇⢸⣿⣿⣿⣿⠿⠛⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⡇⢸⠿⠛⠉ __ _ _ / _|___ ___| |_ __ _ ___| | __ | ||_ /____/ __| __/ _` |/ __| |/ / | _/ /_____\__ \ || (_| | (__| < |_|/___| |___/\__\__,_|\___|_|\_\ Neovim v0.12 configuration (C) Frank Zechert 2026 ]] local map = vim.keymap.set -- pressing ESC twices leaves terminal mode map("t", "", "", { desc = "Exit Terminal Mode" }) -- pressing ESC removes search highlights map("n", "", "nohlsearch", { desc = "Remove search result highlights" }) -- Smart buffer switch -- switch to the alternative buffer ("#"), if not available, switch to the -- previous buffer, if not possible, switch to the next buffer local function smart_buffer_switch(current) local alternative = vim.fn.bufnr("#") local buffers = vim.fn.getbufinfo({ buflisted = 1 }) local current_index = nil for index, buffer in ipairs(buffers) do if buffer.bufnr == current then current_index = index break end end -- try to switch to alternate buffer if alternative > 0 and vim.fn.buflisted(alternative) == 1 and alternative ~= current then vim.api.nvim_set_current_buf(alternative) -- try to switch to previous buffer elseif current_index and current_index > 1 then vim.api.nvim_set_current_buf(buffers[current_index - 1].bufnr) -- try to switch to next buffer elseif current_index and current_index < #buffers then vim.api.nvim_set_current_buf(buffers[current_index + 1].bufnr) end end local function smart_buffer_delete() local current = vim.api.nvim_get_current_buf() smart_buffer_switch(current) vim.cmd(":confirm bdelete " .. current) end local function smart_buffer_wipeout() local current = vim.api.nvim_get_current_buf() smart_buffer_switch(current) vim.cmd(":confirm bwipeout " .. current) end local function delete_other_buffers() local current = vim.api.nvim_get_current_buf() for _, buffer in ipairs(vim.api.nvim_list_buffers()) do if buffer ~= current and vim.bo[buffer].buflisted and not vim.bo[buffer].modified then vim.api.nvim_buf_delete(buffer, {}) end end end local function wipeout_other_buffers() local current = vim.api.nvim_get_current_buf() for _, buffer in ipairs(vim.api.nvim_list_buffers()) do if buffer ~= current and vim.bo[buffer].buflisted and not vim.bo[buffer].modified then vim.cmd("bwipeout " .. buffer) end end end map("n", "bd", smart_buffer_delete, { desc = "Close Current Buffer" }) map("n", "bw", smart_buffer_wipeout, { desc = "Wipeout Current Buffer" }) map("n", "bD", delete_other_buffers, { desc = "Close All Other Buffers" }) map("n", "bW", wipeout_other_buffers, { desc = "Wipeout All Other Buffers" }) -- Trouble Keybinds -- open diagnostics window map("n", "xd", [[Trouble diagnostics toggle focus=false filter.buf=0]], { desc = "Toggle diagnostic message for current buffer" }) map("n", "xD", [[Trouble diagnostics toggle focus=false]], { desc = "Toggle diagnostic message for project" }) map("n", "grt", [[Trouble symbols toggle focus=false]], { desc = "Open TreeSitter Symbols" }) map("n", "grs", [[Trouble lsp_document_symbols toggle focus=false]], { desc = "Open LSP Document Symbols", silent = true, noremap = true }) map("n", "grS", [[Trouble lsp_workspace_symbols toggle focus=false]], { desc = "Open LSP Workspace Symbols", silent = true, noremap = true }) map("n", "grD", [[Trouble lsp_declarations toggle]], { desc = "Show LSP Declarations", silent = true, noremap = true }) map("n", "grd", [[Trouble lsp_definitions toggle]], { desc = "Show LSP Definitions", silent = true, noremap = true }) map("n", "gri", [[Trouble lsp_implementations toggle]], { desc = "Show LSP Implementations", silent = true, noremap = true }) map("n", "grc", [[Trouble lsp_incoming_calls toggle]], { desc = "Show LSP incoming calls", silent = true, noremap = true }) map("n", "grC", [[Trouble lsp_outgoing_calls toggle]], { desc = "Show LSP outgoing calls", silent = true, noremap = true }) map("n", "grr", [[Trouble lsp_references toggle]], { desc = "Show LSP references", silent = true, noremap = true }) map("n", "xq", [[Trouble qflist toggle focus=false]], { desc = "Show Quickfix List" }) map("n", "xl", [[Trouble loclist toggle focus=false]], { desc = "Show Location List" }) map("n", "grn", vim.lsp.buf.rename, { desc = "Rename", silent = true, noremap = true }) map("n", "gra", vim.lsp.buf.code_action, { desc = "Action", silent = true, noremap = true }) map("n", "gl", vim.diagnostic.open_float, { desc = "Open Diagnostic Float" })