-
Notifications
You must be signed in to change notification settings - Fork 0
hello world example
s1n7ax edited this page Jan 24, 2023
·
1 revision
-- import renderer from `nvim-react`
local Renderer = require('react.renderers.buffer-renderer')
-- create a functional component
local function App()
return {
'Hello World'
}
end
-- create a buffer and a window to display the text
local buffer = vim.api.nvim_create_buf(false, true)
local win_conf = {
width = 100,
height = 100,
relative = 'editor',
row = 1,
col = 1,
}
vim.api.nvim_open_win(buffer, true, win_conf)
-- render app component on the buffer
Renderer:new({
buffer = buffer
}):render(App)