summaryrefslogtreecommitdiff
path: root/lua/lvim/core/comment.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lvim/core/comment.lua')
-rw-r--r--lua/lvim/core/comment.lua12
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