mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-23 09:18:44 +02:00
fix nvim fold for jsx
This commit is contained in:
parent
00fb75edef
commit
0c18ab04c8
1 changed files with 7 additions and 2 deletions
|
@ -205,17 +205,22 @@ return {
|
||||||
|
|
||||||
-- 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]
|
||||||
if start_line:find("^%s*%/%*") then -- Regex untuk mengecek komentar javascript
|
-- cari comentar dengan awalan /* untuk generaal comment
|
||||||
|
if start_line:find("^%s*%/%*") then
|
||||||
is_comment = true
|
is_comment = true
|
||||||
|
-- cara commentar dengan awalan <!-- untuk html
|
||||||
elseif start_line:find("^%s*<!--") then
|
elseif start_line:find("^%s*<!--") then
|
||||||
is_comment = true
|
is_comment = true
|
||||||
|
-- cari comentar dengan awalan -- untuk lua
|
||||||
elseif start_line:find("^%s*%-%-") then
|
elseif start_line:find("^%s*%-%-") then
|
||||||
is_comment = true
|
is_comment = true
|
||||||
end
|
end
|
||||||
|
-- cek fold yang berawalan import
|
||||||
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
|
-- cek fold dengan akhiran {
|
||||||
|
if start_line:find("%s*{%s*$") then
|
||||||
is_bracket = true
|
is_bracket = true
|
||||||
end
|
end
|
||||||
if is_comment then
|
if is_comment then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue