add: update config

This commit is contained in:
asep.komarudin 2024-04-12 23:26:42 +07:00
parent e9f5251e68
commit b616038b19

View file

@ -143,8 +143,8 @@ return {
vim = "indent", vim = "indent",
python = { "indent" }, python = { "indent" },
git = "", git = "",
javascriptreact = { "treesitter", "indent" }, -- javascriptreact = { "treesitter", "indent" },
typescriptreact = { "treesitter", "indent" }, -- typescriptreact = { "treesitter", "indent" },
} }
local function customizeSelector(bufnr) local function customizeSelector(bufnr)
@ -201,6 +201,7 @@ return {
local import_fold_text = "import ..." -- Teks yang ingin ditampilkan local import_fold_text = "import ..." -- Teks yang ingin ditampilkan
local is_comment = false -- Variabel untuk mengecek apakah ini komentar local is_comment = false -- Variabel untuk mengecek apakah ini komentar
local is_import = false local is_import = false
local is_bracket = false
-- Memeriksa apakah baris awal dari fold adalah komentar -- Memeriksa apakah baris awal dari fold adalah komentar
local start_line = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1] local start_line = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1]
@ -214,6 +215,9 @@ return {
if start_line:find("^%s*import") then if start_line:find("^%s*import") then
is_import = true is_import = true
end end
if start_line:find("%s*{") then
is_bracket = true
end
if is_comment then if is_comment then
local suffix = string.format(" %s ", closed_fold_text) local suffix = string.format(" %s ", closed_fold_text)
local target_width = width - vim.fn.strdisplaywidth(suffix) local target_width = width - vim.fn.strdisplaywidth(suffix)
@ -311,7 +315,7 @@ return {
end end
table.insert(result, { "", "NonText" }) table.insert(result, { "", "NonText" })
local l = { "javascriptreact", "typescriptreact" } local l = { "javascriptreact", "typescriptreact" }
if TABLE_CONTAINS(l, vim.bo.filetype) then if TABLE_CONTAINS(l, vim.bo.filetype) and not is_bracket then
table.insert(result, { suffix, "TSPunctBracket" }) table.insert(result, { suffix, "TSPunctBracket" })
end end
end end