chore: clean up previous lazygit implementations from config

This commit is contained in:
2024-11-24 03:17:10 -05:00
parent ea017acd0f
commit c99db3c038
2 changed files with 60 additions and 47 deletions
+55
View File
@@ -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
+5 -47
View File
@@ -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