1
0
Fork 0

update `nvim` config

urosm 2024-02-11 10:25:16 +01:00
parent 425549a15c
commit c604830cae
2 changed files with 68 additions and 83 deletions

View File

@ -5,22 +5,22 @@
-- colors ---------------------------------------------------------------------- -- colors ----------------------------------------------------------------------
local C = { local C = {
{ 0, "#292526" }, -- black { 0, "#000000" }, -- black
{ 1, "#ff404f" }, -- red { 1, "#fa3500" }, -- red
{ 2, "#00a147" }, -- green { 2, "#009843" }, -- green
{ 3, "#e06e00" }, -- orange { 3, "#d06600" }, -- orange
{ 4, "#6185ff" }, -- blue { 4, "#856cff" }, -- blue
{ 5, "#ff3e8b" }, -- magenta { 5, "#ff1170" }, -- magenta
{ 6, "#0095d7" }, -- cyan { 6, "#008cca" }, -- cyan
{ 7, "#e3e0e1" }, -- white { 7, "#e2e2e2" }, -- white
{ 8, "#958a8d" }, -- black { 8, "#848484" }, -- black
{ 9, "#ffb3b6" }, -- red { 9, "#ff888e" }, -- red
{ 10, "#00e46a" }, -- green { 10, "#00c55b" }, -- green
{ 11, "#ffb598" }, -- orange { 11, "#ff8d48" }, -- orange
{ 12, "#b8c3ff" }, -- blue { 12, "#ac9fff" }, -- blue
{ 13, "#ffb1c5" }, -- magenta { 13, "#ffb1c0" }, -- magenta
{ 14, "#92ccff" }, -- cyan { 14, "#92ccff" }, -- cyan
{ 15, "#f4f3f3" }, -- white { 15, "#ffffff" }, -- white
} }
local black_c = C[1] local black_c = C[1]
@ -50,8 +50,6 @@ else
vim.opt.termguicolors = true vim.opt.termguicolors = true
end end
local tty = vim.env.TERM == "linux" or vim.env.TERM == "screen.linux"
for _, v in ipairs(C) do for _, v in ipairs(C) do
local key = ("terminal_color_%i"):format(v[1]) local key = ("terminal_color_%i"):format(v[1])
vim.g[key] = v[2] vim.g[key] = v[2]
@ -70,25 +68,16 @@ end
function H:fg(c) function H:fg(c)
self.ctermfg = c[1] self.ctermfg = c[1]
self.fg = c[2] self.fg = c[2]
if c[1] == 4 and tty then
self.bold = true
end
return self return self
end end
function H:bg(c) function H:bg(c)
self.ctermbg = c[1] self.ctermbg = c[1]
self.bg = c[2] self.bg = c[2]
if c[1] == 4 and tty then
self.bold = true
end
return self return self
end end
function H:attr(a) function H:attr(a)
if tty then
if a == "underline" then return self end
end
self[a] = true self[a] = true
return self return self
end end
@ -269,11 +258,11 @@ set_hl("DiagnosticDeprecated", diagnostic_hint_u_h)
set_hl("DiagnosticUnnecessary", diagnostic_hint_u_h) set_hl("DiagnosticUnnecessary", diagnostic_hint_u_h)
-- misc ------------------------------------------------------------------------ -- misc ------------------------------------------------------------------------
set_hl("Directory", H:new():fg(blue_c):attr("bold")) set_hl("Directory", H:new():fg(blue_c))
-- syntax ---------------------------------------------------------------------- -- syntax ----------------------------------------------------------------------
local syntax_normal_h = {} 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_constant_h = H:new():fg(red_c)
local syntax_identifier_h = H:new() local syntax_identifier_h = H:new()
local syntax_statement_h = H:new():fg(orange_c) local syntax_statement_h = H:new():fg(orange_c)

View File

