refactor(deprecated): remove old deprecated configs
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
--- @module "config.profile"
|
||||
--- This module configures the profiler for the Neovim configuration.
|
||||
--- This tool can be used to profile specific modules or all modules.
|
||||
---
|
||||
--- The profiler can be toggled with the leader keybinding `d<f1>`
|
||||
--- or with the `NVIM_PROFILE` environment variable.
|
||||
---
|
||||
--- Specific modules can be selected with the `NVIM_PROFILE_MODULE`
|
||||
--- environment variable.
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ PROFILER │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- Check if the environment variable is set
|
||||
local should_profile = os.getenv('NVIM_PROFILE')
|
||||
local profile_module = os.getenv('NVIM_PROFILE_MODULE') or '*'
|
||||
|
||||
-- Start the profiler
|
||||
if should_profile then
|
||||
require('profile').instrument_autocmds()
|
||||
if should_profile:lower():match('^start') then
|
||||
require('profile').start(profile_module)
|
||||
else
|
||||
require('profile').instrument(profile_module)
|
||||
end
|
||||
end
|
||||
|
||||
-- Function to toggle the profiler
|
||||
local function toggle_profile()
|
||||
local prof = require('profile')
|
||||
if prof.is_recording() then
|
||||
prof.stop()
|
||||
vim.ui.input({
|
||||
prompt = 'Save profile to:',
|
||||
completion = 'file',
|
||||
default = 'profile.json',
|
||||
}, function(filename)
|
||||
if filename then
|
||||
prof.export(filename)
|
||||
vim.notify(string.format('Wrote %s', filename))
|
||||
end
|
||||
end)
|
||||
else
|
||||
prof.start(profile_module)
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the keybind to toggle the profiler
|
||||
require('data').func.add_keymap('<leader>d<f1>', function()
|
||||
local prof_name = profile_module
|
||||
if profile_module == '*' then
|
||||
prof_name = 'all'
|
||||
end
|
||||
print('Profiling module: ' .. prof_name)
|
||||
toggle_profile()
|
||||
end, 'Toggle Profiler')
|
||||
@@ -1,55 +0,0 @@
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ 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
|
||||
Reference in New Issue
Block a user