From 11280b44f2f3812b60e99b7e07e4d37bee418cb0 Mon Sep 17 00:00:00 2001 From: Hubert Pelczarski <41551030+hoob3rt@users.noreply.github.com> Date: Mon, 10 May 2021 18:27:39 +0200 Subject: [PATCH] fix: extensions not working without deepcopy (#223) --- lua/lualine/extensions/chadtree.lua | 4 ++-- lua/lualine/extensions/fugitive.lua | 9 +++++++-- lua/lualine/extensions/fzf.lua | 2 +- lua/lualine/extensions/nerdtree.lua | 2 +- lua/lualine/extensions/nvim-tree.lua | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lua/lualine/extensions/chadtree.lua b/lua/lualine/extensions/chadtree.lua index f210ea5..992f5fb 100644 --- a/lua/lualine/extensions/chadtree.lua +++ b/lua/lualine/extensions/chadtree.lua @@ -4,9 +4,9 @@ local nerdtree = require('lualine.extensions.nerdtree') local M = {} -M.sections = nerdtree.sections +M.sections = vim.deepcopy(nerdtree.sections) -M.inactive_sections = nerdtree.inactive_sections +M.inactive_sections = vim.deepcopy(nerdtree.inactive_sections) M.filetypes = {'CHADTree'} diff --git a/lua/lualine/extensions/fugitive.lua b/lua/lualine/extensions/fugitive.lua index c2685f3..7488b05 100644 --- a/lua/lualine/extensions/fugitive.lua +++ b/lua/lualine/extensions/fugitive.lua @@ -2,9 +2,14 @@ -- MIT license, see LICENSE for more details. local M = {} -M.sections = {lualine_a = {'FugitiveHead'}, lualine_z = {'location'}} +local function fugitive_branch() + local icon = '' -- e0a0 + return icon .. ' ' .. vim.fn.FugitiveHead() +end -M.inactive_sections = M.sections +M.sections = {lualine_a = {fugitive_branch}, lualine_z = {'location'}} + +M.inactive_sections = vim.deepcopy(M.sections) M.filetypes = {'fugitive'} diff --git a/lua/lualine/extensions/fzf.lua b/lua/lualine/extensions/fzf.lua index 107b702..72f38ce 100644 --- a/lua/lualine/extensions/fzf.lua +++ b/lua/lualine/extensions/fzf.lua @@ -6,7 +6,7 @@ local M = {} M.sections = {lualine_a = {fzf_statusline}} -M.inactive_sections = M.sections +M.inactive_sections = vim.deepcopy(M.sections) M.filetypes = {'fzf'} diff --git a/lua/lualine/extensions/nerdtree.lua b/lua/lualine/extensions/nerdtree.lua index f3741af..43a4ca9 100644 --- a/lua/lualine/extensions/nerdtree.lua +++ b/lua/lualine/extensions/nerdtree.lua @@ -6,7 +6,7 @@ local M = {} M.sections = {lualine_a = {get_short_cwd}} -M.inactive_sections = M.sections +M.inactive_sections = vim.deepcopy(M.sections) M.filetypes = {'nerdtree'} diff --git a/lua/lualine/extensions/nvim-tree.lua b/lua/lualine/extensions/nvim-tree.lua index ae73fd5..aef405c 100644 --- a/lua/lualine/extensions/nvim-tree.lua +++ b/lua/lualine/extensions/nvim-tree.lua @@ -4,9 +4,9 @@ local nerdtree = require('lualine.extensions.nerdtree') local M = {} -M.sections = nerdtree.sections +M.sections = vim.deepcopy(nerdtree.inactive_sections) -M.inactive_sections = nerdtree.inactive_sections +M.inactive_sections = vim.deepcopy(nerdtree.inactive_sections) M.filetypes = {'NvimTree'}