Zeioth / compiler.nvim

Neovim compiler for building and running your code without having to configure anything
GNU General Public License v3.0
466 stars 31 forks source link

feat(event): autocmd #5

Closed danielnehrig closed 1 year ago

danielnehrig commented 1 year ago

Can we have events like

CompilerRunPre CompilerRunPost

so we can execute logic after compilation has been done or when compiling has been startet 1 use case: for displaying a loading indicator that we are currently building

Zeioth commented 1 year ago

@danielnehrig To achieve that, you can create a custom component in your overseer settings.

Example

In this minimal overseer config, we are defining the default components that will kick in every time compiler.nvim start a task.

{
  "stevearc/overseer.nvim",
  opts = {
    component_aliases = {
      -- Components included in default will apply to all tasks
      default = {
        { "display_duration", detail_level = 2 },
        "on_output_summarize",
        "on_exit_set_status",
        "on_complete_notify",
        "on_complete_dispose",
      },
    },
  },
},

From this point, it would be just a matter of creating your own custom component to send your event every time a task is started/finished.

Zeioth commented 1 year ago

Overseer has a bunch of documentation. It can be quite intimitating. I would start looking into how components work, list of existing components and then read the third party integration heirline/lualine before going for creating your own custom component, so you have all the info.

danielnehrig commented 1 year ago

thanks for the response will look into it

danielnehrig commented 1 year ago

@Zeioth thanks for the pointers overseer is something I've been looking for for quite a while been searching for a neomake replacement now I found it :) I got it working

Zeioth commented 1 year ago

@danielnehrig were you are to achieve what you wanted? If so, would you share it? It might be worth adding it to the wiki.

danielnehrig commented 1 year ago

image https://github.com/danielnehrig/nvim/blob/5ead88f6f6ea26eff3a0c3dc7e38900f2c1552de/lua/config/plugins/configs/statusline/components.lua#L116-L161 yes i created a component for the statusline to indicate the run process with some fancy animations @Zeioth

Zeioth commented 1 year ago

Thank you for sharing!! I've been able to implement it too in heirline. screenshot_2023-07-25_05-09-40_343265147