Compare commits

..

1 commit

Author SHA1 Message Date
4505e5da18 Partial code for loading extensions 2024-02-14 23:47:17 +01:00
3 changed files with 130 additions and 173 deletions

View file

@ -1,69 +1,62 @@
local M = {}
local to_hex = function(s)
local r, g, b = string.match(s, "^rgb%(%s*(%d+),%s*(%d+),%s*(%d+)%)")
return string.format("#%02x%02x%02x", r, g, b)
end
M.colors = function()
local c = {
dark0_h = to_hex("rgb( 19, 21, 22)"),
dark0 = to_hex("rgb( 24, 25, 26)"),
dark0_s = to_hex("rgb( 29, 32, 33)"), -- bg0_h
-- to_hex("rgb( 40, 40, 40)"), -- bg0
-- to_hex("rgb( 50, 48, 47)"), -- bg0_s
dark1 = to_hex("rgb( 60, 56, 54)"),
dark2 = to_hex("rgb( 80, 73, 69)"),
dark3 = to_hex("rgb(102, 92, 84)"),
dark4 = to_hex("rgb(124, 111, 100)"),
gray = to_hex("rgb(146, 131, 116)"),
light4 = to_hex("rgb(168, 153, 132)"),
light3 = to_hex("rgb(189, 174, 147)"),
light2 = to_hex("rgb(213, 196, 161)"),
light1 = to_hex("rgb(235, 219, 178)"),
light0_s = to_hex("rgb(242, 229, 188)"),
light0 = to_hex("rgb(251, 241, 199)"),
light0_h = to_hex("rgb(249, 245, 215)"),
local c = { -- 16 | 16 | 256 |
-- dark | light | colors | R G B
--------+-------+--------+---------------
dark0 = '#171a1b', -- | | 232 | 23 26 27
dark0_s = '#1d2021', -- | | 233 | 29 32 33
dark1 = '#3c3836', -- | 15 | 237 | 60 56 54
dark2 = '#504945', -- | | 239 | 80 73 69
dark3 = '#665c54', -- | | 241 | 102 92 84
dark4 = '#7c6f64', -- | 7 | 243 | 124 111 100
gray = '#928374', -- 8 | 8 | 24[4,5]| 146 131 116
light4 = '#a89984', -- 7 | | 246 | 168 153 132
light3 = '#bdae93', -- | | 248 | 189 174 147
light2 = '#d5c4a1', -- | | 250 | 213 196 161
light1 = '#ebdbb2', -- 15 | | 223 | 235 219 178
light0_s = '#f2e5bc', -- | | 228 | 242 229 188
light0 = '#fbf1c7', -- | 0 | 229 | 253 244 193
red_darkest = to_hex("rgb( 46, 16, 15)"),
green_darkest = to_hex("rgb( 46, 46, 15)"),
yellow_darkest = to_hex("rgb( 46, 36, 15)"),
blue_darkest = to_hex("rgb( 20, 40, 41)"),
purple_darkest = to_hex("rgb( 41, 20, 30)"),
aqua_darkest = to_hex("rgb( 24, 37, 25)"),
orange_darkest = to_hex("rgb( 50, 26, 11)"),
red_darkest = '#2e100f',
green_darkest = '#2e2e0f',
yellow_darkest = '#2e240f',
blue_darkest = '#142829',
purple_darkest = '#29141e',
aqua_darkest = '#182519',
orange_darkest = '#321a0b',
red_darker = to_hex("rgb(157, 0, 6)"),
green_darker = to_hex("rgb(121, 116, 14)"),
yellow_darker = to_hex("rgb(181, 118, 20)"),
blue_darker = to_hex("rgb( 7, 102, 120)"),
purple_darker = to_hex("rgb(143, 63, 113)"),
aqua_darker = to_hex("rgb( 66, 123, 88)"),
orange_darker = to_hex("rgb(175, 58, 3)"),
red_darker = '#9d0006', -- | 9 | 88 | 157 0 6
green_darker = '#79740e', -- | 10 | 100 | 121 116 14
yellow_darker = '#b57614', -- | 11 | 136 | 181 118 20
blue_darker = '#076678', -- | 12 | 24 | 6 102 120
purple_darker = '#8f3f71', -- | 13 | 96 | 143 63 113
aqua_darker = '#427b58', -- | 14 | 66 | 66 123 88
orange_darker = '#af3a03', -- | | 130 | 175 58 3
red = to_hex("rgb(204, 36, 29)"),
green = to_hex("rgb(152, 151, 26)"),
yellow = to_hex("rgb(215, 153, 33)"),
blue = to_hex("rgb( 69, 133, 136)"),
purple = to_hex("rgb(177, 98, 134)"),
aqua = to_hex("rgb(104, 157, 106)"),
orange = to_hex("rgb(214, 93, 14)"),
red = '#cc241d', -- 1 | 1 | 123 | 204 36 29
green = '#98971a', -- 2 | 2 | 106 | 152 151 26
yellow = '#d79921', -- 3 | 3 | 172 | 215 153 33
blue = '#458588', -- 4 | 4 | 66 | 69 133 136
purple = '#b16286', -- 5 | 5 | 132 | 177 98 134
aqua = '#689d6a', -- 6 | 6 | 72 | 104 157 106
orange = '#d65d0e', -- | | 166 | 214 93 14
red_lighter = to_hex("rgb(251, 73, 52)"),
green_lighter = to_hex("rgb(184, 187, 38)"),
yellow_lighter = to_hex("rgb(250, 189, 47)"),
blue_lighter = to_hex("rgb(131, 165, 152)"),
purple_lighter = to_hex("rgb(211, 134, 155)"),
aqua_lighter = to_hex("rgb(142, 192, 124)"),
orange_lighter = to_hex("rgb(254, 128, 25)"),
red_lighter = '#fb4934', -- 9 | | 167 | 251 73 52
green_lighter = '#b8bb26', -- 10 | | 142 | 184 187 38
yellow_lighter = '#fabd2f', -- 11 | | 214 | 250 189 47
blue_lighter = '#83a598', -- 12 | | 109 | 131 165 152
purple_lighter = '#d3869b', -- 13 | | 175 | 211 134 155
aqua_lighter = '#8ec07c', -- 14 | | 108 | 142 192 124
orange_lighter = '#fe8019', -- | | 208 | 254 128 25
red_lightest = to_hex("rgb(255, 215, 212)"),
green_lightest = to_hex("rgb(238, 238, 210)"),
yellow_lightest = to_hex("rgb(243, 234, 206)"),
blue_lightest = to_hex("rgb(210, 228, 229)"),
purple_lightest = to_hex("rgb(242, 222, 231)"),
aqua_lightest = to_hex("rgb(212, 227, 212)"),
orange_lightest = to_hex("rgb(243, 224, 211)"),
red_lightest = '#ffd7d4',
green_lightest = '#eeeed2',
yellow_lightest = '#f3eace',
blue_lightest = '#d2e4e5',
purple_lightest = '#f2dee7',
aqua_lightest = '#d4e3d4',
orange_lightest = '#f3e0d3',
}
local is_dark = vim.opt.background:get() == 'dark'
@ -74,14 +67,11 @@ M.colors = function()
palette['bg' .. tostring(i)] = c[(is_dark and 'dark' or 'light') .. tostring(i)]
end
palette['fg0_h'] = c[(is_dark and 'light' or 'dark') .. '0_h']
palette['fg0_s'] = c[(is_dark and 'light' or 'dark') .. '0_s']
palette['bg0_h'] = c[(is_dark and 'dark' or 'light') .. '0_h']
palette['bg0_s'] = c[(is_dark and 'dark' or 'light') .. '0_s']
for _, accent in ipairs({'red', 'green', 'yellow', 'blue', 'purple', 'aqua', 'orange'}) do
palette[accent] = c[accent]
palette['dim_' .. accent] = c[accent .. '_' .. (is_dark and 'darker' or 'lighter')]
palette['br_' .. accent] = c[accent .. '_' .. (is_dark and 'lighter' or 'darker')]
palette[accent .. '_bg'] = c[accent .. '_' .. (is_dark and 'darkest' or 'lightest')]
end
@ -92,18 +82,18 @@ end
M.highlights = function()
local C = M.colors()
local fg = C.fg3
local bg = C.bg0_h
local bg = C.bg0
return {
standard = {
Normal = { fg = fg, bg = bg }, -- normal text
NormalNC = { fg = fg, bg = C.bg0 }, -- normal text in non-current windows
NormalNC = { link = 'Normal' }, -- normal text in non-current windows
NormalFloat = { link = 'Normal' }, -- floating windows
FloatBorder = { fg = C.gray, bg = bg },
FloatBorder = { fg = C.gray },
FloatTitle = { fg = C.blue },
Comment = { fg = C.bg3, italic = false }, -- any comment
Comment = { fg = C.bg3, italic = true }, -- any comment
Constant = { fg = C.orange }, -- any constant
String = { fg = C.aqua }, -- a string constant: "this is a string"
@ -123,10 +113,10 @@ M.highlights = function()
Keyword = { link = 'Statement' }, -- any other keyword
Exception = { link = 'Statement' }, -- try, catch, throw
PreProc = { fg = C.dim_orange }, -- generic Preprocessor
PreProc = { fg = C.orange }, -- generic Preprocessor
Include = { link = 'PreProc' }, -- preprocessor #include
Define = { link = 'PreProc' }, -- preprocessor #define
Macro = { link = 'Constant' }, -- same as Define
Macro = { link = 'PreProc' }, -- same as Define
PreCondit = { link = 'PreProc' }, -- preprocessor #if, #else, #endif, etc.
Type = { fg = C.yellow }, -- int, long, char, etc.
@ -134,7 +124,7 @@ M.highlights = function()
Structure = { link = 'Statement' }, -- struct, union, enum, etc.
Typedef = { link = 'Statement' }, -- A typedef
Special = { fg = C.dim_orange }, -- any special symbol
Special = { fg = C.red }, -- any special symbol
SpecialChar = { link = 'Special' }, -- special character in a constant
Tag = { link = 'Special' }, -- you can use CTRL-] on this
Delimiter = { link = 'Special' }, -- character that needs attention
@ -146,8 +136,8 @@ M.highlights = function()
Todo = { fg = C.purple, bold = true },
Error = { fg = C.red },
Warning = { fg = C.yellow},
Information = { fg = C.blue },
Hint = { fg = C.fg4 },
Information = { fg = C.br_blue },
Hint = { fg = C.fg0 },
},
additional = {
@ -164,12 +154,11 @@ M.highlights = function()
TermCursor = { link = 'Cursor' },
LineNr = { fg = C.bg3 },
CursorLine = { bg = C.bg0 },
CursorLineNr = { bg = C.bg0, fg = C.fg2 },
CursorLine = { bg = C.bg0_s },
CursorLineNr = { bg = C.bg0_s, fg = C.fg2 },
IncSearch = { link = 'CurSearch' },
CurSearch = { fg = C.purple_bg, bg = C.br_purple, bold = true },
Search = { fg = C.br_purple, bg = C.purple_bg },
IncSearch = { fg = C.br_yellow, reverse = true },
Search = { fg = C.yellow , reverse = true },
DiffAdd = { fg = C.green, bg = C.green_bg },
DiffDelete = { fg = C.red, bg = C.red_bg },
@ -204,7 +193,7 @@ M.highlights = function()
Directory = { fg = C.blue },
NonText = { fg = C.bg3 }, -- subtle EOL symbols
NonText = { fg = C.bg1 }, -- subtle EOL symbols
Whitespace = { fg = C.orange }, -- listchars
QuickFixLine = { fg = C.yellow , bg = C.bg2 }, -- selected quickfix item
@ -221,16 +210,6 @@ M.highlights = function()
DiagnosticError = { link = 'Error' },
DiagnosticInfo = { link = 'Information' },
DiagnosticHint = { link = 'Hint' },
DiagnosticVirtualTextWarn = { fg = C.dim_yellow },
DiagnosticVirtualTextError = { fg = C.dim_red },
DiagnosticVirtualTextInfo = { fg = C.dim_blue },
DiagnosticVirtualTextHint = { fg = C.gray },
DiagnosticSignWarn = { link = 'DiagnosticVirtualTextWarn' },
DiagnosticSignError = { link = 'DiagnosticVirtualTextError' },
DiagnosticSignInfo = { link = 'DiagnosticVirtualTextInfo' },
DiagnosticSignHint = { link = 'DiagnosticVirtualTextHint' },
},
pum = {
@ -453,7 +432,7 @@ M.highlights = function()
['@keyword.exception'] = { link = 'Exception' },
['@keyword.function'] = { link = 'Keyword' },
['@keyword.import'] = { link = 'Include' },
['@keyword.operator'] = { link = 'Operator' },
['@keyword.operator'] = { link = 'Opeator' },
['@keyword.repeat'] = { link = 'Repeat' },
['@keyword.return'] = { link = 'Keyword' },
['@keyword.storage'] = { link = 'StorageClass' },
@ -558,15 +537,6 @@ M.highlights = function()
['@lsp.type.variable'] = { link = '@variable' },
},
lsp = {
-- LspReferenceText
-- LspReferenceRead
-- LspReferenceWrite
-- LspCodeLens
-- LspCodeLensSeparator
LspSignatureActiveParameter = { fg = C.fg0, bg = C.aqua_bg, bold = true, italic = true },
},
-- 'tpope/vim-fugitive'
fugitive = {
fugitiveHeader = { link = 'Comment' },
@ -657,9 +627,8 @@ M.highlights = function()
-- 'lukas-reineke/virt-column.nvim'
virt_column = {
VirtColumn1 = { fg = C.bg1 },
VirtColumn2 = { fg = C.dim_yellow, bg = C.bg0 },
VirtColumn3 = { fg = C.dim_red, bg = C.orange_bg },
VirtColumn = { fg = C.bg1 }, -- virtual column
ColorColumn = {}, -- otherwise this is visible behind VirtColumn
},
-- 'kyazdani42/nvim-tree.lua'
@ -680,12 +649,12 @@ M.highlights = function()
-- 'nvim-telescope/telescope.nvim'
telescope = {
TelescopeBorder = { link = 'FloatBorder' },
TelescopePromptBorder = { fg = C.br_blue, bg = bg },
TelescopePromptBorder = { fg = C.fg0 },
TelescopeTitle = { link = 'FloatTitle' },
TelescopePromptPrefix = { link = 'FloatTitle' },
TelescopePromptCounter = { fg = C.bg3 },
TelescopeNormal = { link = 'Normal' },
TelescopeMatching = { link = 'Search' },
TelescopeNormal = { fg = C.fg },
TelescopeMatching = { fg = C.br_yellow, bg = C.yellow_bg },
TelescopeSelection = { bg = C.blue_bg },
TelescopeMultiSelection = { fg = C.orange, italic = true },
TelescopeMultiIcon = { link = 'TelescopeMultiSelection' },
@ -703,44 +672,25 @@ M.highlights = function()
-- 'hrsh7th/nvim-cmp'
nvim_cmp = {
CmpItemAbbr = { link = 'Comment' },
CmpItemAbbrMatch = { fg = C.br_purple, bg = C.purple_bg },
CmpItemAbbrMatch = { fg = C.fg0 },
CmpItemAbbrMatchFuzzy = { link = 'CmpItemAbbrMatch' },
CmpItemAbbrDeprecated = { fg = C.dim_orange, strikethrough = true },
CmpItemAbbrDeprecated = { fg = C.orange, strikethrough = true },
CmpItemKind = { fg = C.purple },
CmpItemMenu = { fg = C.bg2, italic = true },
CmpItemKind = { fg = C.fg2 },
CmpItemKindText = { fg = C.fg2, italic = true },
CmpItemKindKeyword = { fg = C.dim_green },
CmpItemKindVariable = { fg = C.aqua },
CmpItemKindInterface = { link = 'CmpItemKindVariable' },
CmpItemKindText = { link = 'CmpItemKindVariable' },
CmpItemKindFunction = { fg = C.blue },
CmpItemKindMethod = { link = 'CmpItemKindFunction' },
CmpItemKindKeyword = { fg = C.green },
CmpItemKindProperty = { link = 'CmpItemKindKeyword' },
CmpItemKindUnit = { link = 'CmpItemKindKeyword' },
CmpItemKindInterface = { fg = C.dim_yellow },
CmpItemKindClass = { link = 'CmpItemKindInterface' },
CmpItemKindEnum = { link = 'CmpItemKindInterface' },
CmpItemKindEvent = { link = 'CmpItemKindInterface' },
CmpItemKindModule = { link = 'CmpItemKindInterface' },
CmpItemKindReference = { link = 'CmpItemKindInterface' },
CmpItemKindStruct = { link = 'CmpItemKindInterface' },
CmpItemKindTypeParameter = { link = 'CmpItemKindInterface' },
CmpItemKindVariable = { fg = C.dim_aqua },
CmpItemKindField = { link = 'CmpItemKindVariable' },
CmpItemKindProperty = { link = 'CmpItemKindVariable' },
CmpItemKindFunction = { fg = C.dim_blue },
CmpItemKindConstructor = { link = 'CmpItemKindFunction' },
CmpItemKindMethod = { link = 'CmpItemKindFunction' },
CmpItemKindOperator = { link = 'CmpItemKindFunction' },
CmpItemKindConstant = { fg = C.dim_orange },
CmpItemKindColor = { link = 'CmpItemKindConstant' },
CmpItemKindEnumMember = { link = 'CmpItemKindConstant' },
CmpItemKindSnippet = { fg = C.dim_purple },
CmpItemKindFile = { link = 'CmpItemKindText' },
CmpItemKindFolder = { fg = C.dim_blue },
},
-- 'mawkler/modicator.nvim'
@ -760,37 +710,6 @@ M.highlights = function()
gitmessengerHash = { link = 'Subtitle' },
gitmessengerHistory = { link = 'diffFile' },
},
-- 'j-hui/fidget.nvim'
fidget = {
FidgetTitle = { link = 'Title' },
FidgetTask = { link = 'String' },
},
-- 'rcarriga/nvim-notify'
nvim_notify = {
NotifyBackground = { fg = fg, bg = bg },
NotifyLogTitle = { fg = C.purple },
NotifyLogTime = { link = 'Comment' },
NotifyTRACEIcon = { link = 'DiagnosticInfo' },
NotifyDEBUGIcon = { link = 'DiagnosticHint' },
NotifyINFOIcon = { link = 'DiagnosticOk' },
NotifyWARNIcon = { link = 'DiagnosticWarn' },
NotifyERRORIcon = { link = 'DiagnosticError' },
NotifyTRACETitle = { link = 'DiagnosticInfo' },
NotifyDEBUGTitle = { link = 'DiagnosticHint' },
NotifyINFOTitle = { link = 'DiagnosticOk' },
NotifyWARNTitle = { link = 'DiagnosticWarn' },
NotifyERRORTitle = { link = 'DiagnosticError' },
NotifyTRACEBorder = { link = 'DiagnosticInfo' },
NotifyDEBUGBorder = { link = 'DiagnosticHint' },
NotifyINFOBorder = { link = 'DiagnosticOk' },
NotifyWARNBorder = { link = 'DiagnosticWarn' },
NotifyERRORBorder = { link = 'DiagnosticError' },
},
}
end

View file

@ -2,25 +2,25 @@ local C = require 'gruvbox'.colors()
return {
normal = {
a = { fg = C.bg0_h, bg = C.blue, bold = true },
b = { fg = C.fg2, bg = C.bg1 },
c = { fg = C.fg2, bg = C.bg0_s },
a = { fg = C.bg0, bg = C.blue, bold = true },
b = { fg = C.fg2, bg = C.bg2 },
c = { fg = C.fg2, bg = C.bg1 },
},
insert = {
a = { fg = C.bg0_h, bg = C.green, bold = true },
a = { fg = C.bg0, bg = C.green, bold = true },
},
visual = {
a = { fg = C.bg0_h, bg = C.purple, bold = true },
a = { fg = C.bg0, bg = C.purple, bold = true },
},
replace = {
a = { fg = C.bg0_h, bg = C.red, bold = true },
a = { fg = C.bg0, bg = C.red, bold = true },
},
command = {
a = { fg = C.bg0_h, bg = C.yellow, bold = true },
a = { fg = C.bg0, bg = C.yellow, bold = true },
},
inactive = {
a = { fg = C.fg4, bg = C.bg2 },
b = { fg = C.fg4, bg = C.bg1 },
c = { fg = C.fg4, bg = C.bg0_s },
b = { fg = C.fg4, bg = C.bg2 },
c = { fg = C.fg4, bg = C.bg1 },
},
}

38
lua/scratchpad.lua Normal file
View file

@ -0,0 +1,38 @@
local module_root = function(--[[modname]]_)
return '/Users/fernando/.dotfiles/config/nvim/lua/hello'
end
local scan_dir = function(path, callback)
local handle = vim.loop.fs_scandir(path)
while handle do
local name, type = vim.loop.fs_scandir_next(handle)
if not name then break end
callback(path .. '/' .. name, name, type)
end
end
local scan_module = function(modname, callback)
local root = module_root(modname)
if not root then return end
scan_dir(root, function(path, name, type)
if name == 'init.lua' then
callback(modname)
elseif (type == 'file' or type == 'link') and name:sub(-4) == '.lua' then
callback(modname .. '.' .. name:sub(1, -5))
elseif type == 'directory' and vim.loop.fs_stat(path .. '/init.lua') then
callback(modname .. '.' .. name)
end
end)
end
local merge_module = function(modname)
local modules = {}
scan_module(modname, function(name)
table.insert(modules, require(name))
end)
return vim.tbl_extend('force', {}, unpack(modules))
end
P(merge_module('hello'))