dotfiles-ansible/roles/config/files/nvim/lua/user/plugins/ui/heirline/init.lua

111 lines
3.2 KiB
Lua

local conditions = require('heirline.conditions')
local components = require('user.plugins.ui.heirline.components')
local excluded_buftype = { 'nofile', 'prompt', 'help', 'quickfix', 'terminal' }
local excluded_ft = {
'NvimTree',
'OverseerForm',
'TelescopePrompt',
'Trouble',
'aerial',
'aerial-nav',
'alpha',
'lazy',
'qf',
'toggleterm',
'undotree',
'dap-repl',
'dapui_console',
'dapui_watches',
'dapui_stacks',
'dapui_breakpoints',
'dapui_scopes',
}
require('heirline').setup {
statusline = {
hl = function()
if conditions.is_active() then
return 'StatusLine'
end
return 'StatusLineNC'
end,
fallthrough = false,
-- Statusline for special buffers
{
condition = function()
return conditions.buffer_matches {
buftype = excluded_buftype,
filetype = excluded_ft,
}
end,
{ components.file_info, flexible = 1 },
components.align,
{ components.file_type, flexible = 3 },
},
-- Inactive statusline
{
condition = function()
return not conditions.is_active()
end,
components.dummy,
components.file_size,
{ components.file_info, flexible = 1 },
components.align,
{ components.file_format, flexible = 2 },
{ components.file_encoding, flexible = 3 },
{ components.file_type, flexible = 3 },
},
-- Default statusline
{
components.dummy,
components.vi_mode,
components.file_size,
{ components.file_info, flexible = 1 },
{ components.debugger, flexible = 3 },
{ components.code_action, flexible = 2 },
{ components.macro, flexible = 2 },
components.align,
components.ruler,
{ components.file_format, flexible = 2 },
{ components.file_encoding, flexible = 3 },
{ components.file_type, flexible = 3 },
{ components.git, flexible = 1 },
},
},
winbar = {
hl = function()
if conditions.is_active() then
return 'WinBar'
end
return 'WinBarNC'
end,
fallthrough = false,
-- Inactive winbar
{
condition = function()
return not conditions.is_active()
end,
components.diagnostics,
components.align,
{ components.lsp_servers, flexible = 1 },
},
-- Regular winbar
{
{ components.navic, flexible = 2, { provider = '' } },
components.align,
components.diagnostics,
{ components.lsp_servers, flexible = 1 },
},
},
opts = {
disable_winbar_cb = function(args)
return conditions.buffer_matches({
buftype = excluded_buftype,
filetype = excluded_ft,
}, args.buf)
end,
colors = require('user.themes.' .. vim.g.colors_name .. '.colors'),
},
}