From 530852f89ba6ce37b0d79c9d78f5f3ffe54894e0 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Tue, 27 Aug 2024 11:42:13 +0300 Subject: [PATCH] neovim: update jsx commentstring --- neovim/.config/nvim/after/plugin/comment.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neovim/.config/nvim/after/plugin/comment.lua b/neovim/.config/nvim/after/plugin/comment.lua index 43d7c6f..d6433ad 100644 --- a/neovim/.config/nvim/after/plugin/comment.lua +++ b/neovim/.config/nvim/after/plugin/comment.lua @@ -5,10 +5,17 @@ local ctype_to_commentstring = { [U.ctype.blockwise] = "__multiline", } +local jsx_filetypes = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", +} + require("Comment").setup({ pre_hook = function(ctx) -- Only calculate commentstring for tsx filetypes - if vim.bo.filetype == "typescriptreact" or vim.bo.filetype == "javascriptreact" then + if vim.list_contains(jsx_filetypes, vim.bo.filetype) then -- Detemine whether to use linewise or blockwise commentstring local type = ctype_to_commentstring[ctx.ctype]