feat(config): add Oh My Pi terminal toggle configuration

This commit is contained in:
Prad Nukala committed 2026-10-05 11:38:06 -04:00
1 parent a3e067b701
commit 637fbc4cb3
1 file changed
+26
+26
View File
@@ -0,0 +1,26 @@
--- Single Oh My Pi side terminal, toggled with <C-a><C-a>.
---
--- `Snacks.terminal.toggle` keys terminals by cmd + window-local cwd +
--- v:count1, so toggling from a buffer whose window has another cwd spawns a
--- second omp. Holding the handle here keeps exactly one session; it is
--- recreated only after the omp process exits (auto_close wipes the buffer).
local M = {}
local term ---@type snacks.win?
function M.toggle()
if term and term:buf_valid() then
term:toggle()
return
end
term = require("snacks").terminal.open("omp", {
win = {
position = "right",
width = 0.4,
-- buffer-local, so <C-a> keeps reaching other terminals unchanged
keys = { omp_hide = { "<C-a><C-a>", "hide", mode = { "n", "t" }, desc = "Hide Oh My Pi" } },
},
})
end
return M