Update generated neovim config
This commit is contained in:
166
config/neovim/store/lazy-plugins/trouble.nvim/docs/examples.md
Normal file
166
config/neovim/store/lazy-plugins/trouble.nvim/docs/examples.md
Normal file
@ -0,0 +1,166 @@
|
||||
# Examples
|
||||
|
||||
## Window Options
|
||||
|
||||
### Preview in small float top right
|
||||
|
||||

|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
preview_float = {
|
||||
mode = "diagnostics",
|
||||
preview = {
|
||||
type = "float",
|
||||
relative = "editor",
|
||||
border = "rounded",
|
||||
title = "Preview",
|
||||
title_pos = "center",
|
||||
position = { 0, -2 },
|
||||
size = { width = 0.3, height = 0.3 },
|
||||
zindex = 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Preview in a split to the right of the trouble list
|
||||
|
||||

|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
test = {
|
||||
mode = "diagnostics",
|
||||
preview = {
|
||||
type = "split",
|
||||
relative = "win",
|
||||
position = "right",
|
||||
size = 0.3,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Make Trouble look like v2
|
||||
|
||||
```lua
|
||||
{
|
||||
icons = {
|
||||
indent = {
|
||||
middle = " ",
|
||||
last = " ",
|
||||
top = " ",
|
||||
ws = "│ ",
|
||||
},
|
||||
},
|
||||
modes = {
|
||||
diagnostics = {
|
||||
groups = {
|
||||
{ "filename", format = "{file_icon} {basename:Title} {count}" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Filtering
|
||||
|
||||
### Diagnostics for the current buffer only
|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
diagnostics_buffer = {
|
||||
mode = "diagnostics", -- inherit from diagnostics mode
|
||||
filter = { buf = 0 }, -- filter diagnostics to the current buffer
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Diagnostics for the current buffer and errors from the current project
|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
mydiags = {
|
||||
mode = "diagnostics", -- inherit from diagnostics mode
|
||||
filter = {
|
||||
any = {
|
||||
buf = 0, -- current buffer
|
||||
{
|
||||
severity = vim.diagnostic.severity.ERROR, -- errors only
|
||||
-- limit to files in the current project
|
||||
function(item)
|
||||
return item.filename:find((vim.loop or vim.uv).cwd(), 1, true)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Diagnostics Cascade
|
||||
|
||||
The following example shows how to create a new mode that
|
||||
shows only the most severe diagnostics.
|
||||
|
||||
Once those are resolved, less severe diagnostics will be shown.
|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
cascade = {
|
||||
mode = "diagnostics", -- inherit from diagnostics mode
|
||||
filter = function(items)
|
||||
local severity = vim.diagnostic.severity.HINT
|
||||
for _, item in ipairs(items) do
|
||||
severity = math.min(severity, item.severity)
|
||||
end
|
||||
return vim.tbl_filter(function(item)
|
||||
return item.severity == severity
|
||||
end, items)
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Other
|
||||
|
||||
### Automatically Open Trouble Quickfix
|
||||
|
||||
```lua
|
||||
vim.api.nvim_create_autocmd("QuickFixCmdPost", {
|
||||
callback = function()
|
||||
vim.cmd([[Trouble qflist open]])
|
||||
end,
|
||||
})
|
||||
```
|
||||
|
||||
Test with something like `:silent grep vim %`
|
||||
|
||||
### Open Trouble Quickfix when the qf list opens
|
||||
|
||||
> This is **NOT** recommended, since you won't be able to use the quickfix list for other things.
|
||||
|
||||
```lua
|
||||
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
callback = function(ev)
|
||||
if vim.bo[ev.buf].buftype == "quickfix" then
|
||||
vim.schedule(function()
|
||||
vim.cmd([[cclose]])
|
||||
vim.cmd([[Trouble qflist open]])
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
```
|
||||
98
config/neovim/store/lazy-plugins/trouble.nvim/docs/filter.md
Normal file
98
config/neovim/store/lazy-plugins/trouble.nvim/docs/filter.md
Normal file
@ -0,0 +1,98 @@
|
||||
# Filter
|
||||
|
||||
## Examples
|
||||
|
||||
A simple filter is a table whose keys are item attributes.
|
||||
The following filter keeps items with attribute `buf = 0` **and** `ft = 'lua'`,
|
||||
i.e., diagnostics with severity error to the current buffer when its filetype is `lua`.
|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
my_diagnostics = {
|
||||
mode = 'diagnostics',
|
||||
filter = { buf = 0, ft = 'lua' },
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
A filter may be a function that takes `items` as parameter.
|
||||
The following filter keeps items with severity `HINT`
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
my_diagnostics = {
|
||||
mode = 'diagnostics',
|
||||
filter = function(items)
|
||||
return vim.tbl_filter(function(item)
|
||||
return item.severity == vim.diagnostic.severity.HINT
|
||||
end, items)
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Advanced examples
|
||||
|
||||
### The `not` filter
|
||||
|
||||
The `not` negates filter results.
|
||||
The following filter **removes** diagnostics with severity `INFO`
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
my_diagnostics = {
|
||||
mode = 'diagnostics',
|
||||
filter = {
|
||||
['not'] = { severity = vim.diagnostic.severity.INFO },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### The `any` filter
|
||||
|
||||
The `any` filter provides logical disjunction.
|
||||
The following filter **keeps** diagnostics for the current buffer **or** diagnostics with severity `ERROR` for the current project.
|
||||
|
||||
```lua
|
||||
{
|
||||
modes = {
|
||||
my_diagnostics = {
|
||||
mode = 'diagnostics',
|
||||
filter = {
|
||||
any = {
|
||||
buf = 0,
|
||||
{
|
||||
severity = vim.diagnostic.severity.ERROR,
|
||||
function(item)
|
||||
return item.filename:find((vim.loop or vim.uv).cwd(), 1, true)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Item attributes
|
||||
|
||||
Item attributes are documented in `lua/trouble/item.lua`
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------ | -------------------------- | -------------------------------------------------- |
|
||||
| **any** | Logical `or` | Filter result disjunction |
|
||||
| **basename** | `string` | File name. |
|
||||
| **buf** | `number` | Buffer id. |
|
||||
| **dirname** | `string` | Directory path. |
|
||||
| **filename** | `string` | Full file path. |
|
||||
| **ft** | `string` or `string[]` | File types. |
|
||||
| **kind** | `string` | Symbol kind. See `:h symbol`. |
|
||||
| **not** | Logical `not` | Filter result negation. |
|
||||
| **pos** | `{[1]:number, [2]:number}` | Item position. |
|
||||
| **severity** | `number` | Diagnostic severity. See `:h diagnostic-severity`. |
|
||||
| **source** | `string` | Item source. |
|
||||
Reference in New Issue
Block a user