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