From 2fe6a440b78471792cac550e8679aefe60a6cc40 Mon Sep 17 00:00:00 2001 From: venus Date: Sun, 31 May 2026 19:46:05 -0500 Subject: [PATCH] added some custom fucntions and a new api --- lua/custom-functions.lua | 23 +++++++++++++++++++++++ lua/plugins/remote.lua | 7 +++++++ 2 files changed, 30 insertions(+) create mode 100644 lua/custom-functions.lua create mode 100644 lua/plugins/remote.lua diff --git a/lua/custom-functions.lua b/lua/custom-functions.lua new file mode 100644 index 0000000..3781f01 --- /dev/null +++ b/lua/custom-functions.lua @@ -0,0 +1,23 @@ +-- lua/custom-functions.lua +-- A library file with custom functions for cleaner code elsewhere + +local C = {} +function C.runLastCommand() + -- TODO fix implementation + local term = require("toggleterm.terminal").get(1)-- Get terminal ID 1 + -- Save position and buffer context + if term then + local original_window = vim.api.nvim_get_current_win() + local saved_view = vim.fn.winsaveview() + -- Using \r (carriage return) or \n\n often bypasses shell interceptors + -- term:send("clear\r") + term:send("test_dev.sh\r") + vim.api.nvim_set_current_win(original_window) + vim.fn.winrestview(saved_view) + else + vim.notify("Terminal 1 is not open yet!", vim.log.levels.WARN) + end + -- Return logic +end + +return C diff --git a/lua/plugins/remote.lua b/lua/plugins/remote.lua new file mode 100644 index 0000000..66661d6 --- /dev/null +++ b/lua/plugins/remote.lua @@ -0,0 +1,7 @@ +return { + 'chipsenkbeil/distant.nvim', + branch = 'v0.3', + config = function() + require('distant'):setup() + end +}