@ -12,35 +12,70 @@ unlet! b:current_syntax
syntax spell toplevel syntax spell toplevel
" comment " block formatting """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syn region markdownHTMLComment start=/<!--\s\=/ end=/\s\=-->/ keepend " setext heading
hi def link markdownHTMLComment markdownComment 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 " titleblock
syn region markdownTitleBlock start=/\%^%/ end=/\n\n/ contains=markdownTitleBlockDelimiter syn region markdownTitleBlock start=/\%^%/ end=/\n$/ contains=@markdownInline,markdownTitleBlockDelimiter
hi def link markdownTitleBlock markdownBold hi def link markdownTitleBlock markdownTitle
syn match markdownTitleBlockDelimiter /%\ / contained syn match markdownTitleBlockDelimiter /%\ / contained
hi def link markdownTitleBlockDelimiter markdownDelimiter hi def link markdownTitleBlockDelimiter markdownDelimiter
" blockquote " horizontal rule
syn match markdownBlockquote /\_^\(\s*>\)\+/ containedin=markdownItalic,markdownBold,markdownPCite,markdownSuperscript,markdownSubscript,markdownStrike,markdownUListItem,markdownNoFormatted syn match markdownHRule /^\n\s*\*\s*\(\*\s*\)\{2,}\n$/ display
hi def link markdownBlockquote markdownDelimiter 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<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\*\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,markdownNoFormattedInEmphasis,markdownLatexInlineMath,markdownAmpersandEscape
syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@1<=_\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,markdownNoFormattedInEmphasis,markdownLatexInlineMath,markdownAmpersandEscape
hi def link markdownItalic htmlItalic
" bold
syn region markdownBold matchgroup=markdownDelimiter start=/\(\\\@<!\*\)\{2}/ end=/\(\\\@<!\*\)\{2}/ contains=@Spell,markdownNoFormattedInStrong,markdownLatexInlineMath,markdownAmpersandEscape
syn region markdownBold matchgroup=markdownDelimiter start=/__/ end=/__/ contains=@Spell,markdownNoFormattedInStrong,markdownLatexInlineMath,markdownAmpersandEscape
hi def link markdownBold htmlBold
" bold italic
syn region markdownBoldItalic matchgroup=markdownDelimiter start=/\*\{3}\(\S[^*]*\(\*\S\|\n[^*]*\*\S\)\)\@=/ end=/\S\@<=\*\{3}/ contains=@Spell,markdownAmpersandEscape
syn region markdownBoldItalic matchgroup=markdownDelimiter start=/\(___\)\S\@=/ end=/\S\@<=___/ contains=@Spell,markdownAmpersandEscape
hi def link markdownBoldItalic htmlBoldItalic
syn region markdownBoldInItalic matchgroup=markdownDelimiter start=/\*\*/ end=/\*\*/ contained containedin=markdownItalic contains=@Spell,markdownAmpersandEscape
syn region markdownBoldInItalic matchgroup=markdownDelimiter start=/__/ end=/__/ contained containedin=markdownItalic contains=@Spell,markdownAmpersandEscape
syn region markdownItalicInBold matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=\*\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=markdownBold contains=@Spell,markdownAmpersandEscape
syn region markdownItalicInBold matchgroup=markdownDelimiter start=/\\\@<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=_\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=markdownBold contains=@Spell,markdownAmpersandEscape
hi def link markdownBoldInItalic markdownBoldItalic
hi def link markdownItalicInBold markdownBoldItalic
" link " link
syn match markdownLink /!\=\[.\{-}\](.\{-})/ contains=markdownLinkLabel,markdownLinkURL syn match markdownLink /!\=\[\_.\{-}\](\_.\{-})/ contains=markdownLinkLabel
hi def link markdownLink markdownDelimiter hi def link markdownLink markdownUnderlined
syn match markdownLinkLabel /\[\@1<=[^\]]\+/ contained syn match markdownLinkLabel /\[\@1<=[^\]]\+/ contained contains=@markdownInline
hi def link markdownLinkLabel markdownLabel hi def link markdownLinkLabel markdownLabel
syn match markdownLinkURL /(\@1<=[^)]\+/ contained
hi def link markdownLinkURL markdownUnderlined
" automatic link " automatic link
syn match markdownAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/ contains=NONE syn match markdownAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/ contains=NONE
hi def link markdownAutomaticLink markdownUnderlined hi def link markdownAutomaticLink markdownUnderlined
" wikilink " wikilink
syn match markdownWikilink /\[\[.*\]\]/ contains=markdownWikilinkLabel
hi def link markdownWikilink markdownUnderlined
syn region markdownWikilink start=/\[\[/ end=/\]\]/ contains=markdownWikilinkLabel,markdownWikilinkURL keepend display syn region markdownWikilink start=/\[\[/ end=/\]\]/ contains=markdownWikilinkLabel,markdownWikilinkURL keepend display
hi def link markdownWikilink markdownDelimiter
syn match markdownWikilinkLabel /\(\[\[\)\@2<=[^\|\[\]]\+/ contained syn match markdownWikilinkLabel /\(\[\[\)\@2<=[^\|\[\]]\+/ contained
hi def link markdownWikilinkLabel markdownLabel hi def link markdownWikilinkLabel markdownLabel
syn match markdownWikilinkURL /|\@1<=[^\]]\+/ contained syn match markdownWikilinkURL /|\@1<=[^\]]\+/ contained
@ -64,26 +99,6 @@ hi def link markdownCiteKey markdownLabel
syn match markdownCiteLocator /[\[\]]/ contained containedin=markdownPCite,markdownICite syn match markdownCiteLocator /[\[\]]/ contained containedin=markdownPCite,markdownICite
hi def link markdownCiteLocator markdownDelimiter hi def link markdownCiteLocator markdownDelimiter
" italic
syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\*\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,markdownNoFormattedInEmphasis,markdownLatexInlineMath,markdownAmpersandEscape
syn region markdownItalic matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@1<=_\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,markdownNoFormattedInEmphasis,markdownLatexInlineMath,markdownAmpersandEscape
hi def link markdownItalic htmlItalic
" bold
syn region markdownBold matchgroup=markdownDelimiter start=/\(\\\@<!\*\)\{2}/ end=/\(\\\@<!\*\)\{2}/ contains=@Spell,markdownNoFormattedInStrong,markdownLatexInlineMath,markdownAmpersandEscape
syn region markdownBold matchgroup=markdownDelimiter start=/__/ end=/__/ contains=@Spell,markdownNoFormattedInStrong,markdownLatexInlineMath,markdownAmpersandEscape
hi def link markdownBold htmlBold
" bold italic
syn region markdownBoldItalic matchgroup=markdownDelimiter start=/\*\{3}\(\S[^*]*\(\*\S\|\n[^*]*\*\S\)\)\@=/ end=/\S\@<=\*\{3}/ contains=@Spell,markdownAmpersandEscape
syn region markdownBoldItalic matchgroup=markdownDelimiter start=/\(___\)\S\@=/ end=/\S\@<=___/ contains=@Spell,markdownAmpersandEscape
hi def link markdownBoldItalic htmlBoldItalic
syn region markdownBoldInItalic matchgroup=markdownDelimiter start=/\*\*/ end=/\*\*/ contained containedin=markdownItalic contains=@Spell,markdownAmpersandEscape
syn region markdownBoldInItalic matchgroup=markdownDelimiter start=/__/ end=/__/ contained containedin=markdownItalic contains=@Spell,markdownAmpersandEscape
syn region markdownItalicInBold matchgroup=markdownDelimiter start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=\*\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=markdownBold contains=@Spell,markdownAmpersandEscape
syn region markdownItalicInBold matchgroup=markdownDelimiter start=/\\\@<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=_\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=markdownBold contains=@Spell,markdownAmpersandEscape
hi def link markdownBoldInItalic markdownBoldItalic
hi def link markdownItalicInBold markdownBoldItalic
" strikeout " strikeout
syn region markdownStrike start=/\~\~/ end=/\~\~/ contains=markdownStrikeout,@Spell keepend syn region markdownStrike start=/\~\~/ end=/\~\~/ contains=markdownStrikeout,@Spell keepend
@ -101,19 +116,6 @@ syn region markdownSuperscript start=/\^\(\([[:graph:]]\(\\ \)\=\)\{-}\^\)\@=/ s
syn match markdownSuperscriptDelimiter /\^/ contained syn match markdownSuperscriptDelimiter /\^/ contained
hi def link markdownSuperscriptDelimiter markdownDelimiter hi def link markdownSuperscriptDelimiter markdownDelimiter
" heading
syn match markdownAtxHeading /\(\%^\|<.\+>.*\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}\|\\\@<!#\+\(\s*.*$\)\@=\)/ contained containedin=markdownAtxHeading
hi def link markdownAtxHeadingDelimiter markdownDelimiter
syn match markdownSetexHeading /^.\+\n[=]\+$/ contains=markdownItalic,markdownBold,markdownNoFormatted,markdownLaTeXInlineMath,markdownEscapedDollar,@Spell,markdownAmpersandEscape
syn match markdownSetexHeading /^.\+\n[-]\+$/ contains=markdownItalic,markdownBold,markdownNoFormatted,markdownLaTeXInlineMath,markdownEscapedDollar,@Spell,markdownAmpersandEscape
syn match markdownHeadingAttr /{.*}/ contained containedin=markdownAtxHeader,markdownSetexHeader
syn match markdownHeadingID /#[-_:.[:lower:][:upper:]]*/ contained containedin=markdownHeaderAttr
hi def link markdownSetexHeading markdownTitle
hi def link markdownHeadingAttr markdownComment
hi def link markdownHeadingID markdownIdentifier
" line block " line block
syn region markdownLineBlock start=/^|/ end=/\(^|\(.*\n|\@!\)\@=.*\)\@<=\n/ transparent syn region markdownLineBlock start=/^|/ end=/\(^|\(.*\n|\@!\)\@=.*\)\@<=\n/ transparent
syn match markdownLineBlockDelimiter /^|/ contained containedin=markdownLineBlock syn match markdownLineBlockDelimiter /^|/ contained containedin=markdownLineBlock
@ -215,15 +217,8 @@ hi def link markdownDefinitionBlockDelimiter markdownDelimiter
" new line " new line
syn match markdownNewLine /\%(\%(\S\)\@<= \{2,}\|\\\)$/ display containedin=markdownItalic,markdownBold,markdownBoldItalic,markdownBoldInItalic,markdownItalicInBold syn match markdownNewLine /\%(\%(\S\)\@<= \{2,}\|\\\)$/ display containedin=markdownItalic,markdownBold,markdownBoldItalic,markdownBoldInItalic,markdownItalicInBold
hi def link markdownNewLine Error hi def link markdownNewLine markdownError
" rule
syn match markdownHRule /^\s*\([*\-_]\)\s*\%(\1\s*\)\{2,}$/ display
hi def link markdownHRule markdownDelimiter
" &-escape
syn match markdownAmpersandEscape /\v\&(#\d+|#x\x+|[[:alnum:]]+)\;/ contains=NoSpell
hi def link markdownAmpersandEscape Special
" yaml " yaml
syn include @YAML syntax/yaml.vim syn include @YAML syntax/yaml.vim
@ -264,6 +259,7 @@ hi def link markdownSpecialComment SpecialComment
hi def link markdownDebug Debug hi def link markdownDebug Debug
hi def link markdownUnderlined Underlined hi def link markdownUnderlined Underlined
hi def link markdownIgnore Ignore hi def link markdownIgnore Ignore
hi def link markdownError Error
hi def link markdownItalic htmlItalic hi def link markdownItalic htmlItalic
hi def link markdownBold htmlBold hi def link markdownBold htmlBold