Compare commits
40 Commits
Author | SHA1 | Date | |
---|---|---|---|
91fe7ef568 | |||
46785526a6 | |||
d3500a4a33 | |||
f48d55a653 | |||
9ccdbf644c | |||
dbed614655 | |||
61dc00147b | |||
d23e8572e8 | |||
53911748dd | |||
59204df1cb | |||
3a30070a4c | |||
7aa37064a2 | |||
b3373f3428 | |||
c9ab8224f5 | |||
cdff9de172 | |||
945ee7e283 | |||
07a137199c | |||
0f6ff53ce3 | |||
10ed3082a4 | |||
c6e8c5b450 | |||
692aa08da7 | |||
46cf5347b5 | |||
f9b31372ae | |||
ad6c9bcfab | |||
31f876cc4c | |||
1eea51606e | |||
ae6d8f1a34 | |||
9eec03d890 | |||
79608fbc4f | |||
3ebe30685d | |||
e46dd4e9b2 | |||
ab4e57a4bf | |||
027d6bc2e8 | |||
cb1e1b9c82 | |||
d73397c4aa | |||
2bae438570 | |||
8ba7c64a7d | |||
55b07dee21 | |||
8c94842b4a | |||
d19a004136 |
75
CHANGELOG.md
75
CHANGELOG.md
@ -1,5 +1,80 @@
|
||||
# Changelog
|
||||
|
||||
## [11.8.0](https://github.com/LazyVim/LazyVim/compare/v11.7.0...v11.8.0) (2024-05-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **extras:** added extra for CopilotChat.nvim ([4678552](https://github.com/LazyVim/LazyVim/commit/46785526a63b401d812de79fbbecca26414dc8e8))
|
||||
* **git:** Change Commit Log to use Lazygit ([#2959](https://github.com/LazyVim/LazyVim/issues/2959)) ([9ccdbf6](https://github.com/LazyVim/LazyVim/commit/9ccdbf644cc6f38ade7fdd7e554e8da8b38091ac))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **lang/rust:** Remove `rust-analyzer` from `nvim-lspconfig` ([#2755](https://github.com/LazyVim/LazyVim/issues/2755)) ([f48d55a](https://github.com/LazyVim/LazyVim/commit/f48d55a653cc829e7dfecc3c01bf1ccbdf337257))
|
||||
* **laygit:** normalize paths. Fixes [#3327](https://github.com/LazyVim/LazyVim/issues/3327) ([dbed614](https://github.com/LazyVim/LazyVim/commit/dbed614655fdf13436654356c0ba156d45ee7cc4))
|
||||
* **laygit:** use correct .git root for git blame ([d23e857](https://github.com/LazyVim/LazyVim/commit/d23e8572e8ccc96b686ef8187aadf56ad47edd67))
|
||||
* **rust:** show error when rust-analyzer not found ([d3500a4](https://github.com/LazyVim/LazyVim/commit/d3500a4a33ab87c6225d991302a72012c54b26fe))
|
||||
* **snippet:** always use top-level snippet session. Fixes [#3199](https://github.com/LazyVim/LazyVim/issues/3199) ([5391174](https://github.com/LazyVim/LazyVim/commit/53911748ddc7f92793c6fec6348a9cde32159ef3))
|
||||
|
||||
## [11.7.0](https://github.com/LazyVim/LazyVim/compare/v11.6.1...v11.7.0) (2024-05-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* lazyrc files are now a lazy.nvim feature ([3a30070](https://github.com/LazyVim/LazyVim/commit/3a30070a4cd4465699d1fdd384d95bdb9935376b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **illuminate:** s/enabed/enabled ([#3313](https://github.com/LazyVim/LazyVim/issues/3313)) ([c9ab822](https://github.com/LazyVim/LazyVim/commit/c9ab8224f54fb6e93050fab1043b9d1efb917c23))
|
||||
* **lsp:** added a-n, a-p for document highlights and cycling. Closes [#3320](https://github.com/LazyVim/LazyVim/issues/3320) ([b3373f3](https://github.com/LazyVim/LazyVim/commit/b3373f3428f8ded19f8162a46bf9f2784299b43b))
|
||||
* **lspconfig:** make `opts` a function ([#3311](https://github.com/LazyVim/LazyVim/issues/3311)) ([7aa3706](https://github.com/LazyVim/LazyVim/commit/7aa37064a2421f044c61d4baf42f71a923fab94b))
|
||||
* **lsp:** correct previous reference keymap description ([#3314](https://github.com/LazyVim/LazyVim/issues/3314)) ([cdff9de](https://github.com/LazyVim/LazyVim/commit/cdff9de17226701f37069744a402b7afd9942f66))
|
||||
* **lsp:** properly get buffer for dynamic capabilities ([#3315](https://github.com/LazyVim/LazyVim/issues/3315)) ([07a1371](https://github.com/LazyVim/LazyVim/commit/07a137199cde87f089776b3f992bd9ed08889cac))
|
||||
|
||||
## [11.6.1](https://github.com/LazyVim/LazyVim/compare/v11.6.0...v11.6.1) (2024-05-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **lsp:** use proper buffer for dynamic capabilities. Fixes [#3246](https://github.com/LazyVim/LazyVim/issues/3246) ([10ed308](https://github.com/LazyVim/LazyVim/commit/10ed3082a415b525628dfaebdcd007c7e96a5b87))
|
||||
|
||||
## [11.6.0](https://github.com/LazyVim/LazyVim/compare/v11.5.0...v11.6.0) (2024-05-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **markdown:** add formatter for mdx ([ae6d8f1](https://github.com/LazyVim/LazyVim/commit/ae6d8f1a34fff49f9f1abf9fdd8a559c95b85cf3))
|
||||
* **markdown:** configure conform for markdown files ([#2308](https://github.com/LazyVim/LazyVim/issues/2308)) ([9eec03d](https://github.com/LazyVim/LazyVim/commit/9eec03d890f7846e6f47e12ebbe369c7177fd5f1))
|
||||
* **telescope:** add telescope jumplist keymap ([#3268](https://github.com/LazyVim/LazyVim/issues/3268)) ([79608fb](https://github.com/LazyVim/LazyVim/commit/79608fbc4fe7d5fbd2d238e8d8ebfce7d576b7c2))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **lsp:** only enableinlay hints for when buffer is an actual file. See [#3284](https://github.com/LazyVim/LazyVim/issues/3284) ([46cf534](https://github.com/LazyVim/LazyVim/commit/46cf5347b5649e856a69b9f52ccad8a671ddefc6))
|
||||
* **python:** extras.lang.python to enable venv select keys on ft ([#3280](https://github.com/LazyVim/LazyVim/issues/3280)) ([f9b3137](https://github.com/LazyVim/LazyVim/commit/f9b31372aef9f1f862bf24879ba388f0d89c2349))
|
||||
* set markdown for LICENSE file ([#3276](https://github.com/LazyVim/LazyVim/issues/3276)) ([1eea516](https://github.com/LazyVim/LazyVim/commit/1eea51606e1ec1035c440a4ca9b3eab053337a7d))
|
||||
|
||||
## [11.5.0](https://github.com/LazyVim/LazyVim/compare/v11.4.1...v11.5.0) (2024-05-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **comments:** use ts-comments.nvim instead of nvim-ts-context-commentstring on Neovim 0.10 ([8ba7c64](https://github.com/LazyVim/LazyVim/commit/8ba7c64a7da9e46f2ac601919508803824208935))
|
||||
* **telescope:** add quickfix and telescope keymaps ([#3077](https://github.com/LazyVim/LazyVim/issues/3077)) ([ab4e57a](https://github.com/LazyVim/LazyVim/commit/ab4e57a4bfe6107c21a25450292ef69537a2b37b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cmp:** fix cmp's broken snippet parsing functionality. Fixes [#3266](https://github.com/LazyVim/LazyVim/issues/3266) ([2bae438](https://github.com/LazyVim/LazyVim/commit/2bae438570aa96904836e56d8dad7f33eb3204ee))
|
||||
* **lsp:** sometimes lsp client is not fully initialized and doesnt yet have client.supports_method on 0.9.5. Fixes [#3263](https://github.com/LazyVim/LazyVim/issues/3263) ([8c94842](https://github.com/LazyVim/LazyVim/commit/8c94842b4a613995bf4c0c79febcd74c310439d0))
|
||||
* **neo-tree:** better icons for git staged/unstaged ([e46dd4e](https://github.com/LazyVim/LazyVim/commit/e46dd4e9b2ac68a5058447ef73b413605d15ae62))
|
||||
* **nvim-snippets:** enable global friendly-snippets. See [#3240](https://github.com/LazyVim/LazyVim/issues/3240) ([55b07de](https://github.com/LazyVim/LazyVim/commit/55b07dee21ee5306624e16dd90c2b3c9c0f3ddde))
|
||||
* **snippets:** fixes custom snippets. use my branch till nvim-snippets PR is merged. Fixes [#3240](https://github.com/LazyVim/LazyVim/issues/3240) ([cb1e1b9](https://github.com/LazyVim/LazyVim/commit/cb1e1b9c82b405fa277f1869cd04dcd9c4507412))
|
||||
* **snippets:** make friendly snippets a dep of nvim-snippets ([d73397c](https://github.com/LazyVim/LazyVim/commit/d73397c4aaac74d95970ac06caffa25abd7c2af4))
|
||||
* **snippets:** my nvim-snippets PR is merged, so remove work-around. That was quick :) ([027d6bc](https://github.com/LazyVim/LazyVim/commit/027d6bc2e896d453153f48a8c15db2a627698dc8))
|
||||
|
||||
## [11.4.1](https://github.com/LazyVim/LazyVim/compare/v11.4.0...v11.4.1) (2024-05-20)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 20
|
||||
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 27
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
|
@ -132,7 +132,7 @@ local defaults = {
|
||||
}
|
||||
|
||||
M.json = {
|
||||
version = 4,
|
||||
version = 5,
|
||||
data = {
|
||||
version = nil, ---@type string?
|
||||
news = {}, ---@type table<string, string>
|
||||
|
@ -136,6 +136,10 @@ map("n", "<leader>gf", function()
|
||||
LazyVim.lazygit({args = { "-f", vim.trim(git_path) }})
|
||||
end, { desc = "Lazygit Current File History" })
|
||||
|
||||
map("n", "<leader>gl", function()
|
||||
LazyVim.lazygit({ args = { "log" } })
|
||||
end, { desc = "Lazygit Log" })
|
||||
|
||||
-- quit
|
||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" })
|
||||
|
||||
|
@ -71,6 +71,16 @@ return {
|
||||
for _, source in ipairs(opts.sources) do
|
||||
source.group_index = source.group_index or 1
|
||||
end
|
||||
|
||||
local parse = require("cmp.utils.snippet").parse
|
||||
require("cmp.utils.snippet").parse = function(input)
|
||||
local ok, ret = pcall(parse, input)
|
||||
if ok then
|
||||
return ret
|
||||
end
|
||||
return LazyVim.cmp.snippet_preview(input)
|
||||
end
|
||||
|
||||
local cmp = require("cmp")
|
||||
cmp.setup(opts)
|
||||
cmp.event:on("confirm_done", function(event)
|
||||
@ -89,8 +99,14 @@ return {
|
||||
and {
|
||||
"nvim-cmp",
|
||||
dependencies = {
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
{ "garymjr/nvim-snippets", opts = { friendly_snippets = true } },
|
||||
{
|
||||
"garymjr/nvim-snippets",
|
||||
opts = {
|
||||
friendly_snippets = true,
|
||||
global_snippets = { "all", "global" },
|
||||
},
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
},
|
||||
opts = function(_, opts)
|
||||
opts.snippet = {
|
||||
@ -150,22 +166,10 @@ return {
|
||||
|
||||
-- comments
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
lazy = true,
|
||||
opts = {
|
||||
enable_autocmd = false,
|
||||
},
|
||||
init = function()
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.schedule(function()
|
||||
local get_option = vim.filetype.get_option
|
||||
vim.filetype.get_option = function(filetype, option)
|
||||
return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring()
|
||||
or get_option(filetype, option)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
"folke/ts-comments.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
enabled = vim.fn.has("nvim-0.10") == 1,
|
||||
},
|
||||
{
|
||||
import = "lazyvim.plugins.extras.coding.mini-comment",
|
||||
|
@ -96,6 +96,12 @@ return {
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
@ -197,11 +203,14 @@ return {
|
||||
{ "<leader>sG", LazyVim.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
|
||||
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
|
||||
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
|
||||
{ "<leader>sj", "<cmd>Telescope jumplist<cr>", desc = "Jumplist" },
|
||||
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
|
||||
{ "<leader>sl", "<cmd>Telescope loclist<cr>", desc = "Location List" },
|
||||
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
|
||||
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
|
||||
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
|
||||
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
|
||||
{ "<leader>sq", "<cmd>Telescope quickfix<cr>", desc = "Quickfix List" },
|
||||
{ "<leader>sw", LazyVim.telescope("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" },
|
||||
{ "<leader>sW", LazyVim.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
|
||||
{ "<leader>sw", LazyVim.telescope("grep_string"), mode = "v", desc = "Selection (Root Dir)" },
|
||||
|
91
lua/lazyvim/plugins/extras/coding/copilot-chat.lua
Normal file
91
lua/lazyvim/plugins/extras/coding/copilot-chat.lua
Normal file
@ -0,0 +1,91 @@
|
||||
return {
|
||||
{
|
||||
"CopilotC-Nvim/CopilotChat.nvim",
|
||||
branch = "canary",
|
||||
cmd = "CopilotChat",
|
||||
opts = {
|
||||
model = "gpt-4",
|
||||
auto_insert_mode = true,
|
||||
window = {
|
||||
width = 0.4,
|
||||
},
|
||||
selection = function(source)
|
||||
local select = require("CopilotChat.select")
|
||||
return select.visual(source) or select.buffer(source)
|
||||
end,
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>aa",
|
||||
function()
|
||||
return require("CopilotChat").toggle()
|
||||
end,
|
||||
desc = "Toggle (CopilotChat)",
|
||||
},
|
||||
{
|
||||
"<leader>ax",
|
||||
function()
|
||||
return require("CopilotChat").clear()
|
||||
end,
|
||||
desc = "Clear (CopilotChat)",
|
||||
},
|
||||
{
|
||||
"<leader>aq",
|
||||
function()
|
||||
local input = vim.fn.input("Quick Chat: ")
|
||||
if input ~= "" then
|
||||
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
|
||||
end
|
||||
end,
|
||||
desc = "Quick Chat (CopilotChat)",
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
LazyVim.on_load("which-key.nvim", function()
|
||||
vim.schedule(function()
|
||||
require("which-key").register({ a = { name = "+CopilotChat (AI)" } }, { prefix = "<leader>" })
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
config = function(_, opts)
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "copilot-chat",
|
||||
callback = function()
|
||||
vim.opt_local.relativenumber = false
|
||||
vim.opt_local.number = false
|
||||
end,
|
||||
})
|
||||
require("CopilotChat").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
keys = {
|
||||
-- Show help actions with telescope
|
||||
{
|
||||
"<leader>ad",
|
||||
function()
|
||||
local actions = require("CopilotChat.actions")
|
||||
local help = actions.help_actions()
|
||||
if not help then
|
||||
LazyVim.warn("No diagnostics found on the current line")
|
||||
return
|
||||
end
|
||||
require("CopilotChat.integrations.telescope").pick(help)
|
||||
end,
|
||||
desc = "Diagnostic Help (CopilotChat)",
|
||||
},
|
||||
-- Show prompts actions with telescope
|
||||
{
|
||||
"<leader>ap",
|
||||
function()
|
||||
local actions = require("CopilotChat.actions")
|
||||
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
|
||||
end,
|
||||
desc = "Prompt Actions (CopilotChat)",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -10,4 +10,11 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
lazy = true,
|
||||
opts = {
|
||||
enable_autocmd = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -40,6 +40,6 @@ return {
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = { document_highlight = { enabed = false } },
|
||||
opts = { document_highlight = { enabled = false } },
|
||||
},
|
||||
}
|
||||
|
@ -5,6 +5,16 @@ return {
|
||||
root = "README.md",
|
||||
})
|
||||
end,
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
["markdown"] = { { "prettierd", "prettier" }, "markdownlint", "markdown-toc" },
|
||||
["markdown.mdx"] = { { "prettierd", "prettier" }, "markdownlint", "markdown-toc" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
|
@ -127,7 +127,7 @@ return {
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
|
||||
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" } },
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
|
@ -90,6 +90,12 @@ return {
|
||||
},
|
||||
config = function(_, opts)
|
||||
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
|
||||
if vim.fn.executable("rust-analyzer") == 0 then
|
||||
LazyVim.error(
|
||||
"**rust-analyzer** not found in PATH, please install it.\nhttps://rust-analyzer.github.io/",
|
||||
{ title = "rustaceanvim" }
|
||||
)
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
@ -98,7 +104,6 @@ return {
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
rust_analyzer = {},
|
||||
taplo = {
|
||||
keys = {
|
||||
{
|
||||
@ -115,11 +120,6 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
rust_analyzer = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
--[[
|
||||
Enable project-specific plugin specs.
|
||||
|
||||
File .lazy.lua:
|
||||
is read when present in the current working directory
|
||||
should return a plugin spec
|
||||
has to be manually trusted for each instance of the file
|
||||
|
||||
This extra should be the last plugin spec added to lazy.nvim
|
||||
|
||||
See:
|
||||
:h 'exrc'
|
||||
:h :trust
|
||||
--]]
|
||||
local filepath = vim.fn.fnamemodify(".lazy.lua", ":p")
|
||||
local file = vim.secure.read(filepath)
|
||||
if not file then
|
||||
return {}
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
once = true,
|
||||
callback = function()
|
||||
local Config = require("lazy.core.config")
|
||||
local lazyrc_idx = LazyVim.plugin.extra_idx("lazyrc")
|
||||
|
||||
if lazyrc_idx and lazyrc_idx ~= #Config.spec.modules then
|
||||
LazyVim.warn({
|
||||
"The `lazyrc` extra must be the last plugin spec added to **lazy.nvim**. ",
|
||||
"",
|
||||
"Add `{ import = 'lazyvim.plugins.extras.lazyrc' }` to file `config.lazy`. ",
|
||||
"Do not use the `LazyExtras` command. ",
|
||||
}, { title = "LazyVim", once = true })
|
||||
end
|
||||
end,
|
||||
})
|
||||
return loadstring(file)()
|
@ -10,103 +10,105 @@ return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
-- options for vim.diagnostic.config()
|
||||
---@type vim.diagnostic.Opts
|
||||
diagnostics = {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = "if_many",
|
||||
prefix = "●",
|
||||
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||
-- prefix = "icons",
|
||||
},
|
||||
severity_sort = true,
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = LazyVim.config.icons.diagnostics.Error,
|
||||
[vim.diagnostic.severity.WARN] = LazyVim.config.icons.diagnostics.Warn,
|
||||
[vim.diagnostic.severity.HINT] = LazyVim.config.icons.diagnostics.Hint,
|
||||
[vim.diagnostic.severity.INFO] = LazyVim.config.icons.diagnostics.Info,
|
||||
opts = function()
|
||||
return {
|
||||
-- options for vim.diagnostic.config()
|
||||
---@type vim.diagnostic.Opts
|
||||
diagnostics = {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = "if_many",
|
||||
prefix = "●",
|
||||
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||
-- prefix = "icons",
|
||||
},
|
||||
severity_sort = true,
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = LazyVim.config.icons.diagnostics.Error,
|
||||
[vim.diagnostic.severity.WARN] = LazyVim.config.icons.diagnostics.Warn,
|
||||
[vim.diagnostic.severity.HINT] = LazyVim.config.icons.diagnostics.Hint,
|
||||
[vim.diagnostic.severity.INFO] = LazyVim.config.icons.diagnostics.Info,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
|
||||
-- Be aware that you also will need to properly configure your LSP server to
|
||||
-- provide the inlay hints.
|
||||
inlay_hints = {
|
||||
enabled = true,
|
||||
},
|
||||
-- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0
|
||||
-- Be aware that you also will need to properly configure your LSP server to
|
||||
-- provide the code lenses.
|
||||
codelens = {
|
||||
enabled = false,
|
||||
},
|
||||
-- Enable lsp cursor word highlighting
|
||||
document_highlight = {
|
||||
enabled = true,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = {},
|
||||
-- options for vim.lsp.buf.format
|
||||
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||
-- but can be also overridden when specified
|
||||
format = {
|
||||
formatting_options = nil,
|
||||
timeout_ms = nil,
|
||||
},
|
||||
-- LSP Server Settings
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
lua_ls = {
|
||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||
-- Use this to add any additional keymaps
|
||||
-- for specific lsp servers
|
||||
---@type LazyKeysSpec[]
|
||||
-- keys = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
codeLens = {
|
||||
enable = true,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
doc = {
|
||||
privateName = { "^_" },
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
setType = false,
|
||||
paramType = true,
|
||||
paramName = "Disable",
|
||||
semicolon = "Disable",
|
||||
arrayIndex = "Disable",
|
||||
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
|
||||
-- Be aware that you also will need to properly configure your LSP server to
|
||||
-- provide the inlay hints.
|
||||
inlay_hints = {
|
||||
enabled = true,
|
||||
},
|
||||
-- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0
|
||||
-- Be aware that you also will need to properly configure your LSP server to
|
||||
-- provide the code lenses.
|
||||
codelens = {
|
||||
enabled = false,
|
||||
},
|
||||
-- Enable lsp cursor word highlighting
|
||||
document_highlight = {
|
||||
enabled = true,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = {},
|
||||
-- options for vim.lsp.buf.format
|
||||
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||
-- but can be also overridden when specified
|
||||
format = {
|
||||
formatting_options = nil,
|
||||
timeout_ms = nil,
|
||||
},
|
||||
-- LSP Server Settings
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
lua_ls = {
|
||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||
-- Use this to add any additional keymaps
|
||||
-- for specific lsp servers
|
||||
---@type LazyKeysSpec[]
|
||||
-- keys = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
codeLens = {
|
||||
enable = true,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
doc = {
|
||||
privateName = { "^_" },
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
setType = false,
|
||||
paramType = true,
|
||||
paramName = "Disable",
|
||||
semicolon = "Disable",
|
||||
arrayIndex = "Disable",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
-- tsserver = function(_, opts)
|
||||
-- require("typescript").setup({ server = opts })
|
||||
-- return true
|
||||
-- end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
-- tsserver = function(_, opts)
|
||||
-- require("typescript").setup({ server = opts })
|
||||
-- return true
|
||||
-- end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
if LazyVim.has("neoconf.nvim") then
|
||||
@ -141,7 +143,9 @@ return {
|
||||
-- inlay hints
|
||||
if opts.inlay_hints.enabled then
|
||||
LazyVim.lsp.on_supports_method("textDocument/inlayHint", function(client, buffer)
|
||||
LazyVim.toggle.inlay_hints(buffer, true)
|
||||
if vim.api.nvim_buf_is_valid(buffer) and vim.bo[buffer].buftype == "" then
|
||||
LazyVim.toggle.inlay_hints(buffer, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -3,8 +3,8 @@ local M = {}
|
||||
---@type LazyKeysLspSpec[]|nil
|
||||
M._keys = nil
|
||||
|
||||
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string}
|
||||
---@alias LazyKeysLsp LazyKeys|{has?:string}
|
||||
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string, cond?:fun():boolean}
|
||||
---@alias LazyKeysLsp LazyKeys|{has?:string, cond?:fun():boolean}
|
||||
|
||||
---@return LazyKeysLspSpec[]
|
||||
function M.get()
|
||||
@ -40,8 +40,14 @@ function M.get()
|
||||
desc = "Source Action",
|
||||
has = "codeAction",
|
||||
},
|
||||
{ "]]", function() LazyVim.lsp.words.jump(vim.v.count1) end, has = "documentHighlight", desc = "Next Reference" },
|
||||
{ "[[", function() LazyVim.lsp.words.jump(-vim.v.count1) end, has = "documentHighlight", desc = "Next Reference" },
|
||||
{ "]]", function() LazyVim.lsp.words.jump(vim.v.count1) end, has = "documentHighlight",
|
||||
desc = "Next Reference", cond = function() return LazyVim.lsp.words.enabled end },
|
||||
{ "[[", function() LazyVim.lsp.words.jump(-vim.v.count1) end, has = "documentHighlight",
|
||||
desc = "Prev Reference", cond = function() return LazyVim.lsp.words.enabled end },
|
||||
{ "<a-n>", function() LazyVim.lsp.words.jump(vim.v.count1, true) end, has = "documentHighlight",
|
||||
desc = "Next Reference", cond = function() return LazyVim.lsp.words.enabled end },
|
||||
{ "<a-p>", function() LazyVim.lsp.words.jump(-vim.v.count1, true) end, has = "documentHighlight",
|
||||
desc = "Prev Reference", cond = function() return LazyVim.lsp.words.enabled end },
|
||||
}
|
||||
if LazyVim.has("inc-rename.nvim") then
|
||||
M._keys[#M._keys + 1] = {
|
||||
@ -72,7 +78,7 @@ function M.has(buffer, method)
|
||||
return false
|
||||
end
|
||||
|
||||
---@return (LazyKeys|{has?:string})[]
|
||||
---@return LazyKeysLsp[]
|
||||
function M.resolve(buffer)
|
||||
local Keys = require("lazy.core.handler.keys")
|
||||
if not Keys.resolve then
|
||||
@ -93,8 +99,12 @@ function M.on_attach(_, buffer)
|
||||
local keymaps = M.resolve(buffer)
|
||||
|
||||
for _, keys in pairs(keymaps) do
|
||||
if not keys.has or M.has(buffer, keys.has) then
|
||||
local has = not keys.has or M.has(buffer, keys.has)
|
||||
local cond = not (keys.cond == false or ((type(keys.cond) == "function") and not keys.cond()))
|
||||
|
||||
if has and cond then
|
||||
local opts = Keys.opts(keys)
|
||||
opts.cond = nil
|
||||
opts.has = nil
|
||||
opts.silent = opts.silent ~= false
|
||||
opts.buffer = buffer
|
||||
|
@ -86,6 +86,13 @@ function M.confirm(opts)
|
||||
end
|
||||
|
||||
function M.expand(snippet)
|
||||
-- Native sessions don't support nested snippet sessions.
|
||||
-- Always use the top-level session.
|
||||
-- Otherwise, when on the first placeholder and selecting a new completion,
|
||||
-- the nested session will be used instead of the top-level session.
|
||||
-- See: https://github.com/LazyVim/LazyVim/issues/3199
|
||||
local session = vim.snippet.active() and vim.snippet._session or nil
|
||||
|
||||
local ok = pcall(vim.snippet.expand, snippet)
|
||||
if not ok then
|
||||
local fixed = M.snippet_fix(snippet)
|
||||
@ -101,6 +108,11 @@ function M.expand(snippet)
|
||||
{ title = "vim.snippet" }
|
||||
)
|
||||
end
|
||||
|
||||
-- Restore top-level session when needed
|
||||
if session then
|
||||
vim.snippet._session = session
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -85,6 +85,10 @@ function M.migrate()
|
||||
or extra == "lazyvim.plugins.extras.ui.treesitter-rewrite"
|
||||
)
|
||||
end, json.data.extras or {})
|
||||
elseif json.data.version == 4 then
|
||||
json.data.extras = vim.tbl_filter(function(extra)
|
||||
return not (extra == "lazyvim.plugins.extras.lazyrc")
|
||||
end, json.data.extras or {})
|
||||
end
|
||||
|
||||
M.save()
|
||||
|
@ -32,7 +32,7 @@ M.theme = {
|
||||
unstagedChangesColor = { fg = "DiagnosticError" },
|
||||
}
|
||||
|
||||
M.theme_path = vim.fn.stdpath("cache") .. "/lazygit-theme.yml"
|
||||
M.theme_path = LazyVim.norm(vim.fn.stdpath("cache") .. "/lazygit-theme.yml")
|
||||
|
||||
-- re-create config file on startup
|
||||
M.dirty = true
|
||||
@ -69,7 +69,7 @@ function M.open(opts)
|
||||
local ok, lines = pcall(Process.exec, { "lazygit", "-cd" })
|
||||
if ok then
|
||||
M.config_dir = lines[1]
|
||||
vim.env.LG_CONFIG_FILE = M.config_dir .. "/config.yml" .. "," .. M.theme_path
|
||||
vim.env.LG_CONFIG_FILE = LazyVim.norm(M.config_dir .. "/config.yml" .. "," .. M.theme_path)
|
||||
else
|
||||
---@diagnostic disable-next-line: cast-type-mismatch
|
||||
---@cast lines string
|
||||
@ -154,7 +154,8 @@ function M.blame_line(opts)
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local line = cursor[1]
|
||||
local file = vim.api.nvim_buf_get_name(0)
|
||||
local cmd = { "git", "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
|
||||
local root = LazyVim.root.detectors.pattern(0, { ".git" })[1]
|
||||
local cmd = { "git", "-C", root, "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
|
||||
return require("lazy.util").float_cmd(cmd, opts)
|
||||
end
|
||||
|
||||
|
@ -43,12 +43,13 @@ function M.setup()
|
||||
---@diagnostic disable-next-line: no-unknown
|
||||
local ret = register_capability(err, res, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
local buffer = vim.api.nvim_get_current_buf()
|
||||
if client then
|
||||
vim.api.nvim_exec_autocmds("User", {
|
||||
pattern = "LspDynamicCapability",
|
||||
data = { client_id = client.id, buffer = buffer },
|
||||
})
|
||||
for buffer in pairs(client.attached_buffers) do
|
||||
vim.api.nvim_exec_autocmds("User", {
|
||||
pattern = "LspDynamicCapability",
|
||||
data = { client_id = client.id, buffer = buffer },
|
||||
})
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@ -58,10 +59,22 @@ end
|
||||
|
||||
---@param client vim.lsp.Client
|
||||
function M._check_methods(client, buffer)
|
||||
-- don't trigger on invalid buffers
|
||||
if not vim.api.nvim_buf_is_valid(buffer) then
|
||||
return
|
||||
end
|
||||
-- don't trigger on non-listed buffers
|
||||
if not vim.bo[buffer].buflisted then
|
||||
return
|
||||
end
|
||||
-- don't trigger on nofile buffers
|
||||
if vim.bo[buffer].buftype == "nofile" then
|
||||
return
|
||||
end
|
||||
for method, clients in pairs(M._supports_method) do
|
||||
clients[client] = clients[client] or {}
|
||||
if not clients[client][buffer] then
|
||||
if client.supports_method(method, { bufnr = buffer }) then
|
||||
if client.supports_method and client.supports_method(method, { bufnr = buffer }) then
|
||||
clients[client][buffer] = true
|
||||
vim.api.nvim_exec_autocmds("User", {
|
||||
pattern = "LspSupportsMethod",
|
||||
@ -197,8 +210,9 @@ function M.format(opts)
|
||||
end
|
||||
end
|
||||
|
||||
---@alias LspWord {from:{[1]:number, [2]:number}, to:{[1]:number, [2]:number}, current?:boolean} 1-0 indexed
|
||||
---@alias LspWord {from:{[1]:number, [2]:number}, to:{[1]:number, [2]:number}} 1-0 indexed
|
||||
M.words = {}
|
||||
M.words.enabled = false
|
||||
M.words.ns = vim.api.nvim_create_namespace("vim_lsp_references")
|
||||
|
||||
---@param opts? {enabled?: boolean}
|
||||
@ -207,11 +221,13 @@ function M.words.setup(opts)
|
||||
if not opts.enabled then
|
||||
return
|
||||
end
|
||||
M.words.enabled = true
|
||||
local handler = vim.lsp.handlers["textDocument/documentHighlight"]
|
||||
vim.lsp.handlers["textDocument/documentHighlight"] = function(err, result, ctx, config)
|
||||
if not vim.api.nvim_buf_is_loaded(ctx.bufnr) then
|
||||
return
|
||||
end
|
||||
vim.lsp.buf.clear_references()
|
||||
return handler(err, result, ctx, config)
|
||||
end
|
||||
|
||||
@ -220,7 +236,7 @@ function M.words.setup(opts)
|
||||
group = vim.api.nvim_create_augroup("lsp_word_" .. buf, { clear = true }),
|
||||
buffer = buf,
|
||||
callback = function(ev)
|
||||
if not M.words.at() then
|
||||
if not ({ M.words.get() })[2] then
|
||||
if ev.event:find("CursorMoved") then
|
||||
vim.lsp.buf.clear_references()
|
||||
else
|
||||
@ -232,38 +248,35 @@ function M.words.setup(opts)
|
||||
end)
|
||||
end
|
||||
|
||||
---@return LspWord[]
|
||||
---@return LspWord[] words, number? current
|
||||
function M.words.get()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
return vim.tbl_map(function(extmark)
|
||||
local ret = {
|
||||
local current, ret = nil, {} ---@type number?, LspWord[]
|
||||
for _, extmark in ipairs(vim.api.nvim_buf_get_extmarks(0, M.words.ns, 0, -1, { details = true })) do
|
||||
local w = {
|
||||
from = { extmark[2] + 1, extmark[3] },
|
||||
to = { extmark[4].end_row + 1, extmark[4].end_col },
|
||||
}
|
||||
if cursor[1] >= ret.from[1] and cursor[1] <= ret.to[1] and cursor[2] >= ret.from[2] and cursor[2] <= ret.to[2] then
|
||||
ret.current = true
|
||||
end
|
||||
return ret
|
||||
end, vim.api.nvim_buf_get_extmarks(0, M.words.ns, 0, -1, { details = true }))
|
||||
end
|
||||
|
||||
---@param words? LspWord[]
|
||||
---@return LspWord?, number?
|
||||
function M.words.at(words)
|
||||
for idx, word in ipairs(words or M.words.get()) do
|
||||
if word.current then
|
||||
return word, idx
|
||||
ret[#ret + 1] = w
|
||||
if cursor[1] >= w.from[1] and cursor[1] <= w.to[1] and cursor[2] >= w.from[2] and cursor[2] <= w.to[2] then
|
||||
current = #ret
|
||||
end
|
||||
end
|
||||
return ret, current
|
||||
end
|
||||
|
||||
function M.words.jump(count)
|
||||
local words = M.words.get()
|
||||
local _, idx = M.words.at(words)
|
||||
---@param count number
|
||||
---@param cycle? boolean
|
||||
function M.words.jump(count, cycle)
|
||||
local words, idx = M.words.get()
|
||||
if not idx then
|
||||
return
|
||||
end
|
||||
local target = words[idx + count]
|
||||
idx = idx + count
|
||||
if cycle then
|
||||
idx = (idx - 1) % #words + 1
|
||||
end
|
||||
local target = words[idx]
|
||||
if target then
|
||||
vim.api.nvim_win_set_cursor(0, target.from)
|
||||
end
|
||||
|
@ -13,6 +13,7 @@ M.deprecated_extras = {
|
||||
["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**",
|
||||
["lazyvim.plugins.extras.ui.treesitter-rewrite"] = "Disabled `treesitter-rewrite` extra for now. Not ready yet.",
|
||||
["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a core LazyVim plugin (again)",
|
||||
["lazyvim.plugins.extras.lazyrc"] = "local spec files are now a lazy.nvim feature",
|
||||
}
|
||||
|
||||
M.deprecated_modules = {
|
||||
|
Reference in New Issue
Block a user