NTBBloodbath / galaxyline.nvim

neovim statusline plugin written in lua
MIT License
163 stars 16 forks source link

Always need to reload current buffer to see changes if you call a function from `lua` directory #39

Open LinArcX opened 2 years ago

LinArcX commented 2 years ago

Hello.

I have the lua folder inside ~/.config/nvim and i put all my user-defined functions there.

There is a file called test.lua in mentioned directory that contains:

local test =  {}

local colors = require("galaxyline.themes.colors").gruvbox

function test.foo()
  require('galaxyline').section.left[14] = {
   Saeed  = {
      provider = function()
        return "  ✅️ " .. "foo"
      end,
      separator = ' ',
      separator_highlight = {'NONE',colors.bg},
      highlight = { colors.green, colors.bg },
    },
  }
end

return test

And if i open my init.lua file and put the below line in it, everything will works like a charm:

require('test').foo()

The problem is that if i wanted to call this function from command section of neovim like this: :lua require('test').foo()

It won't update the statusline, until i do one of these things:

  1. :e
  2. open another buffer

Is it a bug or is there any workaround to fix it?