grapp-dev / nui-components.nvim

A feature-rich and highly customizable library for creating user interfaces in Neovim.
https://nui-components.grapp.dev
MIT License
303 stars 6 forks source link

Basic question how to run intro.lua #1

Closed Proful closed 5 months ago

Proful commented 5 months ago

After Lazy setup, where to keep & how to trigger it to run https://gist.github.com/mobily/cfaa4264f1094e20e25f31f44de6c21f

mehalter commented 5 months ago

You can put this really anywhere where you want to build a component and run it. A good test would be to just put it in your ~/.config/nvim/lua folder so say you put it at ~/.config/nvim/lua/nui_components_intro.lua then when you run neovim you would simply run :lua require("nui_components_intro") and it would execute the code.

That require just loads that module and run the code inside of it. If you have a function somewhere else like attached to a key binding or something where you want to build a component you can do it there or organize it somewhere else in your config and then require it

mehalter commented 5 months ago

One thing to note is that gist is missing a couple imports, so just make sure to add this at the top of the file:

local n = require "nui-components"
local spinner_formats = require "nui-components.utils.spinner-formats"