tamton-aquib / staline.nvim

A modern lightweight statusline and bufferline plugin for neovim in lua.
MIT License
373 stars 16 forks source link

User Defined Sections Don't Update #20

Closed is0n closed 2 years ago

is0n commented 2 years ago

When I put my own sections in the sections table, those sections won't update, however, the other sections that are defined by the staline do.

Example Config Using nvim-gps:

local function context()
    if require("nvim-gps").is_available() then
        return require("nvim-gps").get_location()
    end
    return ''
end

-- Configuration
require('staline').setup{
    sections = {
        left  = { '-mode', 'left_sep', 'file_name' }, -- These will update
        mid   = { context() }, -- This will not update
        right = { 'cool_symbol', 'right_sep', '-line_column', '-cwd' } -- These will update
    },
}
tamton-aquib commented 2 years ago

Instead of passing the function call: mid = { context() } try passing the function directly: mid = { context }

And just relaized i havent mentioned this in docs. lemme know if it works 😬

is0n commented 2 years ago

Instead of passing the function call: mid = { context() } try passing the function directly: mid = { context }

This works 😅. I agree that this should be mentioned in the docs.