Files
lazyvim-config/lua/config/keymaps.lua
T
2025-10-11 07:07:29 +01:00

38 lines
1.6 KiB
Lua

-- 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", "<C-S-p>", 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", "<C-p>", "<cmd>Neotree toggle reveal<cr>", { desc = "Explorer (Neo-tree)" })
-- elseif has_cmd("NvimTreeToggle") then
-- map("n", "<C-p>", "<cmd>NvimTreeFindFileToggle<cr>", { desc = "Explorer (nvim-tree)" })
-- elseif has_cmd("Oil") then
-- map("n", "<C-p>", "<cmd>Oil --float<cr>", { desc = "Explorer (Oil)" })
-- else
-- map("n", "<C-p>", "<cmd>Ex<cr>", { desc = "Explorer (netrw)" }) -- built-in
-- end
--
-- -- Ctrl+Shift+P → “command palette”
-- -- Many terminals don't send <C-S-p>, so keep <leader>P as a reliable fallback.
-- if has_cmd("WhichKey") then
-- map("n", "<C-S-p>", "<cmd>WhichKey<cr>", { desc = "Command Palette" })
-- map("n", "<leader>P", "<cmd>WhichKey<cr>", { desc = "Command Palette [fallback]" })
-- elseif has_cmd("Telescope") then
-- map("n", "<C-S-p>", "<cmd>Telescope commands<cr>", { desc = "Command Palette" })
-- map("n", "<leader>P", "<cmd>Telescope commands<cr>", { desc = "Command Palette [fallback]" })
-- end