feat: initial nonicons.nvim rewrite
Problem: the original ya2s/nvim-nonicons fork diverged enough that maintaining it as a fork was pointless. The set_icon() approach broke with modern nvim-web-devicons, and the extensions directory coupled integrations that belong in user config. Solution: from-scratch rewrite with function wrapping + table mutation override engine, vim.g.nonicons config pattern, vendored mapping with integer codepoints, health check, vimdoc with recipes, and no built-in plugin integrations.
This commit is contained in:
commit
04791cd41a
15 changed files with 1491 additions and 0 deletions
43
lua/nonicons/init.lua
Normal file
43
lua/nonicons/init.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
local M = {}
|
||||
|
||||
---@class nonicons.Config
|
||||
---@field override boolean
|
||||
|
||||
---@type nonicons.Config
|
||||
local default = {
|
||||
override = true,
|
||||
}
|
||||
|
||||
local initialized = false
|
||||
|
||||
---@type nonicons.Config
|
||||
local config
|
||||
|
||||
local function ensure_initialized()
|
||||
if initialized then
|
||||
return
|
||||
end
|
||||
local user = vim.g.nonicons or {}
|
||||
vim.validate('nonicons', user, 'table')
|
||||
vim.validate('nonicons.override', user.override, 'boolean', true)
|
||||
config = vim.tbl_deep_extend('force', default, user)
|
||||
initialized = true
|
||||
end
|
||||
|
||||
M.mapping = require('nonicons.mapping')
|
||||
|
||||
function M.get(name)
|
||||
local code = M.mapping[name]
|
||||
if code then
|
||||
return vim.fn.nr2char(code)
|
||||
end
|
||||
end
|
||||
|
||||
function M.apply()
|
||||
ensure_initialized()
|
||||
if config.override then
|
||||
require('nonicons.override').apply()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue