From 6aecf4a341f1ea7e6cc0bb835a0971259c0d3e6d Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Wed, 4 Aug 2021 07:13:37 +0600 Subject: [PATCH] feat: Expose current config with lualine.get_config() --- README.md | 7 +++++++ doc/lualine.txt | 5 +++++ lua/lualine/config.lua | 9 ++++++++- lua/lualine/init.lua | 7 ++++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f564db..236c281 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,13 @@ require'lualine'.setup { +If you want to get your current lualine config. you can +do so with +```lua +require'lualine'.get_config() + +``` + --- ### Starting lualine ```lua diff --git a/doc/lualine.txt b/doc/lualine.txt index 63e7933..7125bf6 100644 --- a/doc/lualine.txt +++ b/doc/lualine.txt @@ -66,6 +66,11 @@ Default config~ extensions = {} } +If you want to get your current lualine config. you can +do so with > + require'lualine'.get_config() + +< ------------------------------------------------------------------------------ STARTING LUALINE *lualine-starting_lualine* *lualine.setup()* > diff --git a/lua/lualine/config.lua b/lua/lualine/config.lua index 0a73890..7aff0ae 100644 --- a/lua/lualine/config.lua +++ b/lua/lualine/config.lua @@ -69,4 +69,11 @@ local function apply_configuration(config_table) return vim.deepcopy(config) end -return {config = vim.deepcopy(config), apply_configuration = apply_configuration} +local function get_current_conifg() + return vim.deepcopy(config) +end + +return { + get_config = get_current_conifg, + apply_configuration = apply_configuration +} diff --git a/lua/lualine/init.lua b/lua/lualine/init.lua index c98b18e..920043c 100644 --- a/lua/lualine/init.lua +++ b/lua/lualine/init.lua @@ -237,4 +237,9 @@ local function setup(user_config) set_tabline() end -return {setup = setup, statusline = status_dispatch, tabline = tabline} +return { + setup = setup, + statusline = status_dispatch, + tabline = tabline, + get_config = config_module.get_config, +}