From 846e5bdabfc2bb49407a1e32ed5deec1375c3b08 Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Fri, 1 Oct 2021 19:54:57 +0600 Subject: [PATCH] fix(extension): fix some extension showing a section in whole line For now use a dummy component to lualine_x on extensions that only define lualine_a. This will let the renderer know right sections do exist. closes #73 --- lua/lualine/extensions/fzf.lua | 8 ++++++++ lua/lualine/extensions/nerdtree.lua | 8 ++++++++ lua/lualine/extensions/toggleterm.lua | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/lua/lualine/extensions/fzf.lua b/lua/lualine/extensions/fzf.lua index 4afda21..0a59801 100644 --- a/lua/lualine/extensions/fzf.lua +++ b/lua/lualine/extensions/fzf.lua @@ -4,10 +4,18 @@ local function fzf_statusline() return 'FZF' end +local empty = { + function() + return ' ' + end, + padding = 0, +} + local M = {} M.sections = { lualine_a = { fzf_statusline }, + lualine_x = { empty }, } M.filetypes = { 'fzf' } diff --git a/lua/lualine/extensions/nerdtree.lua b/lua/lualine/extensions/nerdtree.lua index 27b117b..52de858 100644 --- a/lua/lualine/extensions/nerdtree.lua +++ b/lua/lualine/extensions/nerdtree.lua @@ -4,10 +4,18 @@ local function get_short_cwd() return vim.fn.fnamemodify(vim.fn.getcwd(), ':~') end +local empty = { + function() + return ' ' + end, + padding = 0, +} + local M = {} M.sections = { lualine_a = { get_short_cwd }, + lualine_x = { empty }, } M.filetypes = { 'nerdtree' } diff --git a/lua/lualine/extensions/toggleterm.lua b/lua/lualine/extensions/toggleterm.lua index a9be001..f0e1efa 100644 --- a/lua/lualine/extensions/toggleterm.lua +++ b/lua/lualine/extensions/toggleterm.lua @@ -5,10 +5,18 @@ local function toggleterm_statusline() return 'ToggleTerm #' .. vim.b.toggle_number end +local empty = { + function() + return ' ' + end, + padding = 0, +} + local M = {} M.sections = { lualine_a = { toggleterm_statusline }, + lualine_x = { empty }, } M.filetypes = { 'toggleterm' }