mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-19 16:58:31 +02:00
Merge branch 'main' into copilotchat-snacks-picker
This commit is contained in:
commit
a0858f6085
10 changed files with 235 additions and 11 deletions
2
.github/.release-please-manifest.json
vendored
2
.github/.release-please-manifest.json
vendored
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
".": "14.7.0"
|
||||
".": "14.8.0"
|
||||
}
|
||||
|
|
23
CHANGELOG.md
23
CHANGELOG.md
|
@ -1,5 +1,28 @@
|
|||
# Changelog
|
||||
|
||||
## [14.8.0](https://github.com/LazyVim/LazyVim/compare/v14.7.0...v14.8.0) (2025-01-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **chezmoi:** add snacks picker integration for chezmoi files ([#5429](https://github.com/LazyVim/LazyVim/issues/5429)) ([970d1a0](https://github.com/LazyVim/LazyVim/commit/970d1a05da37554aa17b671c869431a7b387d8be))
|
||||
* **dial:** add checkbox augend for markdown ([#5411](https://github.com/LazyVim/LazyVim/issues/5411)) ([b19f207](https://github.com/LazyVim/LazyVim/commit/b19f2070b847a3067436f4d16a0cc5b84a9f9819))
|
||||
* **snacks.picker:** added leader-sS to search lsp workspace symbols ([8787ec1](https://github.com/LazyVim/LazyVim/commit/8787ec1227e10123ad7291cf916020d9a8626525))
|
||||
* **snacks:** added git diff keymap to pick hunks with leader-gd ([62cb4a4](https://github.com/LazyVim/LazyVim/commit/62cb4a465c490c7d41f7a3bf52fb0e222f2cf83b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **markdown:** disable checkbox rendering since it's annoying to edit ([4f31bfa](https://github.com/LazyVim/LazyVim/commit/4f31bfab86402c819e5ea1e18b3c5d139628c864))
|
||||
* **snacks.picker:** fix mapping for `Recent (cwd)` ([#5407](https://github.com/LazyVim/LazyVim/issues/5407)) ([8307b0f](https://github.com/LazyVim/LazyVim/commit/8307b0fe506a38417f3b7835e2c4b43d9a970946))
|
||||
* **snacks.picker:** fix mapping for Projects for consistency ([#5433](https://github.com/LazyVim/LazyVim/issues/5433)) ([eb7b453](https://github.com/LazyVim/LazyVim/commit/eb7b453b48ab7e3008013e0edf2822f622111e97))
|
||||
* **snacks.picker:** respect lazyvim.config.kind_filter ([#5415](https://github.com/LazyVim/LazyVim/issues/5415)) ([df7426e](https://github.com/LazyVim/LazyVim/commit/df7426eefa79d5dfa2fcbe2f381abfb2cca70bad))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **java:** setting opts.dap_main to false to disable main class scan ([#5391](https://github.com/LazyVim/LazyVim/issues/5391)) ([66c3577](https://github.com/LazyVim/LazyVim/commit/66c3577bc779d31a7c2addd47de7cc6d215795ba))
|
||||
|
||||
## [14.7.0](https://github.com/LazyVim/LazyVim/compare/v14.6.1...v14.7.0) (2025-01-14)
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
*LazyVim.txt* For Neovim Last change: 2025 January 19
|
||||
*LazyVim.txt* For Neovim Last change: 2025 January 23
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
|
|
|
@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
|
|||
---@class LazyVimConfig: LazyVimOptions
|
||||
local M = {}
|
||||
|
||||
M.version = "14.7.0" -- x-release-please-version
|
||||
M.version = "14.8.0" -- x-release-please-version
|
||||
LazyVim.config = M
|
||||
|
||||
---@class LazyVimOptions
|
||||
|
|
167
lua/lazyvim/plugins/extras/coding/mini-snippets.lua
Normal file
167
lua/lazyvim/plugins/extras/coding/mini-snippets.lua
Normal file
|
@ -0,0 +1,167 @@
|
|||
if lazyvim_docs then
|
||||
-- Set to `false` to prevent "non-lsp snippets"" from appearing inside completion windows
|
||||
-- Motivation: Less clutter in completion windows and a more direct usage of snippits
|
||||
vim.g.lazyvim_mini_snippets_in_completion = true
|
||||
|
||||
-- NOTE: Please also read:
|
||||
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-snippets.md#expand
|
||||
-- :h MiniSnippets-session
|
||||
|
||||
-- Example override for your own config:
|
||||
--[[
|
||||
return {
|
||||
{
|
||||
"echasnovski/mini.snippets",
|
||||
opts = function(_, opts)
|
||||
-- By default, for opts.snippets, the extra for mini.snippets only adds gen_loader.from_lang()
|
||||
-- This provides a sensible quickstart, integrating with friendly-snippets
|
||||
-- and your own language-specific snippets
|
||||
--
|
||||
-- In order to change opts.snippets, replace the entire table inside your own opts
|
||||
|
||||
local snippets, config_path = require("mini.snippets"), vim.fn.stdpath("config")
|
||||
|
||||
opts.snippets = { -- override opts.snippets provided by extra...
|
||||
-- Load custom file with global snippets first (order matters)
|
||||
snippets.gen_loader.from_file(config_path .. "/snippets/global.json"),
|
||||
|
||||
-- Load snippets based on current language by reading files from
|
||||
-- "snippets/" subdirectories from 'runtimepath' directories.
|
||||
snippets.gen_loader.from_lang(), -- this is the default in the extra...
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
--]]
|
||||
end
|
||||
|
||||
local include_in_completion = vim.g.lazyvim_mini_snippets_in_completion == nil
|
||||
or vim.g.lazyvim_mini_snippets_in_completion
|
||||
|
||||
local function expand_from_lsp(snippet)
|
||||
local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
|
||||
insert({ body = snippet })
|
||||
end
|
||||
|
||||
local function jump(direction)
|
||||
local is_active = MiniSnippets.session.get(false) ~= nil
|
||||
if is_active then
|
||||
MiniSnippets.session.jump(direction)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
---@type fun(snippets, insert) | nil
|
||||
local expand_select_override = nil
|
||||
|
||||
return {
|
||||
-- disable builtin snippet support:
|
||||
{ "garymjr/nvim-snippets", optional = true, enabled = false },
|
||||
-- disable luasnip:
|
||||
{ "L3MON4D3/LuaSnip", optional = true, enabled = false },
|
||||
|
||||
-- add mini.snippets
|
||||
desc = "mini.snippets(beta), a plugin to manage and expand snippets (alternative for luasnip)",
|
||||
{
|
||||
"echasnovski/mini.snippets",
|
||||
event = "InsertEnter", -- don't depend on other plugins to load...
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = function()
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
LazyVim.cmp.actions.snippet_stop = function() end -- by design, <esc> should not stop the session!
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
LazyVim.cmp.actions.snippet_forward = function()
|
||||
return jump("next")
|
||||
end
|
||||
|
||||
local mini_snippets = require("mini.snippets")
|
||||
return {
|
||||
snippets = { mini_snippets.gen_loader.from_lang() },
|
||||
|
||||
-- Following the behavior of vim.snippets,
|
||||
-- the intended usage of <esc> is to be able to temporarily exit into normal mode for quick edits.
|
||||
--
|
||||
-- If you'd rather stop the snippet on <esc>, activate the line below in your own config:
|
||||
-- mappings = { stop = "<esc>" }, -- <c-c> by default, see :h MiniSnippets-session
|
||||
|
||||
expand = {
|
||||
select = function(snippets, insert)
|
||||
-- Close completion window on snippet select - vim.ui.select
|
||||
-- Needed to remove virtual text for fzf-lua and telescope, but not for mini.pick...
|
||||
local select = expand_select_override or MiniSnippets.default_select
|
||||
select(snippets, insert)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- nvim-cmp integration
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
dependencies = include_in_completion and { "abeldekat/cmp-mini-snippets" } or nil,
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
local cmp_config = require("cmp.config")
|
||||
|
||||
opts.snippet = {
|
||||
expand = function(args)
|
||||
expand_from_lsp(args.body)
|
||||
cmp.resubscribe({ "TextChangedI", "TextChangedP" })
|
||||
cmp_config.set_onetime({ sources = {} })
|
||||
end,
|
||||
}
|
||||
|
||||
if include_in_completion then
|
||||
table.insert(opts.sources, { name = "mini_snippets" })
|
||||
else
|
||||
expand_select_override = function(snippets, insert)
|
||||
-- stylua: ignore
|
||||
if cmp.visible() then cmp.close() end
|
||||
MiniSnippets.default_select(snippets, insert)
|
||||
end
|
||||
end
|
||||
end,
|
||||
-- stylua: ignore
|
||||
-- counterpart to <tab> defined in cmp.mappings
|
||||
keys = include_in_completion and { { "<s-tab>", function() jump("prev") end, mode = "i" } } or nil,
|
||||
},
|
||||
|
||||
-- blink.cmp integration
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
-- Return early
|
||||
if include_in_completion then
|
||||
opts.snippets = { preset = "mini_snippets" }
|
||||
return
|
||||
end
|
||||
|
||||
-- Standalone --
|
||||
expand_select_override = function(snippets, insert)
|
||||
-- Schedule, otherwise blink's virtual text is not removed on vim.ui.select
|
||||
require("blink.cmp").cancel()
|
||||
vim.schedule(function()
|
||||
MiniSnippets.default_select(snippets, insert)
|
||||
end)
|
||||
end
|
||||
--
|
||||
-- Blink performs a require on blink.cmp.sources.snippets.default
|
||||
-- By removing the source, the default engine will not be used
|
||||
opts.sources.default = vim.tbl_filter(function(source)
|
||||
return source ~= "snippets"
|
||||
end, opts.sources.default)
|
||||
opts.snippets = { -- need to repeat blink's preset here
|
||||
expand = expand_from_lsp,
|
||||
active = function()
|
||||
return MiniSnippets.session.get(false) ~= nil
|
||||
end,
|
||||
jump = function(direction)
|
||||
jump(direction == -1 and "prev" or "next")
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -27,11 +27,32 @@ end
|
|||
|
||||
return {
|
||||
desc = "Fast and modern file picker",
|
||||
-- recommended = true,
|
||||
recommended = true,
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
opts = {
|
||||
picker = {},
|
||||
picker = {
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
["<a-c>"] = {
|
||||
"toggle_cwd",
|
||||
mode = { "n", "i" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actions = {
|
||||
---@param p snacks.Picker
|
||||
toggle_cwd = function(p)
|
||||
local root = LazyVim.root({ buf = p.input.filter.current_buf, normalize = true })
|
||||
local cwd = vim.fs.normalize((vim.uv or vim.loop).cwd() or ".")
|
||||
local current = p:cwd()
|
||||
p:set_cwd(current == root and cwd or root)
|
||||
p:find()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
|
@ -41,12 +62,14 @@ return {
|
|||
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
|
||||
-- find
|
||||
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>fB", function() Snacks.picker.buffers({ hidden = true, nofile = true }) end, desc = "Buffers (all)" },
|
||||
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
|
||||
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
|
||||
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
|
||||
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Files (git-files)" },
|
||||
{ "<leader>fr", LazyVim.pick("oldfiles"), desc = "Recent" },
|
||||
{ "<leader>fR", LazyVim.pick("oldfiles", { filter = { cwd = true }}), desc = "Recent (cwd)" },
|
||||
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
|
||||
-- git
|
||||
{ "<leader>gc", function() Snacks.picker.git_log() end, desc = "Git Log" },
|
||||
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (hunks)" },
|
||||
|
@ -56,6 +79,7 @@ return {
|
|||
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
|
||||
{ "<leader>sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
|
||||
{ "<leader>sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" },
|
||||
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
||||
{ "<leader>sw", LazyVim.pick("grep_word"), desc = "Visual selection or word (Root Dir)", mode = { "n", "x" } },
|
||||
{ "<leader>sW", LazyVim.pick("grep_word", { root = false }), desc = "Visual selection or word (cwd)", mode = { "n", "x" } },
|
||||
-- search
|
||||
|
@ -66,6 +90,7 @@ return {
|
|||
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
||||
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
|
||||
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
|
||||
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
|
||||
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
|
||||
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
||||
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
|
||||
|
@ -73,8 +98,9 @@ return {
|
|||
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
|
||||
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
|
||||
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
|
||||
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undotree" },
|
||||
-- ui
|
||||
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
||||
{ "<leader>qp", function() Snacks.picker.projects() end, desc = "Projects" },
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -130,6 +130,7 @@ return {
|
|||
|
||||
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
||||
dap = { hotcodereplace = "auto", config_overrides = {} },
|
||||
-- Can set this to false to disable main class scan, which is a performance killer for large project
|
||||
dap_main = {},
|
||||
test = true,
|
||||
settings = {
|
||||
|
@ -246,7 +247,9 @@ return {
|
|||
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||
-- custom init for Java debugger
|
||||
require("jdtls").setup_dap(opts.dap)
|
||||
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
|
||||
if opts.dap_main then
|
||||
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
|
||||
end
|
||||
|
||||
-- Java Test require Java debugger to work
|
||||
if opts.test and mason_registry.is_installed("java-test") then
|
||||
|
|
|
@ -48,7 +48,7 @@ return {
|
|||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = sql_ft,
|
||||
callback = function()
|
||||
if LazyVim.has("nvim-cmp") then
|
||||
if LazyVim.cmp_engine() == "nvim-cmp" then
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- global sources
|
||||
|
|
|
@ -57,9 +57,14 @@ return {
|
|||
{
|
||||
"snacks.nvim",
|
||||
opts = {
|
||||
bigfile = { enabled = false },
|
||||
dashboard = { enabled = false },
|
||||
indent = { enabled = false },
|
||||
scroll = { enabled = false },
|
||||
input = { enabled = false },
|
||||
notifier = { enabled = false },
|
||||
picker = { enabled = false },
|
||||
quickfile = { enabled = false },
|
||||
scroll = { enabled = false },
|
||||
statuscolumn = { enabled = false },
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---@class lazyvim.util.root
|
||||
---@overload fun(): string
|
||||
local M = setmetatable({}, {
|
||||
__call = function(m)
|
||||
return m.get()
|
||||
__call = function(m, ...)
|
||||
return m.get(...)
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue