todo trouble + add ocaml
This commit is contained in:
parent
89a71aa455
commit
e6688019fd
|
@ -134,6 +134,7 @@ return { -- LSP Configuration & Plugins
|
||||||
-- - settings (table): Override the default settings passed when initializing the server.
|
-- - settings (table): Override the default settings passed when initializing the server.
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
local servers = {
|
local servers = {
|
||||||
|
ocamllsp = {},
|
||||||
clangd = {},
|
clangd = {},
|
||||||
bashls = {},
|
bashls = {},
|
||||||
gopls = {},
|
gopls = {},
|
||||||
|
@ -183,6 +184,7 @@ return { -- LSP Configuration & Plugins
|
||||||
'stylua', -- Used to format Lua code
|
'stylua', -- Used to format Lua code
|
||||||
'black', -- Used to format Python code
|
'black', -- Used to format Python code
|
||||||
'prettierd',
|
'prettierd',
|
||||||
|
'ocamlformat',
|
||||||
})
|
})
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
return {
|
||||||
'folke/trouble.nvim',
|
'folke/trouble.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -5,7 +39,44 @@ return {
|
||||||
win = {
|
win = {
|
||||||
size = 0.4,
|
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',
|
cmd = 'Trouble',
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
|
@ -13,6 +84,11 @@ return {
|
||||||
'<cmd>Trouble diagnostics toggle focus=true<cr>',
|
'<cmd>Trouble diagnostics toggle focus=true<cr>',
|
||||||
desc = 'Diagnostics (Trouble)',
|
desc = 'Diagnostics (Trouble)',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'<leader>to',
|
||||||
|
'<cmd>Trouble todo toggle focus=true<cr>',
|
||||||
|
desc = 'Todo (Trouble)',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'<leader>ts',
|
'<leader>ts',
|
||||||
'<cmd>Trouble symbols toggle focus=true<cr>',
|
'<cmd>Trouble symbols toggle focus=true<cr>',
|
||||||
|
|
Loading…
Reference in New Issue