diff --git a/README.md b/README.md index 95110b9..50bbfd9 100644 --- a/README.md +++ b/README.md @@ -899,6 +899,7 @@ extensions = {'quickfix'} - quickfix - symbols-outline - toggleterm +- trouble #### Custom extensions diff --git a/lua/lualine/extensions/trouble.lua b/lua/lualine/extensions/trouble.lua new file mode 100644 index 0000000..1f79ecf --- /dev/null +++ b/lua/lualine/extensions/trouble.lua @@ -0,0 +1,22 @@ +local M = {} + +local function get_trouble_mode() + local opts = require('trouble.config').options + + local words = vim.split(opts.mode, '[%W]') + for i, word in ipairs(words) do + words[i] = word:sub(1, 1):upper() .. word:sub(2) + end + + return table.concat(words, ' ') +end + +M.sections = { + lualine_a = { + get_trouble_mode, + }, +} + +M.filetypes = { 'Trouble' } + +return M