neovim: fix commentstring
This commit is contained in:
@@ -1,12 +1,16 @@
|
|||||||
|
local U = require("Comment.utils")
|
||||||
|
|
||||||
|
local ctype_to_commentstring = {
|
||||||
|
[U.ctype.linewise] = "__default",
|
||||||
|
[U.ctype.blockwise] = "__multiline",
|
||||||
|
}
|
||||||
|
|
||||||
require("Comment").setup({
|
require("Comment").setup({
|
||||||
pre_hook = function(ctx)
|
pre_hook = function(ctx)
|
||||||
-- Only calculate commentstring for tsx filetypes
|
-- Only calculate commentstring for tsx filetypes
|
||||||
if vim.bo.filetype == "typescriptreact" or vim.bo.filetype == "javascriptreact" then
|
if vim.bo.filetype == "typescriptreact" or vim.bo.filetype == "javascriptreact" then
|
||||||
local U = require("Comment.utils")
|
|
||||||
|
|
||||||
-- Detemine whether to use linewise or blockwise commentstring
|
-- Detemine whether to use linewise or blockwise commentstring
|
||||||
-- local type = ctx.ctype == U.ctype.line and "__default" or "__multiline"
|
local type = ctype_to_commentstring[ctx.ctype]
|
||||||
local type = "__default"
|
|
||||||
|
|
||||||
-- Determine the location where to calculate commentstring from
|
-- Determine the location where to calculate commentstring from
|
||||||
local location = nil
|
local location = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user