evergarden/nvim
comfy neovim colorscheme for cozy morning coding
git clone https://git.robinwobin.dev/evergarden/nvim
5dc6e2f
main
1local minidoc =require 'mini.doc' 2 3if _G . MiniDoc == nil then 4minidoc . setup () 5end 6 7local current ={} 8 9local hooks =vim . deepcopy ( MiniDoc . default_hooks ) 10 11hooks . write_pre =function ( lines ) 12-- Remove first two lines with `======` and `------` delimiters to comply 13-- with `:h local-additions` template 14table . remove ( lines , 1 ) 15table . remove ( lines , 1 ) 16return lines 17end 18 19local function module_register ( s ) 20if # s == 0 then 21return 22end 23 24-- Remove first word (with bits of surrounding whitespace) while capturing it 25local modname 26s [ 1 ] =s [ 1 ]: gsub ( '%s*\'(%S+)\' ?' , function ( x ) 27modname =x 28return '' 29end , 1 ) 30if modname == nil then return end 31 32local f =vim . tbl_get ( s , 'parent' , 'parent' ) 33if not f then return end 34 35current . modules =current . modules or {} 36current . modules [ f . info . path ] =modname 37end 38 39local function modpattern ( name ) 40return "%f[%w_]" .. name .. "%f[^%w_]" 41end 42 43local function module_replace ( s ) 44if current . modules == nil then return end 45 46local f =vim . tbl_get ( s , 'parent' , 'parent' ) 47if not f then return end 48 49local modname =current . modules [ f . info . path ] 50if modname == nil then return end 51 52s [ 1 ] =string . gsub ( s [ 1 ], modpattern ( 'M' ), modname ) 53end 54 55hooks . sections [ '@module' ] =function ( s ) 56module_register ( s ) 57end 58 59hooks . section_pre =function ( s ) 60MiniDoc . default_hooks . section_pre ( s ) 61 62module_replace ( s ) 63end 64 65hooks . file =function ( f ) 66MiniDoc . default_hooks . file ( f ) 67 68current . modules [ f . info . path ] ={} 69end 70 71-- init 72 73local init_base ='lua/evergarden' 74 75local init_mods =vim 76. iter ( vim . fs . dir ( init_base )) 77: map ( function ( modfile , ftype ) 78if ftype == 'file' then 79return { 80name =string . gsub ( vim . fs . basename ( modfile ), '%.lua$' , '' ), 81path =vim . fs . joinpath ( init_base , modfile ), 82} 83end 84end ) 85: each ( function ( mod ) 86local name ='evergarden' 87if name ~= 'init' then 88name =name .. '-' .. mod . name 89end 90minidoc . generate ( { mod . path } , 'doc/' .. name .. '.txt' , { hooks =hooks } ) 91end )