diff options
author | LostNeophyte <[email protected]> | 2023-01-18 14:21:31 +0100 |
---|---|---|
committer | opalmay <[email protected]> | 2023-01-20 23:52:10 +0200 |
commit | 74bd5e16aa2a9dc4bd751618982fcd6cfba3a036 (patch) | |
tree | ac67ecf269cbfb93a008a6279b93a212a334b618 /lua/lvim/core/comment.lua | |
parent | 2d3140f0d7497cc8352190b2fd4737a7a3420a68 (diff) |
perf: lazy load most plugins
Diffstat (limited to 'lua/lvim/core/comment.lua')
-rw-r--r-- | lua/lvim/core/comment.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lua/lvim/core/comment.lua b/lua/lvim/core/comment.lua index 501d01b6..f07929c7 100644 --- a/lua/lvim/core/comment.lua +++ b/lua/lvim/core/comment.lua @@ -1,11 +1,6 @@ local M = {} function M.config() - local pre_hook - local loaded, ts_comment = pcall(require, "ts_context_commentstring.integrations.comment_nvim") - if loaded and ts_comment then - pre_hook = ts_comment.create_pre_hook() - end lvim.builtin.comment = { active = true, on_config_done = nil, @@ -66,7 +61,12 @@ function M.config() ---Pre-hook, called before commenting the line ---@type function|nil - pre_hook = pre_hook, + pre_hook = function(...) + local loaded, ts_comment = pcall(require, "ts_context_commentstring.integrations.comment_nvim") + if loaded and ts_comment then + return ts_comment.create_pre_hook()(...) + end + end, ---Post-hook, called after commenting is done ---@type function|nil |