From 637fbc4cb31644c958e7a0944ff0de7e31e7bc23 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 5 Oct 2026 11:38:06 -0400 Subject: [PATCH] feat(config): add Oh My Pi terminal toggle configuration --- lua/config/omp_term.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lua/config/omp_term.lua diff --git a/lua/config/omp_term.lua b/lua/config/omp_term.lua new file mode 100644 index 0000000..c5e344d --- /dev/null +++ b/lua/config/omp_term.lua @@ -0,0 +1,26 @@ +--- Single Oh My Pi side terminal, toggled with . +--- +--- `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 keeps reaching other terminals unchanged + keys = { omp_hide = { "", "hide", mode = { "n", "t" }, desc = "Hide Oh My Pi" } }, + }, + }) +end + +return M