diff options
| author | opalmay <[email protected]> | 2023-02-11 19:43:38 +0200 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-11 19:43:38 +0200 | 
| commit | fde46c4b163dfeb51407efdc2929cfc723fd15c6 (patch) | |
| tree | 938bd912243375db133124bbb1f2c874ec876599 /lua | |
| parent | baf71343f024ce867292c1c9dc3674ca0a100774 (diff) | |
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`
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lvim/core/terminal.lua | 9 | ||||
| -rw-r--r-- | lua/lvim/plugins.lua | 13 | 
2 files changed, 17 insertions, 5 deletions
diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 663ba77a..45495322 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -77,10 +77,7 @@ local function get_dynamic_terminal_size(direction, size)    end  end -M.setup = function() -  local terminal = require "toggleterm" -  terminal.setup(lvim.builtin.terminal) - +M.init = function()    for i, exec in pairs(lvim.builtin.terminal.execs) do      local direction = exec[4] or lvim.builtin.terminal.direction @@ -98,7 +95,11 @@ M.setup = function()      M.add_exec(opts)    end +end +M.setup = function() +  local terminal = require "toggleterm" +  terminal.setup(lvim.builtin.terminal)    if lvim.builtin.terminal.on_config_done then      lvim.builtin.terminal.on_config_done(terminal)    end diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index a1ed58f1..61aeb221 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -280,11 +280,22 @@ local core_plugins = {    -- Terminal    {      "akinsho/toggleterm.nvim", -    event = "VeryLazy",      branch = "main", +    init = function() +      require("lvim.core.terminal").init() +    end,      config = function()        require("lvim.core.terminal").setup()      end, +    cmd = { +      "ToggleTerm", +      "TermExec", +      "ToggleTermToggleAll", +      "ToggleTermSendCurrentLine", +      "ToggleTermSendVisualLines", +      "ToggleTermSendVisualSelection", +    }, +    keys = lvim.builtin.terminal.open_mapping,      enabled = lvim.builtin.terminal.active,    },  | 
