tjdevries / express_line.nvim

WIP: Statusline written in pure lua. Supports co-routines, functions and jobs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug subscibe module

koopa1338 opened this issue · comments

commented

If I open a ascii text file (I'm unsure about the filetype, sometimes ascii files work fine also), everything beginning with git branch is not displayed in the status line. This only appears if the file is not opened directly with nvim.

It doesnt matter either if I open it with telescope file picker or with :e /path/to/file. It seems that the issue is caused by the subscribe module as I commented out my configs for git changes, file icon and git branch and everything works just fine.

This is how my config looks like for express line:

local builtin = require('el.builtin')
local extensions = require('el.extensions')
local sections = require('el.sections')
local subscribe = require('el.subscribe')
local lsp_statusline = require('el.plugins.lsp_status')

local git_branch = subscribe.buf_autocmd(
    "el_git_branch",
    "BufEnter",
    function(window, buffer)
        local branch = extensions.git_branch(window, buffer)
        if branch then
            return ' ' .. extensions.git_icon() .. ' ' .. branch
        end
    end)

local file_icon = subscribe.buf_autocmd(
    "el_file_icon",
    "BufRead",
    function(_, bufnr)
        local icon = extensions.file_icon(_, bufnr)
        if icon then
            return icon .. ' '
        end
        return ''
    end)

local git_changes = subscribe.buf_autocmd(
    "el_git_changes",
    "BufWritePost",
    function(window, buffer)
        return extensions.git_changes(window, buffer)
    end)

require('el').setup {
    generator = function(win_id)
        return {
            extensions.gen_mode {
                format_string = ' %s '
            },
            -- git_branch,
            sections.split,
            -- file_icon,
            builtin.shortened_file,
            sections.collapse_builtin {
                ' ',
                builtin.modified_flag
            },
            sections.split,
            lsp_statusline.current_function,
            lsp_statusline.server_progress,
            -- git_changes,
            '[', builtin.line_with_width(3), ':',  builtin.column_with_width(2), ']',
            sections.collapse_builtin {
                '[',
                builtin.help_list,
                builtin.readonly_list,
                ']',
            },
            builtin.filetype,
        }
    end
}

here are 2 screenshots

screenshot-18-10-2020_20-04-59
screenshot-18-10-2020_20-05-13

commented

duplicate of #25