Merge branch 'main' into feat(lang.python)

This commit is contained in:
qizidog 2025-05-02 16:28:24 +08:00 committed by GitHub
commit edd4d790e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 57 additions and 56 deletions

View file

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim Last change: 2025 February 15 *LazyVim.txt* For Neovim Last change: 2025 March 01
============================================================================== ==============================================================================
Table of Contents *LazyVim-table-of-contents* Table of Contents *LazyVim-table-of-contents*

View file

@ -179,7 +179,7 @@ map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" })
-- highlights under cursor -- highlights under cursor
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" }) map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
map("n", "<leader>uI", "<cmd>InspectTree<cr>", { desc = "Inspect Tree" }) map("n", "<leader>uI", function() vim.treesitter.inspect_tree() vim.api.nvim_input("I") end, { desc = "Inspect Tree" })
-- LazyVim Changelog -- LazyVim Changelog
map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" }) map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" })

View file

@ -1,28 +1,3 @@
local M = {}
---@param kind string
function M.pick(kind)
return function()
local actions = require("CopilotChat.actions")
local items = actions[kind .. "_actions"]()
if not items then
LazyVim.warn("No " .. kind .. " found on the current line")
return
end
local map = {
telescope = "telescope",
fzf = "fzflua",
snacks = "snacks",
}
for _, def in pairs(LazyVim.config.get_defaults()) do
if def.enabled and map[def.name] then
return require("CopilotChat.integrations." .. map[def.name]).pick(items)
end
end
Snacks.notify.error("No picker found")
end
end
return { return {
{ {
"CopilotC-Nvim/CopilotChat.nvim", "CopilotC-Nvim/CopilotChat.nvim",
@ -62,16 +37,25 @@ return {
{ {
"<leader>aq", "<leader>aq",
function() function()
local input = vim.fn.input("Quick Chat: ") vim.ui.input({
if input ~= "" then prompt = "Quick Chat: ",
require("CopilotChat").ask(input) }, function(input)
end if input ~= "" then
require("CopilotChat").ask(input)
end
end)
end, end,
desc = "Quick Chat (CopilotChat)", desc = "Quick Chat (CopilotChat)",
mode = { "n", "v" }, mode = { "n", "v" },
}, },
-- Show prompts actions with telescope {
{ "<leader>ap", M.pick("prompt"), desc = "Prompt Actions (CopilotChat)", mode = { "n", "v" } }, "<leader>ap",
function()
require("CopilotChat").select_prompt()
end,
desc = "Prompt Actions (CopilotChat)",
mode = { "n", "v" },
},
}, },
config = function(_, opts) config = function(_, opts)
local chat = require("CopilotChat") local chat = require("CopilotChat")

View file

@ -83,7 +83,6 @@ return {
cmdline = { cmdline = {
enabled = false, enabled = false,
sources = {},
}, },
keymap = { keymap = {
@ -144,6 +143,7 @@ return {
items = transform_items and transform_items(ctx, items) or items items = transform_items and transform_items(ctx, items) or items
for _, item in ipairs(items) do for _, item in ipairs(items) do
item.kind = kind_idx or item.kind item.kind = kind_idx or item.kind
item.kind_icon = LazyVim.config.icons.kinds[item.kind_name] or item.kind_icon or nil
end end
return items return items
end end

View file

@ -140,21 +140,25 @@ return {
end end
-- Standalone -- -- Standalone --
local blink = require("blink.cmp")
expand_select_override = function(snippets, insert) expand_select_override = function(snippets, insert)
-- Schedule, otherwise blink's virtual text is not removed on vim.ui.select -- Schedule, otherwise blink's virtual text is not removed on vim.ui.select
require("blink.cmp").cancel() blink.cancel()
vim.schedule(function() vim.schedule(function()
MiniSnippets.default_select(snippets, insert) MiniSnippets.default_select(snippets, insert)
end) end)
end end
-- --
-- Blink performs a require on blink.cmp.sources.snippets.default -- Blink performs a require on blink.cmp.sources.snippets.default
-- By removing the source, the default engine will not be used -- By removing the source, that default engine will not be used
opts.sources.default = vim.tbl_filter(function(source) opts.sources.default = vim.tbl_filter(function(source)
return source ~= "snippets" return source ~= "snippets"
end, opts.sources.default) end, opts.sources.default)
opts.snippets = { -- need to repeat blink's preset here opts.snippets = { -- need to repeat blink's preset here
expand = expand_from_lsp, expand = function(snippet)
expand_from_lsp(snippet)
blink.resubscribe()
end,
active = function() active = function()
return MiniSnippets.session.get(false) ~= nil return MiniSnippets.session.get(false) ~= nil
end, end,

View file

@ -72,7 +72,6 @@ return {
{ "<leader>fR", function() Snacks.picker.recent({ filter = { cwd = true }}) end, desc = "Recent (cwd)" }, { "<leader>fR", function() Snacks.picker.recent({ filter = { cwd = true }}) end, desc = "Recent (cwd)" },
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" }, { "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
-- git -- git
{ "<leader>gc", function() Snacks.picker.git_log() end, desc = "Git Log" },
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (hunks)" }, { "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (hunks)" },
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" }, { "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" }, { "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },

View file

@ -3,22 +3,12 @@ local pick_chezmoi = function()
require("telescope").extensions.chezmoi.find_files() require("telescope").extensions.chezmoi.find_files()
elseif LazyVim.pick.picker.name == "fzf" then elseif LazyVim.pick.picker.name == "fzf" then
local fzf_lua = require("fzf-lua") local fzf_lua = require("fzf-lua")
local results = require("chezmoi.commands").list() local actions = {
local chezmoi = require("chezmoi.commands") ["enter"] = function(selected)
fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = os.getenv("HOME") })
local opts = { end,
fzf_opts = {},
fzf_colors = true,
actions = {
["default"] = function(selected)
chezmoi.edit({
targets = { "~/" .. selected[1] },
args = { "--watch" },
})
end,
},
} }
fzf_lua.fzf_exec(results, opts) fzf_lua.files({ cmd = "chezmoi managed --include=files,symlinks", actions = actions })
elseif LazyVim.pick.picker.name == "snacks" then elseif LazyVim.pick.picker.name == "snacks" then
local results = require("chezmoi.commands").list({ local results = require("chezmoi.commands").list({
args = { args = {
@ -65,6 +55,7 @@ return {
}, },
{ {
"xvzc/chezmoi.nvim", "xvzc/chezmoi.nvim",
cmd = { "ChezmoiEdit" },
keys = { keys = {
{ {
"<leader>sz", "<leader>sz",
@ -120,6 +111,27 @@ return {
table.insert(opts.config.center, 5, projects) table.insert(opts.config.center, 5, projects)
end, end,
}, },
{
"folke/snacks.nvim",
optional = true,
opts = function(_, opts)
local chezmoi_entry = {
icon = "",
key = "c",
desc = "Config",
action = pick_chezmoi,
}
local config_index
for i = #opts.dashboard.preset.keys, 1, -1 do
if opts.dashboard.preset.keys[i].key == "c" then
table.remove(opts.dashboard.preset.keys, i)
config_index = i
break
end
end
table.insert(opts.dashboard.preset.keys, config_index, chezmoi_entry)
end,
},
-- Filetype icons -- Filetype icons
{ {

View file

@ -42,12 +42,14 @@ return {
"pwntester/octo.nvim", "pwntester/octo.nvim",
opts = function(_, opts) opts = function(_, opts)
vim.treesitter.language.register("markdown", "octo") vim.treesitter.language.register("markdown", "octo")
if LazyVim.has("telescope.nvim") then if LazyVim.has_extra("editor.telescope") then
opts.picker = "telescope" opts.picker = "telescope"
elseif LazyVim.has("fzf-lua") then elseif LazyVim.has_extra("editor.fzf") then
opts.picker = "fzf-lua" opts.picker = "fzf-lua"
elseif LazyVim.has_extra("editor.snacks_picker") then
opts.picker = "snacks"
else else
LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua`") LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua` or `snacks.nvim`")
end end
-- Keep some empty windows in sessions -- Keep some empty windows in sessions