From 06fedbc22df1b05aa4ba03ed1074a122848921e1 Mon Sep 17 00:00:00 2001 From: urosm Date: Sun, 11 Feb 2024 10:25:16 +0100 Subject: [PATCH] .config/nvim: update --- .config/nvim/colors/basic.lua | 45 +++++-------- .config/nvim/syntax/markdown.vim | 106 +++++++++++++++---------------- 2 files changed, 68 insertions(+), 83 deletions(-) diff --git a/.config/nvim/colors/basic.lua b/.config/nvim/colors/basic.lua index 4c0c27f..958ced7 100644 --- a/.config/nvim/colors/basic.lua +++ b/.config/nvim/colors/basic.lua @@ -5,22 +5,22 @@ -- colors ---------------------------------------------------------------------- local C = { - { 0, "#292526" }, -- black - { 1, "#ff404f" }, -- red - { 2, "#00a147" }, -- green - { 3, "#e06e00" }, -- orange - { 4, "#6185ff" }, -- blue - { 5, "#ff3e8b" }, -- magenta - { 6, "#0095d7" }, -- cyan - { 7, "#e3e0e1" }, -- white - { 8, "#958a8d" }, -- black - { 9, "#ffb3b6" }, -- red - { 10, "#00e46a" }, -- green - { 11, "#ffb598" }, -- orange - { 12, "#b8c3ff" }, -- blue - { 13, "#ffb1c5" }, -- magenta + { 0, "#000000" }, -- black + { 1, "#fa3500" }, -- red + { 2, "#009843" }, -- green + { 3, "#d06600" }, -- orange + { 4, "#856cff" }, -- blue + { 5, "#ff1170" }, -- magenta + { 6, "#008cca" }, -- cyan + { 7, "#e2e2e2" }, -- white + { 8, "#848484" }, -- black + { 9, "#ff888e" }, -- red + { 10, "#00c55b" }, -- green + { 11, "#ff8d48" }, -- orange + { 12, "#ac9fff" }, -- blue + { 13, "#ffb1c0" }, -- magenta { 14, "#92ccff" }, -- cyan - { 15, "#f4f3f3" }, -- white + { 15, "#ffffff" }, -- white } local black_c = C[1] @@ -50,8 +50,6 @@ else vim.opt.termguicolors = true end -local tty = vim.env.TERM == "linux" or vim.env.TERM == "screen.linux" - for _, v in ipairs(C) do local key = ("terminal_color_%i"):format(v[1]) vim.g[key] = v[2] @@ -70,25 +68,16 @@ end function H:fg(c) self.ctermfg = c[1] self.fg = c[2] - if c[1] == 4 and tty then - self.bold = true - end return self end function H:bg(c) self.ctermbg = c[1] self.bg = c[2] - if c[1] == 4 and tty then - self.bold = true - end return self end function H:attr(a) - if tty then - if a == "underline" then return self end - end self[a] = true return self end @@ -269,11 +258,11 @@ set_hl("DiagnosticDeprecated", diagnostic_hint_u_h) set_hl("DiagnosticUnnecessary", diagnostic_hint_u_h) -- misc ------------------------------------------------------------------------ -set_hl("Directory", H:new():fg(blue_c):attr("bold")) +set_hl("Directory", H:new():fg(blue_c)) -- syntax ---------------------------------------------------------------------- local syntax_normal_h = {} -local syntax_comment_h = H:new():fg(blue_c):attr("bold") +local syntax_comment_h = H:new():fg(blue_c) local syntax_constant_h = H:new():fg(red_c) local syntax_identifier_h = H:new() local syntax_statement_h = H:new():fg(orange_c) diff --git a/.config/nvim/syntax/markdown.vim b/.config/nvim/syntax/markdown.vim index e83e7f2..760f7fc 100644 --- a/.config/nvim/syntax/markdown.vim +++ b/.config/nvim/syntax/markdown.vim @@ -12,35 +12,70 @@ unlet! b:current_syntax syntax spell toplevel -" comment -syn region markdownHTMLComment start=// keepend -hi def link markdownHTMLComment markdownComment +" block formatting """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" setext heading +syn match markdownSetexHeading /\%(\%^\|\_^\n\).\+\n[=-]\+\n$/ contains=@markdownInline,markdownSetextHeadingDelimiter,markdownHeadingAttribute +hi def link markdownSetexHeading markdownTitle +syn match markdownSetextHeadingDelimiter /^[=-]\+$/ contained +hi def link markdownSetextHeadingDelimiter markdownDelimiter + +" atx heading +syn match markdownAtxHeading /\%(\%^\|\_^\n\)#\{1,6} .*\n$/ contains=@markdownInline,markdownAtxHeadingDelimiter,markdownHeadingAttribute +hi def link markdownAtxHeading markdownTitle +syn match markdownAtxHeadingDelimiter /^#\{1,6}/ contained +hi def link markdownAtxHeadingDelimiter markdownDelimiter +syn match markdownHeadingAttribute /.*\zs{.\{-}}$/ contained +hi def link markdownHeadingAttribute markdownDelimiter " titleblock -syn region markdownTitleBlock start=/\%^%/ end=/\n\n/ contains=markdownTitleBlockDelimiter -hi def link markdownTitleBlock markdownBold +syn region markdownTitleBlock start=/\%^%/ end=/\n$/ contains=@markdownInline,markdownTitleBlockDelimiter +hi def link markdownTitleBlock markdownTitle syn match markdownTitleBlockDelimiter /%\ / contained hi def link markdownTitleBlockDelimiter markdownDelimiter -" blockquote -syn match markdownBlockquote /\_^\(\s*>\)\+/ containedin=markdownItalic,markdownBold,markdownPCite,markdownSuperscript,markdownSubscript,markdownStrike,markdownUListItem,markdownNoFormatted -hi def link markdownBlockquote markdownDelimiter +" horizontal rule +syn match markdownHRule /^\n\s*\*\s*\(\*\s*\)\{2,}\n$/ display +syn match markdownHRule /^\n\s*\-\s*\(\-\s*\)\{2,}\n$/ display +syn match markdownHRule /^\n\s*_\s*\(_\s*\)\{2,}\n$/ display +hi def link markdownHRule markdownDelimiter + +" inline formatting """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" emphasis +syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1/ contains=NONE hi def link markdownAutomaticLink markdownUnderlined " wikilink +syn match markdownWikilink /\[\[.*\]\]/ contains=markdownWikilinkLabel +hi def link markdownWikilink markdownUnderlined + syn region markdownWikilink start=/\[\[/ end=/\]\]/ contains=markdownWikilinkLabel,markdownWikilinkURL keepend display -hi def link markdownWikilink markdownDelimiter syn match markdownWikilinkLabel /\(\[\[\)\@2<=[^\|\[\]]\+/ contained hi def link markdownWikilinkLabel markdownLabel syn match markdownWikilinkURL /|\@1<=[^\]]\+/ contained @@ -64,26 +99,6 @@ hi def link markdownCiteKey markdownLabel syn match markdownCiteLocator /[\[\]]/ contained containedin=markdownPCite,markdownICite hi def link markdownCiteLocator markdownDelimiter -" italic -syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=markdownItalic,markdownBold,markdownNoFormatted,markdownLaTeXInlineMath,markdownEscapedDollar,@Spell,markdownAmpersandEscape,markdownLink display -hi def link markdownAtxHeading Title -syn match markdownAtxHeadingDelimiter /\(^#\{1,6}\|\\\@