Closed grimgort closed 2 years ago
It's not fixable by lualine . This is how neovim draws statusline . See https://github.com/neovim/neovim/issues/9342
You can use floatline.nvim as workarround for now. For example install floatline add the following after your lualine config. I've been using this config when I was testing out floatline but using floating window to show statusline has it's own set of issues that's why I don't plan on adding something similar in lualine . I'd just wait on support in core.
function _G.LualineStatusLine()
local ok, stl = pcall(require('lualine').statusline)
if not ok then
vim.opt.stl = '%f%=%l,%v %p%% '
error(stl)
end
return stl
end
require('floatline').setup {
status = function()
return [=[%{%&stl == "%!v:lua.RStatusline()" ? luaeval("_G.LualineStatusLine()") : &stl%}]=]
end,
}
vim.cmd [[
hi RStatusActive guifg=#51a0cf
hi RStatusInActive guifg=#266269
]]
_G.RStatusline = function()
local stl_content = vim.fn.pathshorten(vim.fn.expand '%:~:.')
local num_of_dash = vim.fn.winwidth(0) - vim.fn.strdisplaywidth(stl_content)
stl_content = string.rep('_', num_of_dash / 2) .. stl_content .. string.rep('_', num_of_dash - num_of_dash / 2)
if tonumber(vim.g.actual_curwin) == vim.fn.win_getid() then
return '%#RStatusActive#' .. stl_content
end
return '%#RStatusInActive#' .. stl_content
end
vim.go.stl = '%!v:lua.RStatusline()'
Ok, thanks a lot.
i have migrated to : https://github.com/windwp/windline.nvim
It's not fixable by lualine . This is how neovim draws statusline . See neovim/neovim#9342
You can use floatline.nvim as workarround. For example install floatline add the following after your lualine config.
function _G.LualineStatusLine() local ok, stl = pcall(require('lualine').statusline) if not ok then vim.opt.stl = '%f%=%l,%v %p%% ' error(stl) end return stl end require('floatline').setup { status = function() return [=[%{%&stl == "%!v:lua.RStatusline()" ? luaeval("_G.LualineStatusLine()") : &stl%}]=] end, } vim.cmd [[ hi RStatusActive guifg=#51a0cf hi RStatusInActive guifg=#266269 ]] _G.RStatusline = function() local stl_content = vim.fn.pathshorten(vim.fn.expand '%:~:.') local num_of_dash = vim.fn.winwidth(0) - vim.fn.strdisplaywidth(stl_content) stl_content = string.rep('_', num_of_dash / 2) .. stl_content .. string.rep('_', num_of_dash - num_of_dash / 2) if tonumber(vim.g.actual_curwin) == vim.fn.win_getid() then return '%#RStatusActive#' .. stl_content end return '%#RStatusInActive#' .. stl_content end vim.go.stl = '%!v:lua.RStatusline()'
Thank you!
For future readers: The global statusline feature had been merged on upstream one year ago: https://github.com/neovim/neovim/pull/17266, which closed the aforementioned upstream issue https://github.com/neovim/neovim/issues/9342
Hello,
I would like to know if there is a way or an option to avoid that the statusbar is split in 2 pieces. With a split, it becomes unreadable. I would need one that does the whole screen all the time. Avoid: wanted :