From c99db3c038da5d0373acaa7f45481d8db0345ca0 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sun, 24 Nov 2024 03:17:10 -0500 Subject: [PATCH] chore: clean up previous lazygit implementations from config --- deprecated/rootiest.lua | 55 +++++++++++++++++++++++++++++++++++++++++ lua/config/rootiest.lua | 52 ++++---------------------------------- 2 files changed, 60 insertions(+), 47 deletions(-) create mode 100644 deprecated/rootiest.lua diff --git a/deprecated/rootiest.lua b/deprecated/rootiest.lua new file mode 100644 index 0000000..470811d --- /dev/null +++ b/deprecated/rootiest.lua @@ -0,0 +1,55 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ Deprecated Functions │ +-- ╰─────────────────────────────────────────────────────────╯ + +local M = {} + +local trigger_error = require('config.rootiest').trigger_error + +--- Toggle LazyGit terminal split +---@param direction string|nil The direction of the terminal split (default: "horizontal") +---@param size number|nil The size of the terminal split (default: 0.3) +---@return boolean condition true if the terminal was toggled, false otherwise +function M.toggle_lazygit_term(direction, size) + if pcall(require, 'toggleterm.terminal') then + local Terminal = require('toggleterm.terminal').Terminal + local lazygit = Terminal:new({ + cmd = 'lazygit', + hidden = true, + direction = direction or 'horizontal', -- Set direction to horizontal split + size = size or 0.3, -- Set size to 30% of the screen + }) + lazygit:toggle() + return true + else + trigger_error('toggleterm plugin is not installed') + return false + end +end + +--- Toggle LazyGit floating terminal +---@param my_args string|nil The arguments to pass to the lazygit command (default: nil) +---@return boolean condition true if the terminal was toggled, false otherwise +function M.toggle_lazygit_float(my_args) + if pcall(require, 'toggleterm.terminal') then + local Util = require('lazyvim.util') + my_args = my_args or nil + if my_args ~= '' or my_args ~= nil then + Util.terminal.open( + { 'lazygit', my_args }, + { cwd = Util.root(), interactive = true, esc_esc = false } + ) + else + Util.terminal.open( + { 'lazygit' }, + { cwd = Util.root(), interactive = true, esc_esc = false } + ) + end + return true + else + trigger_error('toggleterm plugin is not installed') + return false + end +end + +return M diff --git a/lua/config/rootiest.lua b/lua/config/rootiest.lua index 234ff0f..3a1ea48 100644 --- a/lua/config/rootiest.lua +++ b/lua/config/rootiest.lua @@ -58,52 +58,6 @@ function M.toggle_hardmode() end end ---- Toggle LazyGit terminal split ----@param direction string|nil The direction of the terminal split (default: "horizontal") ----@param size number|nil The size of the terminal split (default: 0.3) ----@return boolean condition true if the terminal was toggled, false otherwise -function M.toggle_lazygit_term(direction, size) - if pcall(require, 'toggleterm.terminal') then - local Terminal = require('toggleterm.terminal').Terminal - local lazygit = Terminal:new({ - cmd = 'lazygit', - hidden = true, - direction = direction or 'horizontal', -- Set direction to horizontal split - size = size or 0.3, -- Set size to 30% of the screen - }) - lazygit:toggle() - return true - else - trigger_error('toggleterm plugin is not installed') - return false - end -end - ---- Toggle LazyGit floating terminal ----@param my_args string|nil The arguments to pass to the lazygit command (default: nil) ----@return boolean condition true if the terminal was toggled, false otherwise -function M.toggle_lazygit_float(my_args) - if pcall(require, 'toggleterm.terminal') then - local Util = require('lazyvim.util') - my_args = my_args or nil - if my_args ~= '' or my_args ~= nil then - Util.terminal.open( - { 'lazygit', my_args }, - { cwd = Util.root(), interactive = true, esc_esc = false } - ) - else - Util.terminal.open( - { 'lazygit' }, - { cwd = Util.root(), interactive = true, esc_esc = false } - ) - end - return true - else - trigger_error('toggleterm plugin is not installed') - return false - end -end - --- Load remote-nvim plugin ---@return boolean condition true if the plugin was loaded, false otherwise function M.load_remote() @@ -185,10 +139,14 @@ end --- Set up rootiest module function M.setup() + -- Setup OS variables setup_os_vars() + -- Setup neovide M.eval_neovide() + -- Define user commands M.define_commands() - + -- Setup vimscripts + require('data.vim').setup() -- Setup types data require('data.types').setup() -- Setup indentor