Make statusline functions global
This commit is contained in:
parent
9f0d9890fd
commit
d75531ae3d
@ -109,7 +109,7 @@ end
|
||||
|
||||
-- Define active statusline, this statusline is dynamic with StatusLineLight
|
||||
-- being updated based on the current mode and only used for current buffer.
|
||||
function statusline.active()
|
||||
function _G.statusline_active()
|
||||
local mode = get_mode()
|
||||
if vim.o.buftype == 'help' then
|
||||
if mode == 'Normal' then mode = 'Help' end
|
||||
@ -138,7 +138,7 @@ function statusline.active()
|
||||
return generic('StatusLineLight', mode, true)
|
||||
end
|
||||
|
||||
function statusline.inactive()
|
||||
function _G.statusline_inactive()
|
||||
local mode = modes[vim.fn.char2nr(vim.fn.mode())].name
|
||||
local line = ''
|
||||
if vim.o.buftype == 'help' then
|
||||
@ -169,7 +169,7 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'WinEnter', 'BufWinEnter' }, {
|
||||
pattern = '*',
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.cmd.setlocal("statusline=%{%v:lua.require('statusline').active()%}")
|
||||
vim.cmd.setlocal("statusline=%{%v:lua.statusline_active()%}")
|
||||
end
|
||||
})
|
||||
|
||||
@ -178,7 +178,7 @@ vim.api.nvim_create_autocmd({ 'BufLeave', 'WinLeave' }, {
|
||||
pattern = '*',
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.cmd.setlocal("statusline=%{%v:lua.require('statusline').inactive()%}")
|
||||
vim.cmd.setlocal("statusline=%{%v:lua.statusline_inactive()%}")
|
||||
end
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user