diff --git a/lua/lualine.lua b/lua/lualine.lua index 026e4c4..fd1713c 100644 --- a/lua/lualine.lua +++ b/lua/lualine.lua @@ -23,7 +23,7 @@ M.inactive_sections = { lualine_c = { 'filename' }, lualine_x = { 'location' }, lualine_y = { }, - lualine_z = { } + lualine_z = { } } M.extensions = { @@ -102,11 +102,18 @@ local function statusline(is_focused) return table.concat(status) end +function M.set_active_statusline() + vim.wo.statusline = statusline(1) +end + +function M.set_inactive_statusline() + vim.wo.statusline = statusline() +end + local function exec_autocommands() - _G.statusline = statusline _G.set_lualine_theme = set_lualine_theme - vim.cmd([[autocmd WinEnter,BufEnter * setlocal statusline=%!v:lua.statusline(1)]]) - vim.cmd([[autocmd WinLeave,BufLeave * setlocal statusline=%!v:lua.statusline()]]) + vim.cmd([[autocmd WinEnter,BufEnter * lua require('lualine').set_active_statusline()]]) + vim.cmd([[autocmd WinLeave,BufLeave * lua require('lualine').set_inactive_statusline()]]) vim.cmd([[autocmd ColorScheme * call v:lua.set_lualine_theme()]]) end diff --git a/lua/lualine/components/branch.lua b/lua/lualine/components/branch.lua index 8b9574f..a63cbe2 100644 --- a/lua/lualine/components/branch.lua +++ b/lua/lualine/components/branch.lua @@ -26,7 +26,7 @@ local function branch() end return git_branch end - ok = (vim.fn.exists('*WebDevIconsGetFileTypeSymbol')) + ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol") if ok ~= 0 then local icon = '' return icon .. ' ' .. git_branch diff --git a/lua/lualine/components/filetype.lua b/lua/lualine/components/filetype.lua index 4d5e78b..097fe9b 100644 --- a/lua/lualine/components/filetype.lua +++ b/lua/lualine/components/filetype.lua @@ -10,9 +10,9 @@ local function filetype() end return data end - ok = (vim.fn.exists('*WebDevIconsGetdataSymbol')) + ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol") if ok ~= 0 then - local icon = vim.call('WebDevIconsGetdataSymbol') + local icon = vim.fn.WebDevIconsGetFileTypeSymbol() return icon .. ' ' .. data end return data