Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nut): add ruler #8

Merged
merged 1 commit into from
Oct 27, 2022
Merged

feat(nut): add ruler #8

merged 1 commit into from
Oct 27, 2022

Conversation

MunifTanjim
Copy link
Owner

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

@MunifTanjim MunifTanjim mentioned this pull request Oct 27, 2022
16 tasks
@MunifTanjim MunifTanjim merged commit 2d6b8cf into main Oct 27, 2022
@MunifTanjim MunifTanjim deleted the feat-nut-ruler branch October 27, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant