mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-25 18:28:50 +02:00
feat(ui): fancy fold text
This commit is contained in:
parent
364bcf325d
commit
f1ce07510d
3 changed files with 24 additions and 1 deletions
|
@ -19,6 +19,9 @@ local defaults = {
|
||||||
},
|
},
|
||||||
-- icons used by other plugins
|
-- icons used by other plugins
|
||||||
icons = {
|
icons = {
|
||||||
|
misc = {
|
||||||
|
dots = "",
|
||||||
|
},
|
||||||
dap = {
|
dap = {
|
||||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||||
Breakpoint = " ",
|
Breakpoint = " ",
|
||||||
|
|
|
@ -46,6 +46,15 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||||
opt.winminwidth = 5 -- Minimum window width
|
opt.winminwidth = 5 -- Minimum window width
|
||||||
opt.wrap = false -- Disable line wrap
|
opt.wrap = false -- Disable line wrap
|
||||||
|
opt.fillchars = {
|
||||||
|
foldopen = "",
|
||||||
|
foldclose = "",
|
||||||
|
-- fold = "⸱",
|
||||||
|
fold = " ",
|
||||||
|
foldsep = " ",
|
||||||
|
diff = "╱",
|
||||||
|
eob = " ",
|
||||||
|
}
|
||||||
|
|
||||||
if vim.fn.has("nvim-0.10") == 1 then
|
if vim.fn.has("nvim-0.10") == 1 then
|
||||||
opt.smoothscroll = true
|
opt.smoothscroll = true
|
||||||
|
@ -60,7 +69,9 @@ else
|
||||||
vim.opt.foldmethod = "indent"
|
vim.opt.foldmethod = "indent"
|
||||||
end
|
end
|
||||||
if vim.treesitter.foldtext then
|
if vim.treesitter.foldtext then
|
||||||
vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
|
vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()"
|
||||||
|
end
|
||||||
|
|
||||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,15 @@ function M.icon(sign, len)
|
||||||
return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text
|
return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.foldtext()
|
||||||
|
local ret = vim.treesitter.foldtext and vim.treesitter.foldtext()
|
||||||
|
if not ret then
|
||||||
|
ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } }
|
||||||
|
end
|
||||||
|
table.insert(ret, { " " .. require("lazyvim.config").icons.misc.dots })
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
function M.statuscolumn()
|
function M.statuscolumn()
|
||||||
local win = vim.g.statusline_winid
|
local win = vim.g.statusline_winid
|
||||||
if vim.wo[win].signcolumn == "no" then
|
if vim.wo[win].signcolumn == "no" then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue