fix commenting

This commit is contained in:
Michael Peters 2022-10-24 20:52:52 -07:00
parent 3575007c7b
commit 37e1008906
2 changed files with 7 additions and 17 deletions

View File

@ -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

View File

@ -165,7 +165,11 @@ packer.startup {
use { 'windwp/nvim-autopairs', config = function() require'configs.autopairs'.config() end }
-- Commenting
use { 'numToStr/Comment.nvim', config = function() require'configs.comment'.config() end }
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 }