MunifTanjim / nougat.nvim

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

feat(nut): add mode #6

Closed MunifTanjim closed 1 year ago

MunifTanjim commented 1 year 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,
}

local statusline = Bar("statusline")

statusline:add_item(nut.mode({
  prefix = " ",
  suffix = " ",
}))

statusline:add_item(nut.mode({
  sep_left = { content = " ", hl = {} },
  prefix = " ",
  suffix = " ",
  sep_right = sep.right_chevron_solid(),
  config = {
    text = {
      ["n"] = "NOR",
      ["i"] = "INS",
    },
    highlight = {
      normal = { bg = "cyan", fg = "bg" },
      insert = { bg = "purple", fg = "fg" },
    },
  },
}))

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

Kapture 2022-10-27 at 23 01 53