MunifTanjim / nougat.nvim

🍫 Hyperextensible Statusline / Tabline / Winbar for Neovim 🚀
MIT License
199 stars 3 forks source link

feat(nut): add ruler #8

Closed MunifTanjim closed 2 years ago

MunifTanjim commented 2 years ago
local core = require("nui.bar.core")
local Bar = require("nougat.bar")
local sep = require("nougat.separator")
local nut = {
  mode = require("nougat.nut.mode").create,
  ruler = require("nougat.nut.ruler").create,
  spacer = require("nougat.nut.spacer").create,
}

vim.o.rulerformat = table.concat({
  core.code("p"),
  "%% L:",
  core.code("l"),
  "/",
  core.code("L"),
  " C:",
  core.code("v", { align = "left", min_width = 2 }),
})

local statusline = Bar("statusline")

local mode = nut.mode({
  prefix = " ",
  suffix = " ",
  sep_right = sep.right_chevron_solid(true),
})
statusline:add_item(mode)
statusline:add_item(nut.spacer())
statusline:add_item(nut.ruler({
  hl = mode,
  sep_left = sep.left_chevron_solid(true),
  prefix = " ",
  suffix = " ",
}))

vim.go.statusline = core.generator(function(ctx)
  return statusline:generate(ctx)
end, { id = "nougat_statusline", context = {} })

Kapture 2022-10-27 at 23 14 35