Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
6428fc167c | |||
762017dc35 | |||
afbe2043a7 | |||
f1ce07510d | |||
364bcf325d | |||
3f868aa825 | |||
fecc5faca2 | |||
19926d2848 | |||
450e0c6beb | |||
4e277fcb8f | |||
86d3694672 | |||
7c5a458761 |
29
CHANGELOG.md
29
CHANGELOG.md
@ -1,5 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## [8.4.0](https://github.com/LazyVim/LazyVim/compare/v8.3.0...v8.4.0) (2023-10-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **keymaps:** added toggle for relative line numbers ([3f868aa](https://github.com/LazyVim/LazyVim/commit/3f868aa8254efbd494f6bf100c86a59c5a002c1c))
|
||||
* **options:** enable smoothscroll on nightly ([450e0c6](https://github.com/LazyVim/LazyVim/commit/450e0c6bebc5bb9a0c513cdffaf9c46d5f62d5fa))
|
||||
* **options:** enabled treesitter folding and foldtext when available ([19926d2](https://github.com/LazyVim/LazyVim/commit/19926d284862b5e58f29e73b71ec532ac29c54ba))
|
||||
* **ui:** fancy fold text ([f1ce075](https://github.com/LazyVim/LazyVim/commit/f1ce07510d2048e33fec2b609814d68a7175d591))
|
||||
* **ui:** fancy status column ([364bcf3](https://github.com/LazyVim/LazyVim/commit/364bcf325d91a06e6bd6516bdfed84399566cdb6))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ui:** better fallback for foldtext when buffer does not have TreeSitter ([762017d](https://github.com/LazyVim/LazyVim/commit/762017dc35fc961bdcc7879a5527dbccced27792))
|
||||
* **ui:** Neovim < 0.10 ([afbe204](https://github.com/LazyVim/LazyVim/commit/afbe2043a73b6c90476812f9cc0ca4759814e5ac))
|
||||
|
||||
## [8.3.0](https://github.com/LazyVim/LazyVim/compare/v8.2.0...v8.3.0) (2023-10-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **conform:** added new keymap (leader-cF) to format injected languages ([86d3694](https://github.com/LazyVim/LazyVim/commit/86d36946727bade57918c6a358c6b6bae52d441b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **indent-blankline:** set `config.indent.tab_char` ([#1552](https://github.com/LazyVim/LazyVim/issues/1552)) ([7c5a458](https://github.com/LazyVim/LazyVim/commit/7c5a458761fe7002c6603d602e8d130b9a62dd68))
|
||||
|
||||
## [8.2.0](https://github.com/LazyVim/LazyVim/compare/v8.1.0...v8.2.0) (2023-10-02)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 02
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
|
@ -19,6 +19,9 @@ local defaults = {
|
||||
},
|
||||
-- icons used by other plugins
|
||||
icons = {
|
||||
misc = {
|
||||
dots = "",
|
||||
},
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
|
@ -114,6 +114,7 @@ end, { desc = "Format" })
|
||||
map("n", "<leader>uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" })
|
||||
map("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" })
|
||||
map("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
||||
map("n", "<leader>uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
|
||||
map("n", "<leader>ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" })
|
||||
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||
|
@ -46,6 +46,35 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
opt.fillchars = {
|
||||
foldopen = "",
|
||||
foldclose = "",
|
||||
-- fold = "⸱",
|
||||
fold = " ",
|
||||
foldsep = " ",
|
||||
diff = "╱",
|
||||
eob = " ",
|
||||
}
|
||||
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
opt.smoothscroll = true
|
||||
end
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldlevel = 99
|
||||
if vim.treesitter.foldexpr then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
else
|
||||
vim.opt.foldmethod = "indent"
|
||||
end
|
||||
if vim.treesitter.foldtext then
|
||||
vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()"
|
||||
end
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||
end
|
||||
|
||||
-- Fix markdown indentation settings
|
||||
vim.g.markdown_recommended_style = 0
|
||||
|
@ -4,6 +4,16 @@ return {
|
||||
dependencies = { "mason.nvim" },
|
||||
lazy = true,
|
||||
cmd = "ConformInfo",
|
||||
keys = {
|
||||
{
|
||||
"<leader>cF",
|
||||
function()
|
||||
require("conform").format({ formatters = { "injected" } })
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Format Injected Langs",
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
-- Install the conform formatter on VeryLazy
|
||||
|
@ -168,7 +168,10 @@ return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
opts = {
|
||||
indent = { char = "│" },
|
||||
indent = {
|
||||
char = "│",
|
||||
tab_char = "│",
|
||||
},
|
||||
scope = { enabled = false },
|
||||
exclude = {
|
||||
filetypes = {
|
||||
|
67
lua/lazyvim/util/ui.lua
Normal file
67
lua/lazyvim/util/ui.lua
Normal file
@ -0,0 +1,67 @@
|
||||
local M = {}
|
||||
|
||||
---@alias Sign {name:string, text:string, texthl:string}
|
||||
|
||||
---@return Sign[]
|
||||
function M.get_signs(win)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
---@diagnostic disable-next-line: no-unknown
|
||||
return vim.tbl_map(function(sign)
|
||||
return vim.fn.sign_getdefined(sign.name)[1]
|
||||
end, vim.fn.sign_getplaced(buf, { group = "*", lnum = vim.v.lnum })[1].signs)
|
||||
end
|
||||
|
||||
---@param sign? Sign
|
||||
---@param len? number
|
||||
function M.icon(sign, len)
|
||||
sign = sign or {}
|
||||
len = len or 1
|
||||
local text = vim.fn.strcharpart(sign.text or "", 0, len) ---@type string
|
||||
text = text .. string.rep(" ", len - vim.fn.strchars(text))
|
||||
return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text
|
||||
end
|
||||
|
||||
function M.foldtext()
|
||||
local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf())
|
||||
local ret = ok and 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()
|
||||
local win = vim.g.statusline_winid
|
||||
if vim.wo[win].signcolumn == "no" then
|
||||
return ""
|
||||
end
|
||||
|
||||
---@type Sign?,Sign?,Sign?
|
||||
local left, right, fold
|
||||
for _, s in ipairs(M.get_signs(win)) do
|
||||
if s.name:find("GitSign") then
|
||||
right = s
|
||||
elseif not left then
|
||||
left = s
|
||||
end
|
||||
end
|
||||
|
||||
if vim.fn.foldclosed(vim.v.lnum) >= 0 then
|
||||
fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" }
|
||||
end
|
||||
|
||||
local nu = ""
|
||||
if vim.wo[win].number and vim.v.virtnum == 0 then
|
||||
nu = vim.wo[win].relativenumber and vim.v.relnum ~= 0 and vim.v.relnum or vim.v.lnum
|
||||
end
|
||||
|
||||
return table.concat({
|
||||
M.icon(left),
|
||||
[[%=]],
|
||||
nu .. " ",
|
||||
M.icon(fold or right, 2),
|
||||
}, "")
|
||||
end
|
||||
|
||||
return M
|
Reference in New Issue
Block a user