Compare commits

..

12 Commits

Author SHA1 Message Date
8c20e0b588 chore(main): release 9.3.1 (#1613)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-07 15:19:39 +02:00
862e140a7a fix(config): trigger all buf filetype events on LazyFile 2023-10-07 15:15:33 +02:00
1935486ff1 fix(treesitter-textobjects): use normal ]c,]C,[c,[C when in diff-mode instead of goto class. Fixes #1610 2023-10-07 15:06:13 +02:00
237be9e3a7 fix(rust): explicitly enable nvim-cmp source registration for crates (#1609) 2023-10-07 11:45:03 +02:00
75a26e8509 chore(build): auto-generate vimdoc 2023-10-07 09:18:48 +00:00
0fcdbe20da fix(ui): properly handly signs without name. Fixes #1612 2023-10-07 11:18:04 +02:00
fb110e76d8 docs(conform): conform condition example 2023-10-06 23:25:24 +02:00
8bcc241b72 chore(main): release 9.3.0 (#1603)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 23:16:59 +02:00
d8f4382dd3 fix(tailwind): nil check for filetypes_include. Fixes #1607 2023-10-06 23:06:51 +02:00
11c9084ec5 perf(config): only enable LazyFile when opening a file from the cmdline 2023-10-06 18:43:54 +02:00
54df3e26ac feat(bufremove): ask to save changes before trying to remove a buffer 2023-10-06 18:43:54 +02:00
e1f5484c82 refactor: use_lazy_file 2023-10-06 18:43:54 +02:00
9 changed files with 110 additions and 34 deletions

View File

@ -1,5 +1,32 @@
# Changelog
## [9.3.1](https://github.com/LazyVim/LazyVim/compare/v9.3.0...v9.3.1) (2023-10-07)
### Bug Fixes
* **config:** trigger all buf filetype events on LazyFile ([862e140](https://github.com/LazyVim/LazyVim/commit/862e140a7ad8452cd5a103982687fca63a2f44da))
* **rust:** explicitly enable nvim-cmp source registration for crates ([#1609](https://github.com/LazyVim/LazyVim/issues/1609)) ([237be9e](https://github.com/LazyVim/LazyVim/commit/237be9e3a7f5ca8165d4242d47df34d8d407f4cc))
* **treesitter-textobjects:** use normal ]c,]C,[c,[C when in diff-mode instead of goto class. Fixes [#1610](https://github.com/LazyVim/LazyVim/issues/1610) ([1935486](https://github.com/LazyVim/LazyVim/commit/1935486ff143dd5cf100b8c89204dc01d8e06021))
* **ui:** properly handly signs without name. Fixes [#1612](https://github.com/LazyVim/LazyVim/issues/1612) ([0fcdbe2](https://github.com/LazyVim/LazyVim/commit/0fcdbe20daf44f00252668b3866b19ac18b339df))
## [9.3.0](https://github.com/LazyVim/LazyVim/compare/v9.2.0...v9.3.0) (2023-10-06)
### Features
* **bufremove:** ask to save changes before trying to remove a buffer ([54df3e2](https://github.com/LazyVim/LazyVim/commit/54df3e26aca5c5c4da746f210e6f7e7de30673bb))
### Bug Fixes
* **tailwind:** nil check for filetypes_include. Fixes [#1607](https://github.com/LazyVim/LazyVim/issues/1607) ([d8f4382](https://github.com/LazyVim/LazyVim/commit/d8f4382dd3850550076b33d64a5f455daf7e6450))
### Performance Improvements
* **config:** only enable LazyFile when opening a file from the cmdline ([11c9084](https://github.com/LazyVim/LazyVim/commit/11c9084ec576c8735a87550f7975640eb75e6ff7))
## [9.2.0](https://github.com/LazyVim/LazyVim/compare/v9.1.1...v9.2.0) (2023-10-06)

View File

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

View File

@ -3,6 +3,7 @@ local M = {}
M.lazy_version = ">=9.1.0"
M.use_lazy_file = true
M.lazy_file_events = { "BufReadPost", "BufNewFile" }
---@class LazyVimOptions
local defaults = {
@ -137,7 +138,6 @@ function M.setup(opts)
end,
})
M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil
if M.use_lazy_file then
M.lazy_file()
end
@ -169,10 +169,10 @@ function M.lazy_file()
local Util = require("lazy.core.util")
vim.api.nvim_del_augroup_by_name("lazy_file")
Util.track({ event = "LazyFile" })
Util.track({ event = "LazyVim.lazy_file" })
---@type table<string,string[]>
local skips = { FileType = Event.get_augroups("FileType") }
local skips = {}
for _, event in ipairs(events) do
skips[event.event] = skips[event.event] or Event.get_augroups(event.event)
end
@ -188,7 +188,6 @@ function M.lazy_file()
if vim.bo[event.buf].filetype then
Event.trigger({
event = "FileType",
exclude = skips.FileType,
buf = event.buf,
})
end
@ -202,7 +201,7 @@ function M.lazy_file()
-- and the UI can continue rendering without blocking
load = vim.schedule_wrap(load)
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
vim.api.nvim_create_autocmd(M.lazy_file_events, {
group = vim.api.nvim_create_augroup("lazy_file", { clear = true }),
callback = function(event)
table.insert(events, event)
@ -252,6 +251,11 @@ 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)
M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0
---@diagnostic disable-next-line: undefined-field
M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil
-- delay notifications till vim.notify was replaced or after 500ms
require("lazyvim.util").lazy_notify()
@ -263,19 +267,32 @@ function M.init()
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(
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
plugin[1],
M.renames[plugin[1]],
self.importing or "LazyVim"
),
{ title = "LazyVim" }
)
plugin[1] = M.renames[plugin[1]]
end
if not M.use_lazy_file and type(plugin) == "table" and plugin.event == "LazyFile" then
plugin.event = { "BufReadPost", "BufNewFile" }
if type(plugin) == "table" then
if M.renames[plugin[1]] then
require("lazy.core.util").warn(
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
plugin[1],
M.renames[plugin[1]],
self.importing or "LazyVim"
),
{ title = "LazyVim" }
)
plugin[1] = M.renames[plugin[1]]
end
if not M.use_lazy_file and plugin.event then
if plugin.event == "LazyFile" then
plugin.event = M.lazy_file_events
elseif type(plugin.event) == "table" then
local events = {} ---@type string[]
for _, event in ipairs(plugin.event) do
if event == "LazyFile" then
vim.list_extend(events, M.lazy_file_events)
else
events[#events + 1] = event
end
end
end
end
end
return add(self, plugin, ...)
end

View File

@ -387,9 +387,27 @@ return {
-- buffer remove
{
"echasnovski/mini.bufremove",
-- stylua: ignore
keys = {
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
{
"<leader>bd",
function()
local bd = require("mini.bufremove").delete
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
if choice == 1 then -- Yes
vim.cmd.write()
bd(0)
elseif choice == 2 then -- No
bd(0, true)
end
else
bd(0)
end
end,
desc = "Delete Buffer",
},
-- stylua: ignore
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
},
},

View File

@ -36,7 +36,7 @@ return {
injected = { options = { ignore_errors = true } },
-- -- Example of using dprint only when a dprint.json file is present
-- dprint = {
-- condition = function(self, ctx)
-- condition = function(ctx)
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },

View File

@ -7,7 +7,11 @@ return {
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
config = true,
opts = {
src = {
cmp = { enabled = true },
},
},
},
},
---@param opts cmp.ConfigSchema

View File

@ -27,7 +27,7 @@ return {
end, opts.filetypes)
-- Add additional filetypes
vim.list_extend(opts.filetypes, opts.filetypes_include)
vim.list_extend(opts.filetypes, opts.filetypes_include or {})
end,
},
},

View File

@ -11,16 +11,26 @@ return {
{
"nvim-treesitter/nvim-treesitter-textobjects",
config = function()
-- Disable class keymaps in diff mode
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function(event)
if vim.wo.diff then
for _, key in ipairs({ "[c", "]c", "[C", "]C" }) do
pcall(vim.keymap.del, "n", key, { buffer = event.buf })
-- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(q, ...)
if vim.wo.diff then
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
return
end
end
end
return fn(q, ...)
end
end,
})
end
end
end,
},
},

View File

@ -26,7 +26,7 @@ function M.get_signs(buf, lnum)
)
for _, extmark in pairs(extmarks) do
signs[#signs + 1] = {
name = extmark[4].sign_hl_group,
name = extmark[4].sign_hl_group or "",
text = extmark[4].sign_text,
texthl = extmark[4].sign_hl_group,
priority = extmark[4].priority,
@ -93,7 +93,7 @@ function M.statuscolumn()
---@type Sign?,Sign?,Sign?
local left, right, fold
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
if s.name:find("GitSign") then
if s.name and s.name:find("GitSign") then
right = s
else
left = s