Skip to content

Instantly share code, notes, and snippets.

@mobily
Created April 21, 2024 14:43
Show Gist options
  • Select an option

  • Save mobily/ecf31200cde4b688bb35a79907fc090a to your computer and use it in GitHub Desktop.

Select an option

Save mobily/ecf31200cde4b688bb35a79907fc090a to your computer and use it in GitHub Desktop.
local fn = require("nui-components.utils.fn")
local n = require("nui-components")
vim.keymap.set("n", "<leader>fs", function()
local win_width = vim.api.nvim_win_get_width(0)
local win_height = vim.api.nvim_win_get_height(0)
local renderer = n.create_renderer({
width = win_width,
height = win_height,
position = {
row = 0,
col = 0,
},
})
local body = function()
return n.rows(
{ flex = 1 },
n.paragraph({
border_label = "Header",
lines = {
n.text("Header Content"),
},
align = "center",
}),
n.columns(
{ flex = 1 },
n.rows(
{
flex = 1,
},
n.paragraph({
flex = 1,
border_label = "Col #1",
lines = {
n.text("Content"),
},
align = "center",
})
),
n.rows(
{
flex = 1,
},
n.paragraph({
flex = 1,
border_label = "Col #2",
lines = {
n.text("Content"),
},
align = "center",
})
)
),
n.paragraph({
border_label = "Footer",
lines = {
n.text("Footer Content"),
},
align = "center",
})
)
end
renderer:render(body)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment