mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-23 01:08:53 +02:00
add: nvim fold config
This commit is contained in:
parent
5518885b31
commit
e2ba1a6fb2
5 changed files with 160 additions and 102 deletions
|
@ -1,95 +1,95 @@
|
|||
return {
|
||||
-- {
|
||||
-- "navarasu/onedark.nvim",
|
||||
-- enabled = false,
|
||||
-- "navarasu/onedark.nvim",
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- {
|
||||
-- "projekt0n/github-nvim-theme",
|
||||
-- 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
|
||||
-- config = function()
|
||||
-- local is_transparent = false
|
||||
-- local palette = require("github-theme.palette").load("github_dark_dimmed")
|
||||
-- require("github-theme").setup({
|
||||
-- options = {
|
||||
-- -- Compiled file's destination location
|
||||
-- compile_path = vim.fn.stdpath("cache") .. "/github-theme",
|
||||
-- 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_nc_statusline = true, -- Override the underline style for non-active statuslines
|
||||
-- transparent = is_transparent, -- Disable setting background
|
||||
-- terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
|
||||
-- dim_inactive = false, -- Non focused panes set to alternative background
|
||||
-- module_default = true, -- Default enable value for modules
|
||||
-- styles = { -- Style to be applied to different syntax groups
|
||||
-- comments = "italic", -- Value is any valid attr-list value `:help attr-list`
|
||||
-- functions = "italic",
|
||||
-- keywords = "NONE",
|
||||
-- variables = "NONE",
|
||||
-- conditionals = "NONE",
|
||||
-- constants = "NONE",
|
||||
-- numbers = "NONE",
|
||||
-- operators = "NONE",
|
||||
-- strings = "NONE",
|
||||
-- types = "NONE",
|
||||
-- },
|
||||
-- inverse = { -- Inverse highlight for different types
|
||||
-- match_paren = false,
|
||||
-- visual = false,
|
||||
-- search = false,
|
||||
-- },
|
||||
-- darken = { -- Darken floating windows and sidebar-like windows
|
||||
-- floats = false,
|
||||
-- sidebars = {
|
||||
-- enabled = true,
|
||||
-- list = {}, -- Apply dark background to specific windows
|
||||
-- },
|
||||
-- },
|
||||
-- modules = { -- List of various plugins and additional options
|
||||
-- -- ...
|
||||
-- },
|
||||
-- },
|
||||
-- palettes = {
|
||||
-- github_dark_dimmed = {
|
||||
-- bg0 = is_transparent and "NONE" or "bg1",
|
||||
-- bg1 = is_transparent and "NONE" or "bg",
|
||||
-- },
|
||||
-- },
|
||||
-- specs = {},
|
||||
-- groups = {
|
||||
-- all = {
|
||||
-- illuminatedWord = { bg = "#3b4261" },
|
||||
-- illuminatedCurWord = { bg = "#3b4261" },
|
||||
-- IlluminatedWordText = { bg = "#3b4261" },
|
||||
-- IlluminatedWordRead = { bg = "#3b4261" },
|
||||
-- IlluminatedWordWrite = { bg = "#3b4261" },
|
||||
-- ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" },
|
||||
-- ["@text.uri"] = { fg = palette.const, style = "italic" },
|
||||
-- -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" },
|
||||
-- -- ["@operator.html"] = { fg = "#faa356" },
|
||||
-- -- ["@tag.html"] = { fg = "#fa7970" },
|
||||
-- -- ["@tag.delimiter.html"] = { fg = "#faa356" },
|
||||
-- },
|
||||
-- github_dark_high_contrast = {
|
||||
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
|
||||
-- },
|
||||
-- github_dark_dimmed = {
|
||||
-- -- 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" },
|
||||
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
|
||||
-- BufferLineFill = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LualineNormal = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- StatusLine = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- Pmenu = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- PmenuSel = { link = "CursorLine" },
|
||||
-- WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LazyNormal = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LazyBackground = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- "projekt0n/github-nvim-theme",
|
||||
-- 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
|
||||
-- config = function()
|
||||
-- local is_transparent = false
|
||||
-- local palette = require("github-theme.palette").load("github_dark_dimmed")
|
||||
-- require("github-theme").setup({
|
||||
-- options = {
|
||||
-- -- Compiled file's destination location
|
||||
-- compile_path = vim.fn.stdpath("cache") .. "/github-theme",
|
||||
-- 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_nc_statusline = true, -- Override the underline style for non-active statuslines
|
||||
-- transparent = is_transparent, -- Disable setting background
|
||||
-- terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
|
||||
-- dim_inactive = false, -- Non focused panes set to alternative background
|
||||
-- module_default = true, -- Default enable value for modules
|
||||
-- styles = { -- Style to be applied to different syntax groups
|
||||
-- comments = "italic", -- Value is any valid attr-list value `:help attr-list`
|
||||
-- functions = "italic",
|
||||
-- keywords = "NONE",
|
||||
-- variables = "NONE",
|
||||
-- conditionals = "NONE",
|
||||
-- constants = "NONE",
|
||||
-- numbers = "NONE",
|
||||
-- operators = "NONE",
|
||||
-- strings = "NONE",
|
||||
-- types = "NONE",
|
||||
-- },
|
||||
-- inverse = { -- Inverse highlight for different types
|
||||
-- match_paren = false,
|
||||
-- visual = false,
|
||||
-- search = false,
|
||||
-- },
|
||||
-- darken = { -- Darken floating windows and sidebar-like windows
|
||||
-- floats = false,
|
||||
-- sidebars = {
|
||||
-- enabled = true,
|
||||
-- list = {}, -- Apply dark background to specific windows
|
||||
-- },
|
||||
-- },
|
||||
-- modules = { -- List of various plugins and additional options
|
||||
-- -- ...
|
||||
-- },
|
||||
-- },
|
||||
-- palettes = {
|
||||
-- github_dark_dimmed = {
|
||||
-- bg0 = is_transparent and "NONE" or "bg1",
|
||||
-- bg1 = is_transparent and "NONE" or "bg",
|
||||
-- },
|
||||
-- },
|
||||
-- specs = {},
|
||||
-- groups = {
|
||||
-- all = {
|
||||
-- illuminatedWord = { bg = "#3b4261" },
|
||||
-- illuminatedCurWord = { bg = "#3b4261" },
|
||||
-- IlluminatedWordText = { bg = "#3b4261" },
|
||||
-- IlluminatedWordRead = { bg = "#3b4261" },
|
||||
-- IlluminatedWordWrite = { bg = "#3b4261" },
|
||||
-- ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" },
|
||||
-- ["@text.uri"] = { fg = palette.const, style = "italic" },
|
||||
-- -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" },
|
||||
-- -- ["@operator.html"] = { fg = "#faa356" },
|
||||
-- -- ["@tag.html"] = { fg = "#fa7970" },
|
||||
-- -- ["@tag.delimiter.html"] = { fg = "#faa356" },
|
||||
-- },
|
||||
-- github_dark_high_contrast = {
|
||||
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
|
||||
-- },
|
||||
-- github_dark_dimmed = {
|
||||
-- -- 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" },
|
||||
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
|
||||
-- BufferLineFill = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LualineNormal = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- StatusLine = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- Pmenu = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- PmenuSel = { link = "CursorLine" },
|
||||
-- WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LazyNormal = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LazyBackground = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ return {
|
|||
"hrsh7th/cmp-nvim-lua",
|
||||
enabled = false,
|
||||
},
|
||||
-- {
|
||||
-- "gbprod/yanky.nvim",
|
||||
-- event = "InsertEnter",
|
||||
-- config = function()
|
||||
-- require("user.yanky")
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
require("user.yanky")
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- "is0n/jaq-nvim",
|
||||
-- event = "BufRead",
|
||||
|
|
|
@ -7,10 +7,21 @@ return {
|
|||
config = function()
|
||||
local builtin = require("statuscol.builtin")
|
||||
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,
|
||||
segments = {
|
||||
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
|
||||
{ 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" },
|
||||
},
|
||||
})
|
||||
|
@ -24,6 +35,7 @@ return {
|
|||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
-- vim.o.fillchars = [[eob: ,fold: ,foldopen:▼,foldsep: ,foldclose:⏵]]
|
||||
|
||||
-- these are "extra", change them as you like
|
||||
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
|
||||
|
@ -33,9 +45,43 @@ return {
|
|||
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
|
||||
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
|
||||
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" }
|
||||
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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue