mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2025-08-08 03:55:04 +02:00
todo trouble + add ocaml
This commit is contained in:
parent
89a71aa455
commit
e6688019fd
2 changed files with 79 additions and 1 deletions
|
@ -1,3 +1,37 @@
|
|||
local tagIdx = {}
|
||||
local tags = {
|
||||
[0] = '',
|
||||
[1] = 'FIX',
|
||||
[2] = 'TODO',
|
||||
[3] = 'WARN',
|
||||
[4] = 'NOTE',
|
||||
}
|
||||
local numTags = 0
|
||||
for key, value in pairs(tags) do
|
||||
tagIdx[value] = key
|
||||
numTags = numTags + 1
|
||||
end
|
||||
|
||||
local todoFilter = function(view, inc)
|
||||
local f = view:get_filter 'tag'
|
||||
local tag = tags[((tagIdx[f and f.filter.tag] or 0) + inc) % numTags]
|
||||
view:filter({ tag = tag }, {
|
||||
id = 'tag',
|
||||
template = '{hl:Title}Filter:{hl} {tag}',
|
||||
del = tag == '',
|
||||
})
|
||||
end
|
||||
|
||||
local diagnosticsFilter = function(view, inc)
|
||||
local f = view:get_filter 'severity'
|
||||
local severity = ((f and f.filter.severity or 0) + inc) % 5
|
||||
view:filter({ severity = severity }, {
|
||||
id = 'severity',
|
||||
template = '{hl:Title}Filter:{hl} {severity}',
|
||||
del = severity == 0,
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
opts = {
|
||||
|
@ -5,7 +39,44 @@ return {
|
|||
win = {
|
||||
size = 0.4,
|
||||
},
|
||||
}, -- for default options, refer to the configuration section for custom setup.
|
||||
---@type table<string, trouble.Mode>
|
||||
modes = {
|
||||
diagnostics = {
|
||||
mode = 'diagnostics',
|
||||
keys = {
|
||||
s = {
|
||||
action = function(view)
|
||||
diagnosticsFilter(view, 1)
|
||||
end,
|
||||
desc = 'Cycle Severity Filter Forward',
|
||||
},
|
||||
S = {
|
||||
action = function(view)
|
||||
diagnosticsFilter(view, -1)
|
||||
end,
|
||||
desc = 'Cycle Severity Filter Backward',
|
||||
},
|
||||
},
|
||||
},
|
||||
todo = {
|
||||
mode = 'todo',
|
||||
keys = {
|
||||
s = {
|
||||
action = function(view)
|
||||
todoFilter(view, 1)
|
||||
end,
|
||||
desc = 'Cycle Tag Filter Forward',
|
||||
},
|
||||
S = {
|
||||
action = function(view)
|
||||
todoFilter(view, -1)
|
||||
end,
|
||||
desc = 'Cycle Tag Filter Backward',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
cmd = 'Trouble',
|
||||
keys = {
|
||||
{
|
||||
|
@ -13,6 +84,11 @@ return {
|
|||
'<cmd>Trouble diagnostics toggle focus=true<cr>',
|
||||
desc = 'Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>to',
|
||||
'<cmd>Trouble todo toggle focus=true<cr>',
|
||||
desc = 'Todo (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>ts',
|
||||
'<cmd>Trouble symbols toggle focus=true<cr>',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue