mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 08:53:33 +02:00
feat(extras): added extra for the trouble.nvim
v3 beta
This commit is contained in:
parent
dd54a29cc5
commit
bb6aa98cbf
4 changed files with 76 additions and 6 deletions
4
NEWS.md
4
NEWS.md
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## 10.x
|
## 10.x
|
||||||
|
|
||||||
|
- **trouble.nvim** has been rewritten from scratch and is now in beta.
|
||||||
|
I've added a new extra for it (`trouble-v3`) for those of you who want to try it out.
|
||||||
|
You can find the updated docs [here](https://github.com/folke/trouble.nvim/tree/dev)
|
||||||
|
|
||||||
- The **lazygit** integration now configures:
|
- The **lazygit** integration now configures:
|
||||||
|
|
||||||
- the theme based on the colorscheme
|
- the theme based on the colorscheme
|
||||||
|
|
71
lua/lazyvim/plugins/extras/editor/trouble-v3.lua
Normal file
71
lua/lazyvim/plugins/extras/editor/trouble-v3.lua
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
|
||||||
|
for _, other in ipairs({ "aerial", "outline" }) do
|
||||||
|
local extra = "lazyvim.plugins.extras.editor." .. other
|
||||||
|
if vim.tbl_contains(Config.json.data.extras, extra) then
|
||||||
|
other = other:gsub("^%l", string.upper)
|
||||||
|
LazyVim.error({
|
||||||
|
"**Trouble v3** includes support for document symbols.",
|
||||||
|
("You currently have the **%s** extra enabled."):format(other),
|
||||||
|
"Please disable it in your config.",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
branch = "dev",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)" },
|
||||||
|
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics (Trouble)" },
|
||||||
|
{ "<leader>cs", "<cmd>Trouble symbols toggle focus=false<cr>", desc = "Symbols (Trouble)" },
|
||||||
|
{ "<leader>xL", "<cmd>Trouble loclist toggle<cr>", desc = "Location List (Trouble)" },
|
||||||
|
{ "<leader>xQ", "<cmd>Trouble qflist toggle<cr>", desc = "Quickfix List (Trouble)" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- lualine integration
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local trouble = require("trouble")
|
||||||
|
local symbols = trouble.statusline({
|
||||||
|
mode = "lsp_document_symbols",
|
||||||
|
groups = {},
|
||||||
|
title = false,
|
||||||
|
filter = { range = true },
|
||||||
|
format = "{kind_icon}{symbol.name:Normal}",
|
||||||
|
})
|
||||||
|
table.insert(opts.sections.lualine_c, {
|
||||||
|
symbols.get,
|
||||||
|
cond = symbols.has,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"folke/edgy.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- disable for now
|
||||||
|
do
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
|
||||||
|
opts[pos] = opts[pos] or {}
|
||||||
|
table.insert(opts[pos], {
|
||||||
|
ft = "trouble",
|
||||||
|
filter = function(_buf, win)
|
||||||
|
return vim.w[win].trouble
|
||||||
|
and vim.w[win].trouble.position == pos
|
||||||
|
and vim.w[win].trouble.type == "split"
|
||||||
|
and vim.w[win].trouble.relative == "editor"
|
||||||
|
and not vim.w[win].trouble_preview
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -40,12 +40,6 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
"Trouble",
|
"Trouble",
|
||||||
{
|
|
||||||
ft = "trouble",
|
|
||||||
filter = function(buf, win)
|
|
||||||
return vim.api.nvim_win_get_config(win).relative == ""
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ ft = "qf", title = "QuickFix" },
|
{ ft = "qf", title = "QuickFix" },
|
||||||
{
|
{
|
||||||
ft = "help",
|
ft = "help",
|
||||||
|
|
|
@ -4,6 +4,7 @@ local Config = require("lazyvim.config")
|
||||||
local prios = {
|
local prios = {
|
||||||
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
||||||
["lazyvim.plugins.extras.editor.outline"] = 100,
|
["lazyvim.plugins.extras.editor.outline"] = 100,
|
||||||
|
["lazyvim.plugins.extras.editor.trouble-v3"] = 100,
|
||||||
["lazyvim.plugins.extras.test.core"] = 1,
|
["lazyvim.plugins.extras.test.core"] = 1,
|
||||||
["lazyvim.plugins.extras.dap.core"] = 1,
|
["lazyvim.plugins.extras.dap.core"] = 1,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue