mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
perf(toggleterm): on-demand lazy load (#3811)
* perf(toggleterm): on-demand lazy load * fix: keys * fix: move setup, on_config_done (for terminal obj) * fix: add some cmds * refactor: remove redundant `lazy = true`
This commit is contained in:
parent
baf71343f0
commit
fde46c4b16
2 changed files with 17 additions and 5 deletions
|
@ -77,10 +77,7 @@ local function get_dynamic_terminal_size(direction, size)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.setup = function()
|
M.init = function()
|
||||||
local terminal = require "toggleterm"
|
|
||||||
terminal.setup(lvim.builtin.terminal)
|
|
||||||
|
|
||||||
for i, exec in pairs(lvim.builtin.terminal.execs) do
|
for i, exec in pairs(lvim.builtin.terminal.execs) do
|
||||||
local direction = exec[4] or lvim.builtin.terminal.direction
|
local direction = exec[4] or lvim.builtin.terminal.direction
|
||||||
|
|
||||||
|
@ -98,7 +95,11 @@ M.setup = function()
|
||||||
|
|
||||||
M.add_exec(opts)
|
M.add_exec(opts)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup = function()
|
||||||
|
local terminal = require "toggleterm"
|
||||||
|
terminal.setup(lvim.builtin.terminal)
|
||||||
if lvim.builtin.terminal.on_config_done then
|
if lvim.builtin.terminal.on_config_done then
|
||||||
lvim.builtin.terminal.on_config_done(terminal)
|
lvim.builtin.terminal.on_config_done(terminal)
|
||||||
end
|
end
|
||||||
|
|
|
@ -280,11 +280,22 @@ local core_plugins = {
|
||||||
-- Terminal
|
-- Terminal
|
||||||
{
|
{
|
||||||
"akinsho/toggleterm.nvim",
|
"akinsho/toggleterm.nvim",
|
||||||
event = "VeryLazy",
|
|
||||||
branch = "main",
|
branch = "main",
|
||||||
|
init = function()
|
||||||
|
require("lvim.core.terminal").init()
|
||||||
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
require("lvim.core.terminal").setup()
|
require("lvim.core.terminal").setup()
|
||||||
end,
|
end,
|
||||||
|
cmd = {
|
||||||
|
"ToggleTerm",
|
||||||
|
"TermExec",
|
||||||
|
"ToggleTermToggleAll",
|
||||||
|
"ToggleTermSendCurrentLine",
|
||||||
|
"ToggleTermSendVisualLines",
|
||||||
|
"ToggleTermSendVisualSelection",
|
||||||
|
},
|
||||||
|
keys = lvim.builtin.terminal.open_mapping,
|
||||||
enabled = lvim.builtin.terminal.active,
|
enabled = lvim.builtin.terminal.active,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue