enc: update config

This commit is contained in:
asep.komarudin 2024-04-12 12:13:19 +07:00
parent 1af3d78e3c
commit eacf0b67e9
2 changed files with 63 additions and 98 deletions

View file

@ -23,7 +23,7 @@
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" }, "noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" },
"none-ls-extras.nvim": { "branch": "main", "commit": "f0746bf4f1a21d6e1d2002f671fb9b46d2146de7" }, "none-ls-extras.nvim": { "branch": "main", "commit": "f0746bf4f1a21d6e1d2002f671fb9b46d2146de7" },
"none-ls.nvim": { "branch": "main", "commit": "dca7ddec321a102ec9e792b1b29193702aff5fbb" }, "none-ls.nvim": { "branch": "main", "commit": "09a7c58e9283dda582d9805f6b182b5b9f137ec7" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },

View file

@ -65,67 +65,68 @@ return {
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`, -- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()` -- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
-- require("ufo").setup({ --[[require("ufo").setup({
-- -- provider_selector = function(bufnr, filetype, buftype) -- provider_selector = function(bufnr, filetype, buftype)
-- -- return { "treesitter", "indent" } -- return { "treesitter", "indent" }
-- -- end, -- end,
-- open_fold_hl_timeout = 150, open_fold_hl_timeout = 150,
-- close_fold_kinds_for_ft = { close_fold_kinds_for_ft = {
-- default = { "imports", "comment" }, default = { "imports", "comment" },
-- json = { "array" }, json = { "array" },
-- c = { "comment", "region" }, c = { "comment", "region" },
-- }, },
-- preview = { preview = {
-- win_config = { win_config = {
-- border = { "", "─", "", "", "", "─", "", "" }, border = { "", "", "", "", "", "", "", "" },
-- -- winhighlight = 'Normal:Normal', -- winhighlight = 'Normal:Normal',
-- -- winhighlight = 'IncSearch:Folded', -- winhighlight = 'IncSearch:Folded',
-- winhighlight = "Normal:UfoPreviewNormal,FloatBorder:UfoPreviewBorder,CursorLine:UfoPreviewCursorLine", winhighlight = "Normal:UfoPreviewNormal,FloatBorder:UfoPreviewBorder,CursorLine:UfoPreviewCursorLine",
-- winblend = 0, winblend = 0,
-- }, },
-- mappings = { mappings = {
-- scrollU = "<C-u>", scrollU = "<C-u>",
-- scrollD = "<C-d>", scrollD = "<C-d>",
-- jumpTop = "[", jumpTop = "[",
-- jumpBot = "]", jumpBot = "]",
-- }, },
-- }, },
-- provider_selector = function(_, filetype) provider_selector = function(_, filetype)
-- return { "treesitter", "indent" } return { "treesitter", "indent" }
-- end, end,
-- fold_virt_text_handler = function(virt_text, lnum, end_lnum, width, truncate) fold_virt_text_handler = function(virt_text, lnum, end_lnum, width, truncate)
-- local result = {} local result = {}
-- local _end = end_lnum - 1 local _end = end_lnum - 1
-- local final_text = vim.trim(vim.api.nvim_buf_get_text(0, _end, 0, _end, -1, {})[1]) local final_text = vim.trim(vim.api.nvim_buf_get_text(0, _end, 0, _end, -1, {})[1])
-- local suffix = final_text:format(end_lnum - lnum) local suffix = final_text:format(end_lnum - lnum)
-- local suffix_width = vim.fn.strdisplaywidth(suffix) local suffix_width = vim.fn.strdisplaywidth(suffix)
-- local target_width = width - suffix_width local target_width = width - suffix_width
-- local cur_width = 0 local cur_width = 0
-- for _, chunk in ipairs(virt_text) do for _, chunk in ipairs(virt_text) do
-- local chunk_text = chunk[1] local chunk_text = chunk[1]
-- local chunk_width = vim.fn.strdisplaywidth(chunk_text) local chunk_width = vim.fn.strdisplaywidth(chunk_text)
-- if target_width > cur_width + chunk_width then if target_width > cur_width + chunk_width then
-- table.insert(result, chunk) table.insert(result, chunk)
-- else else
-- chunk_text = truncate(chunk_text, target_width - cur_width) chunk_text = truncate(chunk_text, target_width - cur_width)
-- local hl_group = chunk[2] local hl_group = chunk[2]
-- table.insert(result, { chunk_text, hl_group }) table.insert(result, { chunk_text, hl_group })
-- chunk_width = vim.fn.strdisplaywidth(chunk_text) chunk_width = vim.fn.strdisplaywidth(chunk_text)
-- -- str width returned from truncate() may less than 2nd argument, need padding -- str width returned from truncate() may less than 2nd argument, need padding
-- if cur_width + chunk_width < target_width then if cur_width + chunk_width < target_width then
-- suffix = suffix .. (" "):rep(target_width - cur_width - chunk_width) suffix = suffix .. (" "):rep(target_width - cur_width - chunk_width)
-- end end
-- break break
-- end end
-- cur_width = cur_width + chunk_width cur_width = cur_width + chunk_width
-- end end
-- table.insert(result, { " ⋯ ", "NonText" }) table.insert(result, { "", "NonText" })
-- if vim.bo.filetype ~= "json" then if vim.bo.filetype ~= "json" then
-- table.insert(result, { suffix, "TSPunctBracket" }) table.insert(result, { suffix, "TSPunctBracket" })
-- end end
-- return result return result
-- end, end,
-- }) })]]
--
-- start ini bagian code support comment dan import -- start ini bagian code support comment dan import
local ftMap = { local ftMap = {
@ -160,42 +161,6 @@ return {
-- refer to ./doc/example.lua for detail -- refer to ./doc/example.lua for detail
end, end,
fold_virt_text_handler = function(virt_text, lnum, end_lnum, width, truncate)
local result = {}
local _end = end_lnum - 1
local final_text = vim.trim(vim.api.nvim_buf_get_text(0, _end, 0, _end, -1, {})[1])
local suffix = final_text:format(end_lnum - lnum)
local suffix_width = vim.fn.strdisplaywidth(suffix)
local target_width = width - suffix_width
local cur_width = 0
for _, chunk in ipairs(virt_text) do
local chunk_text = chunk[1]
local chunk_width = vim.fn.strdisplaywidth(chunk_text)
if target_width > cur_width + chunk_width then
table.insert(result, chunk)
else
chunk_text = truncate(chunk_text, target_width - cur_width)
local hl_group = chunk[2]
table.insert(result, { chunk_text, hl_group })
chunk_width = vim.fn.strdisplaywidth(chunk_text)
-- str width returned from truncate() may less than 2nd argument, need padding
if cur_width + chunk_width < target_width then
suffix = suffix .. (" "):rep(target_width - cur_width - chunk_width)
end
break
end
cur_width = cur_width + chunk_width
end
table.insert(result, { "", "NonText" })
if string.match(virt_text[1][1], "import") then
return result
end
if vim.bo.filetype ~= "json" then
table.insert(result, { suffix, "TSPunctBracket" })
end
return result
end,
}) })
-- end bagian code support comment dan import -- end bagian code support comment dan import
end, end,