dashboard-nvim icon indicating copy to clipboard operation
dashboard-nvim copied to clipboard

ftplugin not always working

Open franroa opened this issue 2 years ago • 3 comments

Describe the bug When I run a function on starting the dashboard, it sometimes works, but sometimes seems that nothing happened

To Reproduce create a small function which draws something in the (local) winbar

Expected behavior The winbar shows always what is written in the function

In the file, I just execute a function which adds content to the winbar: require("functions.winbar").Redraw()

franroa avatar Jun 16 '23 14:06 franroa

dashboard hide winbar is true will hide winbar

glepnir avatar Jun 17 '23 01:06 glepnir

It is not working consistently. This is my code:

vim.api.nvim_create_autocmd({ "BufEnter" }, {
  pattern = { "" },
  callback = function()
    if vim.bo.filetype == "" or vim.bo.filetype == "dashboard" then
      require("functions.winbar").Redraw()
    end
  end
})



return {
  {
    "glepnir/dashboard-nvim",
    event = "VimEnter",
    config = function()
      require("dashboard").setup({
        hide = {
          statusline = false,
          winbar = false,
        },
        -- config
        config = {
          packages = { enable = false }, -- show how many plugins neovim loaded
          project = { enable = false },
          mru = { enable = false },
          center = {
            {},
          },
          header = header,
          footer = function()
            local stats = require("lazy").stats()
            local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
            return { "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" }
          end,
          shortcut = {
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Find Files",
              group = "Label",
              action = "Telescope find_files",
              key = "f",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "New File",
              group = "Label",
              action = [[ene | startinser]],
              key = "n",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Recent Files",
              group = "Label",
              action = "Telescope oldfiles",
              key = "r",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Find text",
              group = "Label",
              action = "Telescope live_grep",
              key = "g",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Config",
              group = "Label",
              action = ":e $MYVIMRC ",
              key = "c",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Restore Session",
              group = "Label",
              action = [[lua require("persistence").load()]],
              key = "s",
            },
            {
              icon = "󰒲 ",
              icon_hl = "@variable",
              desc = "Config",
              group = "Label",
              action = [[Lazy]],
              key = "l",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Quit",
              group = "Label",
              action = [[qa]],
              key = "q",
            },
            {
              icon = " ",
              icon_hl = "@variable",
              desc = "Projects",
              group = "Label",
              action = "Telescope projects",
              key = "p",
            },
            {
              desc = " Apps",
              group = "DiagnosticHint",
              action = "Telescope app",
              key = "a",
            },
            {
              desc = " dotfiles",
              group = "Number",
              action = "Telescope dotfiles",
              key = "d",
            },
          },
        },
      })
    end,
    dependencies = { { "nvim-tree/nvim-web-devicons" } },
  },
}

franroa avatar Jun 19 '23 06:06 franroa

okay . I am writing a new version dashboard. let's see what happen in new version later

glepnir avatar Jun 19 '23 06:06 glepnir