diff --git a/lua/configs/comment.lua b/lua/configs/comment.lua index a4e4ef9..a183888 100644 --- a/lua/configs/comment.lua +++ b/lua/configs/comment.lua @@ -7,21 +7,7 @@ function M.config() end comment.setup { - pre_hook = function(ctx) - local U = require "Comment.utils" - - local location = nil - if ctx.ctype == U.ctype.block then - location = require("ts_context_commentstring.utils").get_cursor_location() - elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then - location = require("ts_context_commentstring.utils").get_visual_start_location() - end - - return require("ts_context_commentstring.internal").calculate_commentstring { - key = ctx.ctype == U.ctype.line and "__default" or "__multiline", - location = location, - } - end, + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), padding = true, sticky = true, ignore = '^$', -- Don't comment empty lines diff --git a/lua/plugins.lua b/lua/plugins.lua index cdbbcd8..9088831 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -164,8 +164,12 @@ packer.startup { -- Autopairs use { 'windwp/nvim-autopairs', config = function() require'configs.autopairs'.config() end } - -- Commenting - use { 'numToStr/Comment.nvim', config = function() require'configs.comment'.config() end } + -- Commenting + use { + 'numToStr/Comment.nvim', + config = function() require'configs.comment'.config() end, + after = 'nvim-ts-context-commentstring' + } -- Automatically colorize color strings (#f1b8f1) use { 'norcalli/nvim-colorizer.lua', config = function() require'configs.colorizer'.config() end }