-- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any addtional keymaps here -- -- vim.keymap.set("n", "", function() -- Snacks.explorer.open() -- vim.schedule(function() -- vim.api.nvim_feedkeys("/", "m", false) -- end) -- end, { desc = "Focus Explorer search" }) -- -- local map = vim.keymap.set -- local function has_cmd(cmd) -- return vim.fn.exists(":" .. cmd) == 2 -- end -- -- -- Ctrl+P → open your file explorer (auto-detect) -- if has_cmd("Neotree") then -- map("n", "", "Neotree toggle reveal", { desc = "Explorer (Neo-tree)" }) -- elseif has_cmd("NvimTreeToggle") then -- map("n", "", "NvimTreeFindFileToggle", { desc = "Explorer (nvim-tree)" }) -- elseif has_cmd("Oil") then -- map("n", "", "Oil --float", { desc = "Explorer (Oil)" }) -- else -- map("n", "", "Ex", { desc = "Explorer (netrw)" }) -- built-in -- end -- -- -- Ctrl+Shift+P → "command palette" -- -- Many terminals don't send , so keep P as a reliable fallback. -- if has_cmd("WhichKey") then -- map("n", "", "WhichKey", { desc = "Command Palette" }) -- map("n", "P", "WhichKey", { desc = "Command Palette [fallback]" }) -- elseif has_cmd("Telescope") then -- map("n", "", "Telescope commands", { desc = "Command Palette" }) -- map("n", "P", "Telescope commands", { desc = "Command Palette [fallback]" }) -- end -- Copy the current file's path to the system clipboard. -- yp = relative to cwd, yP = absolute. -- Writes to the "+" register, which LazyVim binds to the system clipboard via -- clipboard=unnamedplus, so these land in the OS clipboard directly. vim.keymap.set("n", "yp", function() local relative_path = vim.fn.expand("%:~:.") vim.fn.setreg("+", relative_path) vim.notify("Copied relative path: " .. relative_path) end, { desc = "Copy relative file path" }) vim.keymap.set("n", "yP", function() local absolute_path = vim.fn.expand("%:p") vim.fn.setreg("+", absolute_path) vim.notify("Copied absolute path: " .. absolute_path) end, { desc = "Copy absolute file path" })