26 lines
1.0 KiB
Lua
26 lines
1.0 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 additional keymaps here
|
|
|
|
-- Focus the Snacks Explorer if open, otherwise toggle/open it
|
|
vim.keymap.set({ "n", "t", "i" }, "<space>e", function()
|
|
-- Look for an already active explorer instance
|
|
local explorer = Snacks.picker.get({ source = "explorer" })[1]
|
|
|
|
if not explorer then
|
|
-- 1. If it's closed, open it fresh
|
|
Snacks.explorer()
|
|
elseif explorer:is_focused() then
|
|
-- 2. If we are inside the explorer, jump focus back to the code/file buffer
|
|
-- This relies on native window jumping to the last accessed window (the file)
|
|
vim.cmd("wincmd p")
|
|
else
|
|
-- 3. If explorer is open but we are in a file, just re-focus the explorer
|
|
explorer:focus()
|
|
end
|
|
end, { desc = "Smart Explorer Focus Toggle" })
|
|
|
|
vim.keymap.set("n", "<leader>tp", function()
|
|
require("neotest").output_panel.toggle()
|
|
end, { desc = "Toggle Output Panel" })
|