diff options
author | sefidel <contact@sefidel.net> | 2022-02-27 00:32:05 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2022-02-27 00:32:05 +0900 |
commit | 36f342ad71fdfdb8444ae9723ed4e383d57d82fb (patch) | |
tree | 5aa496ad66a9dd972c9d793ac0afcb0d9ccbdc7d | |
parent | 06616c4262c5587685283745a1e3f33a043279c4 (diff) | |
download | nvimrc-36f342ad71fdfdb8444ae9723ed4e383d57d82fb.tar.gz nvimrc-36f342ad71fdfdb8444ae9723ed4e383d57d82fb.zip |
feat(macro)!: use macro for highlighting
-rw-r--r-- | fnl/nvrc/colors.fnl | 76 | ||||
-rw-r--r-- | fnl/nvrc/macro/color.fnl | 11 |
2 files changed, 45 insertions, 42 deletions
diff --git a/fnl/nvrc/colors.fnl b/fnl/nvrc/colors.fnl index b231e4e..074d870 100644 --- a/fnl/nvrc/colors.fnl +++ b/fnl/nvrc/colors.fnl @@ -22,54 +22,54 @@ (lambda colors.apply [colorscheme] - (local {: highlight} (require :nvrc.macro.color)) + (import-macros {: highlight! : link!} :nvrc.macro.color) (vim.cmd (.. "colorscheme " colorscheme)) ; Buffer - (highlight :EndOfBuffer {:fg (. colors :bg)}) - (highlight :FloatBorder {:fg (. colors :blue)}) - (highlight :NormalFloat {:bg (. colors :bblack)}) + (highlight! :EndOfBuffer {:fg (. colors :bg)}) + (highlight! :FloatBorder {:fg (. colors :blue)}) + (highlight! :NormalFloat {:bg (. colors :bblack)}) ; Pmenu - (highlight :Pmenu {:bg (. colors :bblack)}) - (highlight :PmenuSbar {:bg (. colors :bblack)}) - (highlight :PmenuSel {:fg (. colors :orange) :bg (. colors :dgrey)}) - (highlight :PmenuThumb {:bg (. colors :skyblue)}) - (highlight :CmpItemAbbr {:fg (. colors :fg)}) - (highlight :CmpItemAbbrMatch {:fg (. colors :fg)}) - (highlight :CmpItemKind {:fg (. colors :fg)}) - (highlight :CmpItemMenu {:fg (. colors :fg)}) + (highlight! :Pmenu {:bg (. colors :bblack)}) + (highlight! :PmenuSbar {:bg (. colors :bblack)}) + (highlight! :PmenuSel {:fg (. colors :orange) :bg (. colors :dgrey)}) + (highlight! :PmenuThumb {:bg (. colors :skyblue)}) + (highlight! :CmpItemAbbr {:fg (. colors :fg)}) + (highlight! :CmpItemAbbrMatch {:fg (. colors :fg)}) + (highlight! :CmpItemKind {:fg (. colors :fg)}) + (highlight! :CmpItemMenu {:fg (. colors :fg)}) ; Misc - (highlight :StatusLine {:bg (. colors :bg)}) - (highlight :StatusLineNC {:fg (. colors :grey) :bg (. colors :black) :underline true}) - (highlight :TabLine {:fg (. colors :fg) :bg (. colors :mgrey)}) - (highlight :TabLineFill {:fg (. colors :fg) :bg (. colors :bg)}) - (highlight :TabLineSel {:fg (. colors :fg) :bg (. colors :grey2)}) - (highlight :LineNr {:fg (. colors :grey)}) - (highlight :NvimInternalError {:fg (. colors :red)}) - (highlight :VertSplit {:fg (. colors :grey2)}) + (highlight! :StatusLine {:bg (. colors :bg)}) + (highlight! :StatusLineNC {:fg (. colors :grey) :bg (. colors :black) :underline true}) + (highlight! :TabLine {:fg (. colors :fg) :bg (. colors :mgrey)}) + (highlight! :TabLineFill {:fg (. colors :fg) :bg (. colors :bg)}) + (highlight! :TabLineSel {:fg (. colors :fg) :bg (. colors :grey2)}) + (highlight! :LineNr {:fg (. colors :grey)}) + (highlight! :NvimInternalError {:fg (. colors :red)}) + (highlight! :VertSplit {:fg (. colors :grey2)}) ; LSP - (highlight :DiagnosticError {:fg (. colors :red)}) - (highlight :DiagnosticWarn {:fg (. colors :yellow)}) - (highlight :DiagnosticInformation {:fg (. colors :green)}) - (highlight :DiagnosticHint {:fg (. colors :grey)}) - (highlight :LspReferenceRead {:underline true}) - (highlight :LspReferenceText {:underline true}) - (highlight :LspReferenceWrite {:underline true}) - (highlight :LspSemantic_type {:link :Include}) - (highlight :LspSemantic_function {:link :Identifier}) - (highlight :LspSemantic_struct {:link :Number}) - (highlight :LspSemantic_variable {:bg :gray}) - (highlight :LspSemantic_keyword {:link :Structure}) + (highlight! :DiagnosticError {:fg (. colors :red)}) + (highlight! :DiagnosticWarn {:fg (. colors :yellow)}) + (highlight! :DiagnosticInformation {:fg (. colors :green)}) + (highlight! :DiagnosticHint {:fg (. colors :grey)}) + (highlight! :LspReferenceRead {:underline true}) + (highlight! :LspReferenceText {:underline true}) + (highlight! :LspReferenceWrite {:underline true}) + (highlight! :LspSemantic_variable {:bg :gray}) + (link! :LspSemantic_type :Include) + (link! :LspSemantic_function :Identifier) + (link! :LspSemantic_struct :Number) + (link! :LspSemantic_keyword :Structure) ; Lir - (highlight :LirFloatNormal {:bg (. colors :black)}) - (highlight :LirDir {:fg (. colors :skyblue)}) - (highlight :LirSymLink {:fg (. colors :grey)}) - (highlight :LirEmptyDirText {:fg (. colors :blue)}) - (highlight :LirFloatCurdirWindowNormal {:bg (. colors :black)}) - (highlight :LirFloatCurdirWindowDirName {:fg (. colors :skyblue)})) + (highlight! :LirFloatNormal {:bg (. colors :black)}) + (highlight! :LirDir {:fg (. colors :skyblue)}) + (highlight! :LirSymLink {:fg (. colors :grey)}) + (highlight! :LirEmptyDirText {:fg (. colors :blue)}) + (highlight! :LirFloatCurdirWindowNormal {:bg (. colors :black)}) + (highlight! :LirFloatCurdirWindowDirName {:fg (. colors :skyblue)})) colors diff --git a/fnl/nvrc/macro/color.fnl b/fnl/nvrc/macro/color.fnl index 9636956..d481fc9 100644 --- a/fnl/nvrc/macro/color.fnl +++ b/fnl/nvrc/macro/color.fnl @@ -1,9 +1,12 @@ (fn tbl? [x] (= :table (type x))) -(fn highlight [group-arg colset] +(fn highlight! [group colset] "Add a highlighting group." - (each [_ group (ipairs (if (tbl? group-arg) group-arg [group-arg]))] - (vim.api.nvim_set_hl 0 group colset))) + `(vim.api.nvim_set_hl 0 ,group ,colset)) -{: highlight} +(fn link! [group link] + "Link a highlighting group." + (highlight! group {:link link})) + +{: highlight! : link!} |