Code Monkey home page Code Monkey logo

Comments (3)

towry avatar towry commented on June 18, 2024

#6 isn't this what you want?

from nougat.nvim.

MunifTanjim avatar MunifTanjim commented on June 18, 2024

Yes absolutely.


For mode:

local color = require("nougat.color").get()

local mode = nut.mode.create({
  config = {
    highlight = {
      insert = { bg = color.blue, fg = color.bg },
      -- ...
    },
  },
})

Ref:

  • ---@class nougat.nut.mode_config.config
    ---@field text? table<string, string>
    ---@field highlight? table<'normal'|'visual'|'insert'|'replace'|'commandline'|'terminal'|'inactive', nougat_hl_def>
    ---@class nougat_nut_mode_config: nougat_item_config__function
    ---@field cache? nil
    ---@field config? nougat.nut.mode_config.config|nougat.nut.mode_config.config[]
    ---@field content? nil
    ---@field hl? nil
    ---@field prepare? nil
  • local default_text = {
    ["n"] = "NORMAL",
    ["no"] = "OP PENDING",
    ["nov"] = "OP PENDING CHAR",
    ["noV"] = "OP PENDING LINE",
    ["no�"] = "OP PENDING BLOCK",
    ["niI"] = "INSERT (NORMAL)",
    ["niR"] = "REPLACE (NORMAL)",
    ["niV"] = "V REPLACE (NORMAL)",
    ["nt"] = "TERMINAL NORMAL",
    ["ntT"] = "TERMINAL (NORMAL)",
    ["v"] = "VISUAL",
    ["vs"] = "SELECT (VISUAL)",
    ["V"] = "V-LINE",
    ["Vs"] = "SELECT (V-LINE)",
    [""] = "V-BLOCK",
    ["�s"] = "SELECT (V-BLOCK)",
    ["s"] = "SELECT",
    ["S"] = "S-LINE",
    [""] = "S-BLOCK",
    ["i"] = "INSERT",
    ["ic"] = "INSERT COMPL GENERIC",
    ["ix"] = "INSERT COMPL",
    ["R"] = "REPLACE",
    ["Rc"] = "REPLACE COMP GENERIC",
    ["Rx"] = "REPLACE COMP",
    ["Rv"] = "V REPLACE",
    ["Rvc"] = "V REPLACE COMP GENERIC",
    ["Rvx"] = "V REPLACE COMP",
    ["c"] = "COMMAND",
    ["cv"] = "VIM EX",
    ["ce"] = "EX",
    ["r"] = "PROMPT",
    ["rm"] = "MORE PROMPT",
    ["r?"] = "CONFIRM",
    ["!"] = "SHELL",
    ["t"] = "TERMINAL",
    ["-"] = "INACTIVE",
    }
    local default_highlight = {
    normal = {
    bg = "fg",
    fg = "bg",
    },
    visual = {
    bg = color.yellow,
    fg = "bg",
    },
    insert = {
    bg = color.blue,
    fg = "bg",
    },
    replace = {
    bg = color.magenta,
    fg = "bg",
    },
    commandline = {
    bg = color.green,
    fg = "bg",
    },
    terminal = {
    bg = color.cyan,
    fg = "bg",
    },
    inactive = {
    bg = "fg",
    fg = "bg",
    },
    }

For diagnostic_count:

local diagnostic_count = nut.buf.diagnostic_count.create({
  hidden = nut.buf.diagnostic_count.hidden.if_zero(),
  hl = { bg = color.bg3 },
  prefix = " ",
  suffix = " ",
  config = {
    error = { prefix = "", fg = color.red },
    warn = { prefix = "", fg = color.yellow },
    info = { prefix = "", fg = color.blue },
    hint = { prefix = "󰌶 ", fg = color.green },
  },
})

Ref:

  • ---@class nougat.nut.buf.diagnostic_count_config.config__severity
    ---@field severity integer
    ---@class nougat.nut.buf.diagnostic_count_config.config__combined
    ---@field error? { prefix?: string, suffix?: string, fg?: string }
    ---@field warn? { prefix?: string, suffix?: string, fg?: string }
    ---@field info? { prefix?: string, suffix?: string, fg?: string }
    ---@field hint? { prefix?: string, suffix?: string, fg?: string }
    ---@field sep? string
    ---@class nougat.nut.buf.diagnostic_count_config__severity: nougat_item_config__function
    ---@field cache? nil
    ---@field config nougat.nut.buf.diagnostic_count_config.config__severity
    ---@field content? nil
    ---@field hl? nougat_hl_def
    ---@class nougat.nut.buf.diagnostic_count_config__combined: nougat_item_config__function
    ---@field cache? nil
    ---@field config? nougat.nut.buf.diagnostic_count_config.config__combined|nougat.nut.buf.diagnostic_count_config.config__combined[]
    ---@field content? nil
    ---@field hl? nougat_hl_def
    ---@alias nougat.nut.buf.diagnostic_count_config nougat.nut.buf.diagnostic_count_config__severity|nougat.nut.buf.diagnostic_count_config__combined

from nougat.nvim.

MunifTanjim avatar MunifTanjim commented on June 18, 2024

Here's an example for git.status:

local gitstatus = stl:add_item(nut.git.status.create({
hl = { fg = color.bg },
sep_left = sep.left_half_circle_solid(true),
content = {
nut.git.status.count("added", {
hl = { bg = color.green },
prefix = "+",
suffix = function(_, ctx)
return (ctx.gitstatus.changed > 0 or ctx.gitstatus.removed > 0) and " " or ""
end,
}),
nut.git.status.count("changed", {
hl = { bg = color.blue },
prefix = function(_, ctx)
return ctx.gitstatus.added > 0 and " ~" or "~"
end,
suffix = function(_, ctx)
return ctx.gitstatus.removed > 0 and " " or ""
end,
}),
nut.git.status.count("removed", {
hl = { bg = color.red },
prefix = function(_, ctx)
return (ctx.gitstatus.added > 0 or ctx.gitstatus.changed > 0) and " -" or "-"
end,
}),
},
sep_right = sep.right_half_circle_solid(true),
}))

from nougat.nvim.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.