From 76009624553b2f02314e65bad39758b724ec902d Mon Sep 17 00:00:00 2001 From: Matthew Sia <71731492+matthewsia98@users.noreply.github.com> Date: Thu, 30 Mar 2023 02:21:11 -0400 Subject: [PATCH] feat: added extension for trouble (#932) * added extension for trouble * add trouble extension to readme --- README.md | 1 + lua/lualine/extensions/trouble.lua | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 lua/lualine/extensions/trouble.lua 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