add: nvim fold config

This commit is contained in:
asep.komarudin 2024-03-29 16:33:42 +07:00
parent 5518885b31
commit e2ba1a6fb2
5 changed files with 160 additions and 102 deletions

View file

@ -15,7 +15,7 @@
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "65887ea871d44822bff47504202b3643f29d614e" }, "lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
"lsp-progress.nvim": { "branch": "main", "commit": "1c37b1cd0611563a767f0a340d61f265c4c54ecd" }, "lsp-progress.nvim": { "branch": "main", "commit": "1c37b1cd0611563a767f0a340d61f265c4c54ecd" },
"lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, "lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2ba17cecfde8b8c7c7c287909a1e4de895223df6" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "2ba17cecfde8b8c7c7c287909a1e4de895223df6" },
@ -25,7 +25,7 @@
"mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" },
"neoscroll.nvim": { "branch": "master", "commit": "21d52973bde32db998fc8b6590f87eb3c3c6d8e4" }, "neoscroll.nvim": { "branch": "master", "commit": "21d52973bde32db998fc8b6590f87eb3c3c6d8e4" },
"noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" }, "noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" },
"none-ls-extras.nvim": { "branch": "main", "commit": "4f6ba0c4a317a630157bc02fad110fcd826e9494" }, "none-ls-extras.nvim": { "branch": "main", "commit": "4d1b26b963edb82c45ed261d988f9e72253c3469" },
"none-ls.nvim": { "branch": "main", "commit": "18910d09d21d7df339805343bfe4a2b2e41c057b" }, "none-ls.nvim": { "branch": "main", "commit": "18910d09d21d7df339805343bfe4a2b2e41c057b" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" }, "nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
@ -53,5 +53,6 @@
"vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" },
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
"vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" }, "vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" },
"which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" } "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },
"yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" }
} }

View file

