Trouble-v3
info
You can enable the extra with the :LazyExtras
command.
Plugins marked as optional will only be configured if they are installed.
Alternatively, you can add it to your lazy.nvim
imports
lua/config/lazy.lua
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.editor.trouble-v3" },
{ import = "plugins" },
},
})
Below you can find a list of included plugins and their default settings.
caution
You don't need to copy the default settings to your config. They are only shown here for reference.
trouble.nvim
- Options
- Full Spec
opts = nil
{
"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>cS",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP references/definitions/... (Trouble)",
},
{ "<leader>xL", "<cmd>Trouble loclist toggle<cr>", desc = "Location List (Trouble)" },
{ "<leader>xQ", "<cmd>Trouble qflist toggle<cr>", desc = "Quickfix List (Trouble)" },
{
"[q",
function()
if require("trouble").is_open() then
require("trouble").prev({ skip_groups = true, jump = true })
else
local ok, err = pcall(vim.cmd.cprev)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = "Previous Trouble/Quickfix Item",
},
},
}
lualine.nvim (optional)
lualine integration
- Options
- Full Spec
opts = function(_, opts)
local trouble = require("trouble")
if not trouble.statusline then
LazyVim.error("You have enabled the **trouble-v3** extra,\nbut still need to update it with `:Lazy`")
return
end
local symbols = trouble.statusline({
mode = "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
{
"nvim-lualine/lualine.nvim",
optional = true,
opts = function(_, opts)
local trouble = require("trouble")
if not trouble.statusline then
LazyVim.error("You have enabled the **trouble-v3** extra,\nbut still need to update it with `:Lazy`")
return
end
local symbols = trouble.statusline({
mode = "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,
}
edgy.nvim (optional)
- Options
- Full Spec
opts = function(_, opts)
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
{
"folke/edgy.nvim",
optional = true,
opts = function(_, opts)
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,
}
telescope.nvim (optional)
- Options
- Full Spec
opts = function(_, opts)
local open_with_trouble = require("trouble.sources.telescope").open
return vim.tbl_deep_extend("force", opts, {
defaults = {
mappings = {
i = {
["<c-t>"] = open_with_trouble,
["<a-t>"] = open_with_trouble,
},
},
},
})
end
{
"nvim-telescope/telescope.nvim",
optional = true,
opts = function(_, opts)
local open_with_trouble = require("trouble.sources.telescope").open
return vim.tbl_deep_extend("force", opts, {
defaults = {
mappings = {
i = {
["<c-t>"] = open_with_trouble,
["<a-t>"] = open_with_trouble,
},
},
},
})
end,
}