Compare commits

..

25 Commits

Author SHA1 Message Date
c490c61d07 chore(main): release 9.0.0 (#1576)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-04 15:03:00 +02:00
79010ae671 fix(nvim-lint): dont try merging function linters 2023-10-04 14:45:45 +02:00
f4750859f2 fix(conform): dont try merging function formatters. Fixes #1582 2023-10-04 14:44:24 +02:00
9f034ab106 fix(conform): dont try to merge formatter functions 2023-10-04 14:41:00 +02:00
2f16a7b2d9 perf(config): add LazyVim to the rtp early for faster spec loading 2023-10-04 13:44:03 +02:00
3833a7d1ce style: removed dead code 2023-10-04 13:19:12 +02:00
bd2ac542a0 feat(ui): show alpha marks in statuscolumn 2023-10-04 12:48:37 +02:00
35053290bf fix(ui): use custom fold when treesitter foldtext returns a string 2023-10-04 12:47:24 +02:00
417de0193d feat(extras): added extra for dashboard.nvim 2023-10-04 12:44:01 +02:00
a12d4bd4e4 chore(build): auto-generate vimdoc 2023-10-04 08:49:22 +00:00
afc8e7f8ca fix(autocmds): retore last location for correct buffer 2023-10-04 10:48:20 +02:00
936d74bb61 perf: added support for LazyFile event that properly loads file based plugins without blocking the ui 2023-10-04 10:45:10 +02:00
f15dd301e5 style: fixed lua annotations 2023-10-04 10:43:44 +02:00
d28c69e49e feat(mini.surround)!: default surround mappings are now gs instead of gz (unless you enabled the leap extra) 2023-10-04 00:25:44 +02:00
0e66ef8393 feat(treesitter): added ]f, [f, ]F, [F, ]c, ]C, [c, [C for treesitter-textobjects 2023-10-04 00:21:47 +02:00
626ae1338a feat(typescript): add typescriptreact/javascriptreact to types (#1574)
* feat(typescript): add typescriptreact/javascriptreact to types

* remove unneeded values

* revert settings change
2023-10-03 23:40:32 +02:00
5f0713d2b6 feat(treesitter): map vim to @namespace.builtin 2023-10-03 20:17:33 +02:00
758520dcbb chore(main): release 8.4.4 (#1575)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-03 19:00:20 +02:00
ccff8683ba fix(ui): work-around for telescope issue with treesitter folds 2023-10-03 18:57:05 +02:00
0e16033e9c chore(main): release 8.4.3 (#1573)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-03 18:30:22 +02:00
6cf6b0a624 fix(ui): always pad to 2 cells for status column icons. Fixes #1571 2023-10-03 18:28:05 +02:00
e08813fa11 chore(main): release 8.4.2 (#1570)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-03 18:22:19 +02:00
e105c9daf6 perf(options): better detection for foldtext,statuscolumn,folexpr support 2023-10-03 18:19:32 +02:00
1b74d67a0d fix(ui): fixed foldtext on Neovim < 0.10 2023-10-03 17:35:14 +02:00
b1ad48067e fix(nvim-lint): dont evaluate conditions for linter functions. Fixes #1569 2023-10-03 16:32:05 +02:00
21 changed files with 287 additions and 77 deletions

View File

@ -1,5 +1,63 @@
# Changelog
## [9.0.0](https://github.com/LazyVim/LazyVim/compare/v8.4.4...v9.0.0) (2023-10-04)
### ⚠ BREAKING CHANGES
* **mini.surround:** default surround mappings are now gs instead of gz (unless you enabled the leap extra)
### Features
* **extras:** added extra for dashboard.nvim ([417de01](https://github.com/LazyVim/LazyVim/commit/417de0193dd0663100a8b1eaedc2bc4976712c61))
* **mini.surround:** default surround mappings are now gs instead of gz (unless you enabled the leap extra) ([d28c69e](https://github.com/LazyVim/LazyVim/commit/d28c69e49eab62b45f7d1562b3bc00afee5fbb65))
* **treesitter:** added ]f, [f, ]F, [F, ]c, ]C, [c, [C for treesitter-textobjects ([0e66ef8](https://github.com/LazyVim/LazyVim/commit/0e66ef83934eb62ee2237e331dcbc0a22b809aae))
* **treesitter:** map `vim` to `[@namespace](https://github.com/namespace).builtin` ([5f0713d](https://github.com/LazyVim/LazyVim/commit/5f0713d2b612a814586bffec39700ab6a30dc0ea))
* **typescript:** add typescriptreact/javascriptreact to types ([#1574](https://github.com/LazyVim/LazyVim/issues/1574)) ([626ae13](https://github.com/LazyVim/LazyVim/commit/626ae1338a88f6cd8962d6c20bd79953a67f0b72))
* **ui:** show alpha marks in statuscolumn ([bd2ac54](https://github.com/LazyVim/LazyVim/commit/bd2ac542a0bb4c58237cd6ca8848063bd20a5282))
### Bug Fixes
* **autocmds:** retore last location for correct buffer ([afc8e7f](https://github.com/LazyVim/LazyVim/commit/afc8e7f8cac06335efd12ec5f71cabb1f38a09b0))
* **conform:** dont try merging function formatters. Fixes [#1582](https://github.com/LazyVim/LazyVim/issues/1582) ([f475085](https://github.com/LazyVim/LazyVim/commit/f4750859f2c2c9a41b3974ac05962ce9648d6c16))
* **conform:** dont try to merge formatter functions ([9f034ab](https://github.com/LazyVim/LazyVim/commit/9f034ab10650e306e178d5189ee9214a52f2e8e5))
* **nvim-lint:** dont try merging function linters ([79010ae](https://github.com/LazyVim/LazyVim/commit/79010ae671035d8ed0040ce51df4fb59ec3962f8))
* **ui:** use custom fold when treesitter foldtext returns a string ([3505329](https://github.com/LazyVim/LazyVim/commit/35053290bf957a230c8758d31ba3997c0699f5f9))
### Performance Improvements
* added support for `LazyFile` event that properly loads file based plugins without blocking the ui ([936d74b](https://github.com/LazyVim/LazyVim/commit/936d74bb6127721eeefa62e5f697d9693ab04fdd))
* **config:** add LazyVim to the rtp early for faster spec loading ([2f16a7b](https://github.com/LazyVim/LazyVim/commit/2f16a7b2d96e912c9ab50ce99d9994413ff3678d))
## [8.4.4](https://github.com/LazyVim/LazyVim/compare/v8.4.3...v8.4.4) (2023-10-03)
### Bug Fixes
* **ui:** work-around for telescope issue with treesitter folds ([ccff868](https://github.com/LazyVim/LazyVim/commit/ccff8683ba957250d71ef66429fc877f0ee5cedb))
## [8.4.3](https://github.com/LazyVim/LazyVim/compare/v8.4.2...v8.4.3) (2023-10-03)
### Bug Fixes
* **ui:** always pad to 2 cells for status column icons. Fixes [#1571](https://github.com/LazyVim/LazyVim/issues/1571) ([6cf6b0a](https://github.com/LazyVim/LazyVim/commit/6cf6b0a6241c659113f5646ff64fba7dbf5161b9))
## [8.4.2](https://github.com/LazyVim/LazyVim/compare/v8.4.1...v8.4.2) (2023-10-03)
### Bug Fixes
* **nvim-lint:** dont evaluate conditions for linter functions. Fixes [#1569](https://github.com/LazyVim/LazyVim/issues/1569) ([b1ad480](https://github.com/LazyVim/LazyVim/commit/b1ad48067e2c18747bedd7b7054c3ce97ef32890))
* **ui:** fixed foldtext on Neovim &lt; 0.10 ([1b74d67](https://github.com/LazyVim/LazyVim/commit/1b74d67a0d5783e587dedc73a715cb0c9db6cd16))
### Performance Improvements
* **options:** better detection for foldtext,statuscolumn,folexpr support ([e105c9d](https://github.com/LazyVim/LazyVim/commit/e105c9daf6e973b4a294a17b4d2d1882f2188ac6))
## [8.4.1](https://github.com/LazyVim/LazyVim/compare/v8.4.0...v8.4.1) (2023-10-03)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 04
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -31,9 +31,9 @@ vim.api.nvim_create_autocmd({ "VimResized" }, {
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPost", {
group = augroup("last_loc"),
callback = function()
callback = function(event)
local exclude = { "gitcommit" }
local buf = vim.api.nvim_get_current_buf()
local buf = event.buf
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
return
end
@ -91,3 +91,16 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})
-- HACK: re-caclulate folds when entering a buffer through Telescope
-- @see https://github.com/nvim-telescope/telescope.nvim/issues/699
vim.api.nvim_create_autocmd("BufEnter", {
group = augroup("fix_folds"),
callback = function()
if vim.opt.foldmethod:get() == "expr" then
vim.schedule(function()
vim.opt.foldmethod = "expr"
end)
end
end,
})

View File

@ -1,9 +1,9 @@
---@type LazyVimConfig
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.lazy_version = ">=9.1.0"
---@class LazyVimConfig
---@class LazyVimOptions
local defaults = {
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
---@type string|fun()
@ -86,12 +86,12 @@ M.renames = {
["null-ls.nvim"] = "none-ls.nvim",
}
---@type LazyVimConfig
---@type LazyVimOptions
local options
---@param opts? LazyVimConfig
---@param opts? LazyVimOptions
function M.setup(opts)
options = vim.tbl_deep_extend("force", defaults, opts or {})
options = vim.tbl_deep_extend("force", defaults, opts or {}) or {}
if vim.fn.has("nvim-0.9.0") == 0 then
vim.api.nvim_echo({
@ -124,8 +124,9 @@ function M.setup(opts)
M.load("autocmds")
end
local group = vim.api.nvim_create_augroup("LazyVim", { clear = true })
vim.api.nvim_create_autocmd("User", {
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
group = group,
pattern = "VeryLazy",
callback = function()
if lazy_autocmds then
@ -135,6 +136,8 @@ function M.setup(opts)
end,
})
M.lazy_file()
require("lazy.core.util").try(function()
if type(M.colorscheme) == "function" then
M.colorscheme()
@ -150,6 +153,40 @@ function M.setup(opts)
})
end
-- Properly load file based plugins without blocking the UI
function M.lazy_file()
local events = {} ---@type {event: string, pattern?: string, buf: number, data?: any}[]
local function load()
if #events == 0 then
return
end
vim.api.nvim_del_augroup_by_name("lazy_file")
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false })
for _, event in ipairs(events) do
vim.api.nvim_exec_autocmds(event.event, {
pattern = event.pattern,
modeline = false,
buffer = event.buf,
data = event.data,
})
end
events = {}
end
-- schedule wrap so that nested autocmds are executed
-- and the UI can continue rendering without blocking
load = vim.schedule_wrap(load)
vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("lazy_file", { clear = true }),
callback = function(event)
table.insert(events, event)
load()
end,
})
end
---@param range? string
function M.has(range)
local Semver = require("lazy.manage.semver")
@ -190,6 +227,7 @@ M.did_init = false
function M.init()
if not M.did_init then
M.did_init = true
vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir)
-- delay notifications till vim.notify was replaced or after 500ms
require("lazyvim.util").lazy_notify()
@ -199,6 +237,7 @@ function M.init()
require("lazyvim.config").load("options")
local Plugin = require("lazy.core.plugin")
local add = Plugin.Spec.add
---@diagnostic disable-next-line: duplicate-set-field
Plugin.Spec.add = function(self, plugin, ...)
if type(plugin) == "table" and M.renames[plugin[1]] then
require("lazy.core.util").warn(
@ -213,6 +252,14 @@ function M.init()
end
return add(self, plugin, ...)
end
-- Add support for the LazyFile event
local Event = require("lazy.core.handler.event")
local _event = Event._event
---@diagnostic disable-next-line: duplicate-set-field
Event._event = function(self, value)
return value == "LazyFile" and "User LazyFile" or _event(self, value)
end
end
end

View File

@ -62,18 +62,14 @@ 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
vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()"
if vim.fn.has("nvim-0.9.0") == 1 then
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
else
vim.opt.foldmethod = "indent"
end
-- Fix markdown indentation settings

View File

@ -140,13 +140,13 @@ return {
end,
opts = {
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding (to the left)
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
add = "gsa", -- Add surrounding in Normal and Visual modes
delete = "gsd", -- Delete surrounding
find = "gsf", -- Find surrounding (to the right)
find_left = "gsF", -- Find surrounding (to the left)
highlight = "gsh", -- Highlight surrounding
replace = "gsr", -- Replace surrounding
update_n_lines = "gsn", -- Update `n_lines`
},
},
},
@ -179,7 +179,6 @@ return {
-- { "i", mode = { "x", "o" } },
-- },
event = "VeryLazy",
dependencies = { "nvim-treesitter-textobjects" },
opts = function()
local ai = require("mini.ai")
return {

View File

@ -310,7 +310,7 @@ return {
-- hunks in a commit.
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
opts = {
signs = {
add = { text = "" },
@ -349,7 +349,7 @@ return {
-- instances.
{
"RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" },
event = "LazyFile",
opts = {
delay = 200,
large_file_cutoff = 2000,
@ -440,7 +440,7 @@ return {
{
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
event = { "BufReadPost", "BufNewFile" },
event = "LazyFile",
config = true,
-- stylua: ignore
keys = {

View File

@ -35,6 +35,22 @@ return {
end,
},
-- rename surround mappings from gs to gz to prevent conflict with leap
{
"echasnovski/mini.surround",
opts = {
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding (to the left)
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
},
},
},
-- makes some plugins dot-repeatable like leap
{ "tpope/vim-repeat", event = "VeryLazy" },
}

View File

@ -43,9 +43,13 @@ return {
},
config = function(_, opts)
opts.formatters = opts.formatters or {}
for f, o in pairs(opts.formatters) do
local ok, formatter = pcall(require, "conform.formatters." .. f)
opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o)
for name, formatter in pairs(opts.formatters) do
if type(formatter) == "table" then
local ok, defaults = pcall(require, "conform.formatters." .. name)
if ok and type(defaults) == "table" then
opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter)
end
end
end
require("conform").setup(opts)
end,

View File

@ -45,6 +45,6 @@ return {
{
"Civitasv/cmake-tools.nvim",
opts = {},
event = "BufRead",
event = "LazyFile",
},
}

View File

@ -86,7 +86,7 @@ return {
},
}
end
for _, language in ipairs({ "typescript", "javascript" }) do
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
if not dap.configurations[language] then
dap.configurations[language] = {
{

View File

@ -1,7 +1,7 @@
return {
{
"mfussenegger/nvim-lint",
event = "BufReadPost",
event = "LazyFile",
opts = {
-- Event to trigger linters
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
@ -27,7 +27,9 @@ return {
local lint = require("lint")
for name, linter in pairs(opts.linters) do
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter)
if type(linter) == "table" and type(lint.linters) == "table" then
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
end
end
lint.linters_by_ft = opts.linters_by_ft
@ -43,13 +45,12 @@ return {
end
function M.lint()
local lint = require("lint")
local names = lint.linters_by_ft[vim.bo.filetype] or {}
local ctx = { filename = vim.api.nvim_buf_get_name(0) }
ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h")
names = vim.tbl_filter(function(name)
local linter = lint.linters[name]
return linter and not (linter.condition and not linter.condition(ctx))
return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx))
end, names)
if #names > 0 then

View File

@ -0,0 +1,62 @@
return {
{ "goolord/alpha-nvim", enabled = false },
{ "echasnovski/mini.starter", enabled = false },
{
"glepnir/dashboard-nvim",
event = "VimEnter",
dependencies = {
-- disable alpha
{ "goolord/alpha-nvim", enabled = false },
},
opts = function()
local logo = [[
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
config = {
header = vim.split(logo, "\n"),
center = {
{ action = "Telescope find_files", desc = " Find file", icon = "", key = "f" },
{ action = "ene | startinsert", desc = " New file", icon = "", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent files", icon = "", key = "r" },
{ action = "Telescope live_grep", desc = " Find text", icon = "", key = "g" },
{ action = "e $MYVIMRC", desc = " Config", icon = "", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
{ action = "qa", desc = " Quit", icon = "", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" }
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
},
}

View File

@ -2,6 +2,7 @@
return {
-- disable alpha
{ "goolord/alpha-nvim", enabled = false },
{ "glepnir/dashboard-nvim", enabled = false },
-- enable mini.starter
{

View File

@ -5,7 +5,7 @@ M.hl = {}
M.plugin = {
"echasnovski/mini.hipatterns",
event = "BufReadPre",
event = "LazyFile",
opts = function()
local hi = require("mini.hipatterns")
return {

View File

@ -18,7 +18,6 @@ local enabled = {
}
local Config = require("lazy.core.config")
local Plugin = require("lazy.core.plugin")
Config.options.checker.enabled = false
Config.options.change_detection.enabled = false
Config.options.defaults.cond = function(plugin)

View File

@ -2,7 +2,7 @@ return {
-- lspconfig
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } },
{ "folke/neodev.nvim", opts = {} },
@ -203,7 +203,7 @@ return {
-- formatters
{
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
dependencies = { "mason.nvim" },
opts = function()
local nls = require("null-ls")

View File

@ -1,4 +1,3 @@
local load_textobjects = false
return {
-- Treesitter is a new parser generator tool that we can
-- use in Neovim to power faster and more accurate
@ -7,17 +6,10 @@ return {
"nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
event = { "LazyFile", "VeryLazy" },
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
init = function()
-- disable rtp plugin, as we only need its queries for mini.ai
-- In case other textobject modules are enabled, we will load them
-- once nvim-treesitter is loaded
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
load_textobjects = true
end,
},
},
cmd = { "TSUpdateSync" },
@ -59,6 +51,15 @@ return {
node_decremental = "<bs>",
},
},
textobjects = {
move = {
enable = true,
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" },
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" },
goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" },
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" },
},
},
},
---@param opts TSConfig
config = function(_, opts)
@ -74,21 +75,6 @@ return {
end, opts.ensure_installed)
end
require("nvim-treesitter.configs").setup(opts)
if load_textobjects then
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
if opts.textobjects then
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
if opts.textobjects[mod] and opts.textobjects[mod].enable then
local Loader = require("lazy.core.loader")
Loader.disabled_rtp_plugins["nvim-treesitter-textobjects"] = nil
local plugin = require("lazy.core.config").plugins["nvim-treesitter-textobjects"]
require("lazy.core.loader").source_runtime(plugin.dir, "plugin")
break
end
end
end
end
end,
},
}

View File

@ -53,7 +53,7 @@ return {
-- tabs, which include filetype icons and close buttons.
{
"akinsho/bufferline.nvim",
event = "VeryLazy",
event = "LazyFile",
keys = {
{ "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle pin" },
{ "<leader>bP", "<Cmd>BufferLineGroupClose ungrouped<CR>", desc = "Delete non-pinned buffers" },
@ -166,7 +166,7 @@ return {
-- indent guides for Neovim
{
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPost", "BufNewFile" },
event = "LazyFile",
opts = {
indent = {
char = "",
@ -197,7 +197,7 @@ return {
{
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
opts = {
-- symbol = "▏",
symbol = "",

View File

@ -3,19 +3,33 @@ 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)
---@param buf number
---@param lnum number
function M.get_signs(buf, lnum)
---@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, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs)
end
---@return Sign?
---@param buf number
---@param lnum number
function M.get_mark(buf, lnum)
local marks = vim.fn.getmarklist(buf)
vim.list_extend(marks, vim.fn.getmarklist())
for _, mark in ipairs(marks) do
if mark.pos[2] == lnum and mark.mark:match("[a-zA-Z]") then
return { text = mark.mark:sub(2), texthl = "DiagnosticHint" }
end
end
end
---@param sign? Sign
---@param len? number
function M.icon(sign, len)
sign = sign or {}
len = len or 1
len = len or 2
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
@ -24,10 +38,19 @@ 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
if not ret or type(ret) == "string" 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 })
if not vim.treesitter.foldtext then
return table.concat(
vim.tbl_map(function(line)
return line[1]
end, ret),
" "
)
end
return ret
end
@ -36,10 +59,11 @@ function M.statuscolumn()
if vim.wo[win].signcolumn == "no" then
return ""
end
local buf = vim.api.nvim_win_get_buf(win)
---@type Sign?,Sign?,Sign?
local left, right, fold
for _, s in ipairs(M.get_signs(win)) do
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
if s.name:find("GitSign") then
right = s
elseif not left then
@ -59,10 +83,10 @@ function M.statuscolumn()
end
return table.concat({
M.icon(left),
M.icon(M.get_mark(buf, vim.v.lnum) or left),
[[%=]],
nu .. " ",
M.icon(fold or right, 2),
M.icon(fold or right),
}, "")
end

View File

@ -0,0 +1,4 @@
;; extends
((identifier) @namespace.builtin
(#eq? @namespace.builtin "vim"))