@ -1,95 +1,95 @@
return { return {
-- { -- {
-- "navarasu/onedark.nvim", -- "navarasu/onedark.nvim",
-- enabled = false, -- enabled = false,
-- }, -- },
-- { -- {
-- "projekt0n/github-nvim-theme", -- "projekt0n/github-nvim-theme",
-- lazy = false, -- make sure we load this during startup if it is your main colorscheme -- lazy = false, -- make sure we load this during startup if it is your main colorscheme
-- priority = 1000, -- make sure to load this before all the other start plugins -- priority = 1000, -- make sure to load this before all the other start plugins
-- config = function() -- config = function()
-- local is_transparent = false -- local is_transparent = false
-- local palette = require("github-theme.palette").load("github_dark_dimmed") -- local palette = require("github-theme.palette").load("github_dark_dimmed")
-- require("github-theme").setup({ -- require("github-theme").setup({
-- options = { -- options = {
-- -- Compiled file's destination location -- -- Compiled file's destination location
-- compile_path = vim.fn.stdpath("cache") .. "/github-theme", -- compile_path = vim.fn.stdpath("cache") .. "/github-theme",
-- compile_file_suffix = "_compiled", -- Compiled file suffix -- compile_file_suffix = "_compiled", -- Compiled file suffix
-- hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look -- hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look
-- hide_nc_statusline = true, -- Override the underline style for non-active statuslines -- hide_nc_statusline = true, -- Override the underline style for non-active statuslines
-- transparent = is_transparent, -- Disable setting background -- transparent = is_transparent, -- Disable setting background
-- terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` -- terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
-- dim_inactive = false, -- Non focused panes set to alternative background -- dim_inactive = false, -- Non focused panes set to alternative background
-- module_default = true, -- Default enable value for modules -- module_default = true, -- Default enable value for modules
-- styles = { -- Style to be applied to different syntax groups -- styles = { -- Style to be applied to different syntax groups
-- comments = "italic", -- Value is any valid attr-list value `:help attr-list` -- comments = "italic", -- Value is any valid attr-list value `:help attr-list`
-- functions = "italic", -- functions = "italic",
-- keywords = "NONE", -- keywords = "NONE",
-- variables = "NONE", -- variables = "NONE",
-- conditionals = "NONE", -- conditionals = "NONE",
-- constants = "NONE", -- constants = "NONE",
-- numbers = "NONE", -- numbers = "NONE",
-- operators = "NONE", -- operators = "NONE",
-- strings = "NONE", -- strings = "NONE",
-- types = "NONE", -- types = "NONE",
-- }, -- },
-- inverse = { -- Inverse highlight for different types -- inverse = { -- Inverse highlight for different types
-- match_paren = false, -- match_paren = false,
-- visual = false, -- visual = false,
-- search = false, -- search = false,
-- }, -- },
-- darken = { -- Darken floating windows and sidebar-like windows -- darken = { -- Darken floating windows and sidebar-like windows
-- floats = false, -- floats = false,
-- sidebars = { -- sidebars = {
-- enabled = true, -- enabled = true,
-- list = {}, -- Apply dark background to specific windows -- list = {}, -- Apply dark background to specific windows
-- }, -- },
-- }, -- },
-- modules = { -- List of various plugins and additional options -- modules = { -- List of various plugins and additional options
-- -- ... -- -- ...
-- }, -- },
-- }, -- },
-- palettes = { -- palettes = {
-- github_dark_dimmed = { -- github_dark_dimmed = {
-- bg0 = is_transparent and "NONE" or "bg1", -- bg0 = is_transparent and "NONE" or "bg1",
-- bg1 = is_transparent and "NONE" or "bg", -- bg1 = is_transparent and "NONE" or "bg",
-- }, -- },
-- }, -- },
-- specs = {}, -- specs = {},
-- groups = { -- groups = {
-- all = { -- all = {
-- illuminatedWord = { bg = "#3b4261" }, -- illuminatedWord = { bg = "#3b4261" },
-- illuminatedCurWord = { bg = "#3b4261" }, -- illuminatedCurWord = { bg = "#3b4261" },
-- IlluminatedWordText = { bg = "#3b4261" }, -- IlluminatedWordText = { bg = "#3b4261" },
-- IlluminatedWordRead = { bg = "#3b4261" }, -- IlluminatedWordRead = { bg = "#3b4261" },
-- IlluminatedWordWrite = { bg = "#3b4261" }, -- IlluminatedWordWrite = { bg = "#3b4261" },
-- ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" }, -- ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" },
-- ["@text.uri"] = { fg = palette.const, style = "italic" }, -- ["@text.uri"] = { fg = palette.const, style = "italic" },
-- -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" }, -- -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" },
-- -- ["@operator.html"] = { fg = "#faa356" }, -- -- ["@operator.html"] = { fg = "#faa356" },
-- -- ["@tag.html"] = { fg = "#fa7970" }, -- -- ["@tag.html"] = { fg = "#fa7970" },
-- -- ["@tag.delimiter.html"] = { fg = "#faa356" }, -- -- ["@tag.delimiter.html"] = { fg = "#faa356" },
-- }, -- },
-- github_dark_high_contrast = { -- github_dark_high_contrast = {
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, -- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
-- }, -- },
-- github_dark_dimmed = { -- github_dark_dimmed = {
-- -- As with specs and palettes, a specific style's value will be used over the `all`'s value. -- -- As with specs and palettes, a specific style's value will be used over the `all`'s value.
-- NvimTreeNormal = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, -- NvimTreeNormal = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" },
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, -- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
-- BufferLineFill = { bg = is_transparent and "NONE" or "bg1" }, -- BufferLineFill = { bg = is_transparent and "NONE" or "bg1" },
-- BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" }, -- BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" },
-- LualineNormal = { bg = is_transparent and "NONE" or "bg1" }, -- LualineNormal = { bg = is_transparent and "NONE" or "bg1" },
-- StatusLine = { bg = is_transparent and "NONE" or "bg1" }, -- StatusLine = { bg = is_transparent and "NONE" or "bg1" },
-- StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" }, -- StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" },
-- Pmenu = { bg = is_transparent and "NONE" or "bg1" }, -- Pmenu = { bg = is_transparent and "NONE" or "bg1" },
-- PmenuSel = { link = "CursorLine" }, -- PmenuSel = { link = "CursorLine" },
-- WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" }, -- WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" },
-- LazyNormal = { bg = is_transparent and "NONE" or "bg1" }, -- LazyNormal = { bg = is_transparent and "NONE" or "bg1" },
-- LazyBackground = { bg = is_transparent and "NONE" or "bg1" }, -- LazyBackground = { bg = is_transparent and "NONE" or "bg1" },
-- }, -- },
-- }, -- },
-- }) -- })
-- end, -- end,
-- }, -- },
} }

View file

@ -41,13 +41,13 @@ return {
"hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lua",
enabled = false, enabled = false,
}, },
-- { {
-- "gbprod/yanky.nvim", "gbprod/yanky.nvim",
-- event = "InsertEnter", event = "BufReadPre",
-- config = function() config = function()
-- require("user.yanky") require("user.yanky")
-- end, end,
-- }, },
-- { -- {
-- "is0n/jaq-nvim", -- "is0n/jaq-nvim",
-- event = "BufRead", -- event = "BufRead",

View file

@ -7,10 +7,21 @@ return {
config = function() config = function()
local builtin = require("statuscol.builtin") local builtin = require("statuscol.builtin")
require("statuscol").setup({ require("statuscol").setup({
-- relculright = true,
-- segments = {
-- { text = { builtin.foldfunc }, click = "v:lua.ScFa" },
-- { text = { "%s" }, click = "v:lua.ScSa" },
-- { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
-- },
setopt = true,
relculright = true, relculright = true,
segments = { segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{ text = { "%s" }, click = "v:lua.ScSa" }, { text = { "%s" }, click = "v:lua.ScSa" },
{
text = { builtin.foldfunc },
condition = { builtin.not_empty, true, builtin.not_empty },
click = "v:lua.ScFa",
},
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
}, },
}) })
@ -24,6 +35,7 @@ return {
vim.o.foldlevelstart = 99 vim.o.foldlevelstart = 99
vim.o.foldenable = true vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
-- vim.o.fillchars = [[eob: ,fold: ,foldopen:▼,foldsep: ,foldclose:⏵]]
-- these are "extra", change them as you like -- these are "extra", change them as you like
vim.keymap.set("n", "zR", require("ufo").openAllFolds) vim.keymap.set("n", "zR", require("ufo").openAllFolds)
@ -33,9 +45,43 @@ 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" }
-- end,
open_fold_hl_timeout = 0,
provider_selector = function(_, filetype)
return { "treesitter", "indent" } return { "treesitter", "indent" }
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" })
table.insert(result, { suffix, "TSPunctBracket" })
return result
end,
}) })
end, end,
} }

View file

@ -215,7 +215,17 @@ end
return { return {
-- color scheme -- color scheme
{ "luisiacc/gruvbox-baby", lazy = true, enabled = gruvbox }, {
"luisiacc/gruvbox-baby",
lazy = true,
enabled = gruvbox,
config = function()
local colors = require("gruvbox-baby.colors").config()
vim.g.gruvbox_baby_highlights = {
StatusLine = { fg = colors.fg, bg = "NONE" },
}
end,
},
{ {
"Mofiqul/dracula.nvim", "Mofiqul/dracula.nvim",
enabled = dracula, enabled = dracula,
@ -368,6 +378,7 @@ return {
variables = "none", variables = "none",
}, },
highlights = { highlights = {
Search = { fg = "$bg0", bg = "$bg_yellow" },
-- BorderBG = { fg = "#333842" }, -- untuk custom brder color cmp -- BorderBG = { fg = "#333842" }, -- untuk custom brder color cmp
-- overide indent line fill color -- overide indent line fill color
NvimTreeNormal = { fg = "$fg", bg = "$bg0" }, NvimTreeNormal = { fg = "$fg", bg = "$bg0" },