diff --git a/nvim/after/ftplugin/c.lua b/nvim/after/ftplugin/c.lua new file mode 100644 index 0000000..f2c4f32 --- /dev/null +++ b/nvim/after/ftplugin/c.lua @@ -0,0 +1,2 @@ +-- treesitter ------------------------------------------------------------------ +vim.treesitter.start() diff --git a/nvim/after/ftplugin/help.lua b/nvim/after/ftplugin/help.lua new file mode 100644 index 0000000..f2c4f32 --- /dev/null +++ b/nvim/after/ftplugin/help.lua @@ -0,0 +1,2 @@ +-- treesitter ------------------------------------------------------------------ +vim.treesitter.start() diff --git a/nvim/after/ftplugin/javascript.lua b/nvim/after/ftplugin/javascript.lua new file mode 100644 index 0000000..8c62149 --- /dev/null +++ b/nvim/after/ftplugin/javascript.lua @@ -0,0 +1,4 @@ +-- options --------------------------------------------------------------------- +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true diff --git a/nvim/after/ftplugin/lua.lua b/nvim/after/ftplugin/lua.lua index ff3fe6c..df60cbf 100644 --- a/nvim/after/ftplugin/lua.lua +++ b/nvim/after/ftplugin/lua.lua @@ -4,4 +4,4 @@ vim.opt.shiftwidth = 2 vim.opt.expandtab = true -- treesitter ------------------------------------------------------------------ --- vim.treesitter.start() +vim.treesitter.start() diff --git a/nvim/after/ftplugin/perl.lua b/nvim/after/ftplugin/perl.lua new file mode 100644 index 0000000..4d2c74e --- /dev/null +++ b/nvim/after/ftplugin/perl.lua @@ -0,0 +1,4 @@ +-- options --------------------------------------------------------------------- +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true diff --git a/nvim/after/ftplugin/vim.lua b/nvim/after/ftplugin/vim.lua new file mode 100644 index 0000000..f2c4f32 --- /dev/null +++ b/nvim/after/ftplugin/vim.lua @@ -0,0 +1,2 @@ +-- treesitter ------------------------------------------------------------------ +vim.treesitter.start() diff --git a/nvim/colors/basic.lua b/nvim/colors/basic.lua index 7d0935f..94f3349 100644 --- a/nvim/colors/basic.lua +++ b/nvim/colors/basic.lua @@ -33,11 +33,9 @@ local cyan_c = C[7] local white_c = C[8] -- init ------------------------------------------------------------------------ --- vim.cmd.highlight("clear") -vim.cmd("highlight clear") +vim.cmd.highlight("clear") if vim.fn.exists("syntax_on") then - -- vim.cmd.syntax("reset") - vim.cmd("syntax reset") + vim.cmd.syntax("reset") end vim.opt.background = "dark" vim.g.colors_name = "basic" @@ -113,7 +111,7 @@ local tui_normal_h = {} local tui_accent_h = H:new():fg(accent_c) local tui_dimmed_h = H:new():fg(dimmed_c) -set_hl("StatusLine", tui_accent_h) +set_hl("StatusLine", tui_dimmed_h) set_hl("StatusLineNC", tui_dimmed_h) set_hl("TabLine", tui_dimmed_h) set_hl("TabLineFill", tui_dimmed_h) @@ -121,11 +119,12 @@ set_hl("TabLineSel", tui_accent_h) set_hl("WinBar", tui_accent_h) set_hl("WinBarNC", tui_dimmed_h) set_hl("WinSeparator", tui_dimmed_h) -set_hl("LineNr", tui_dimmed_h) +set_hl("LineNr", tui_accent_h) set_hl("LineNrAbove", tui_dimmed_h) set_hl("LineNrBelow", tui_dimmed_h) set_hl("SignColumn", tui_dimmed_h) set_hl("FoldColumn", tui_dimmed_h) +set_hl("WildMenu", tui_accent_h) -- float ----------------------------------------------------------------------- local float_normal_h = H:new():fg(bg_c):bg(fg_c) @@ -148,7 +147,6 @@ set_hl("PmenuExtra", menu_normal_h) set_hl("PmenuExtraSel", menu_accent_h) set_hl("PmenuSbar", menu_accent_h) set_hl("PmenuThumb", menu_accent_r_h) -set_hl("WildMenu", menu_accent_h) -- messages -------------------------------------------------------------------- local message_normal_h = {} @@ -194,17 +192,18 @@ set_hl("TermCursor", cursor_normal_h) set_hl("TermCursorNC", cursor_normal_h) -- match ----------------------------------------------------------------------- -local match_normal_h = H:new():fg(orange_c) -local match_current_h = H:new():fg(orange_c):attr("reverse") +local match_normal_h = H:new():fg(black_c):bg(orange_c) +local match_cur_h = H:new():fg(black_c):bg(cyan_c) +local match_reverse_h = H:new():fg(black_c):bg(orange_c):attr("reverse") set_hl("Search", match_normal_h) set_hl("Substitute", match_normal_h) -set_hl("IncSearch", match_current_h) -set_hl("CurSearch", match_current_h) -set_hl("MatchParen", match_normal_h) +set_hl("IncSearch", match_normal_h) +set_hl("CurSearch", match_cur_h) +set_hl("MatchParen", match_reverse_h) -- selection ------------------------------------------------------------------- -local selection_normal_h = H:new():fg(magenta_c):attr("reverse") +local selection_normal_h = H:new():fg(black_c):bg(magenta_c) set_hl("visual", selection_normal_h) set_hl("visualnos", selection_normal_h) @@ -275,43 +274,72 @@ set_hl("Directory", H:new():fg(blue_c):attr("bold")) -- syntax ---------------------------------------------------------------------- local syntax_normal_h = {} local syntax_comment_h = H:new():fg(blue_c):attr("bold") -local syntax_ignore_h = H:new():fg(black_c) +-- local syntax_constant_h = H:new():fg(magenta_c) +-- local syntax_identifier_h = H:new():fg(white_c) +-- local syntax_statement_h = H:new():fg(magenta_c) +-- local syntax_preproc_h = H:new():fg(magenta_c) +-- local syntax_type_h = H:new():fg(green_c) +-- local syntax_special_h = H:new():fg(cyan_c) +local syntax_constant_h = H:new():fg(red_c) +local syntax_identifier_h = H:new():fg(cyan_c) +local syntax_statement_h = H:new():fg(orange_c) +local syntax_preproc_h = H:new():fg(magenta_c) +local syntax_type_h = H:new():fg(green_c) +local syntax_special_h = H:new():fg(orange_c) local syntax_underline_h = H:new():attr("underline") -local syntax_error_h = H:new():fg(red_c) -local syntax_warn_h = H:new():fg(orange_c) +local syntax_ignore_h = H:new():fg(black_c) +local syntax_error_h = H:new():fg(black_c):bg(red_c) +local syntax_warn_h = H:new():fg(black_c):bg(orange_c) + +local syntax_italic_h = H:new():attr("italic") +local syntax_bold_h = H:new():attr("bold") +local syntax_bolditalic_h = H:new():attr("bold"):attr("italic") set_hl("Comment", syntax_comment_h) -set_hl("Constant", syntax_normal_h) -set_hl("String", syntax_normal_h) -set_hl("Character", syntax_normal_h) -set_hl("Number", syntax_normal_h) -set_hl("Boolean", syntax_normal_h) -set_hl("Float", syntax_normal_h) -set_hl("Identifier", syntax_normal_h) -set_hl("Function", syntax_normal_h) -set_hl("Statement", syntax_normal_h) -set_hl("Conditional", syntax_normal_h) -set_hl("Repeat", syntax_normal_h) -set_hl("Label", syntax_normal_h) -set_hl("Operator", syntax_normal_h) -set_hl("Keyword", syntax_normal_h) -set_hl("Exception", syntax_normal_h) -set_hl("PreProc", syntax_normal_h) -set_hl("Include", syntax_normal_h) -set_hl("Define", syntax_normal_h) -set_hl("Macro", syntax_normal_h) -set_hl("PreCondit", syntax_normal_h) -set_hl("Type", syntax_normal_h) -set_hl("StorageClass", syntax_normal_h) -set_hl("Structure", syntax_normal_h) -set_hl("Typedef", syntax_normal_h) -set_hl("Special", syntax_normal_h) -set_hl("SpecialChar", syntax_normal_h) -set_hl("Tag", syntax_normal_h) -set_hl("Delimiter", syntax_normal_h) -set_hl("SpecialComment", syntax_normal_h) -set_hl("Debug", syntax_normal_h) +set_hl("Constant", syntax_constant_h) +set_hl("String", syntax_constant_h) +set_hl("Character", syntax_constant_h) +set_hl("Number", syntax_constant_h) +set_hl("Boolean", syntax_constant_h) +set_hl("Float", syntax_constant_h) +set_hl("Identifier", syntax_identifier_h) +set_hl("Function", syntax_identifier_h) +set_hl("Statement", syntax_statement_h) +set_hl("Conditional", syntax_statement_h) +set_hl("Repeat", syntax_statement_h) +set_hl("Label", syntax_statement_h) +set_hl("Operator", syntax_statement_h) +set_hl("Keyword", syntax_statement_h) +set_hl("Exception", syntax_statement_h) +set_hl("PreProc", syntax_preproc_h) +set_hl("Include", syntax_preproc_h) +set_hl("Define", syntax_preproc_h) +set_hl("Macro", syntax_preproc_h) +set_hl("PreCondit", syntax_preproc_h) +set_hl("Type", syntax_type_h) +set_hl("StorageClass", syntax_type_h) +set_hl("Structure", syntax_type_h) +set_hl("Typedef", syntax_type_h) +set_hl("Special", syntax_special_h) +set_hl("SpecialChar", syntax_special_h) +set_hl("Tag", syntax_special_h) +set_hl("Delimiter", syntax_special_h) +set_hl("SpecialComment", syntax_special_h) +set_hl("Debug", syntax_special_h) set_hl("Underlined", syntax_underline_h) set_hl("Ignore", syntax_ignore_h) set_hl("Error", syntax_error_h) set_hl("Todo", syntax_warn_h) + +set_hl("Italic", syntax_italic_h) +set_hl("Bold", syntax_bold_h) +set_hl("BoldItalic", syntax_bolditalic_h) + +-- markdown -------------------------------------------------------------------- +local markdown_label_h = H:new():fg(magenta_c) +local markdown_delimiter_h = H:new():fg(blue_c):attr("bold") +local markdown_underline_h = H:new():fg(blue_c):attr("underline"):attr("bold") + +set_hl("markdownLabel", markdown_label_h) +set_hl("markdownDelimiter", markdown_delimiter_h) +set_hl("markdownUnderlined", markdown_underline_h) diff --git a/nvim/init.lua b/nvim/init.lua index f61cac4..75b4a9a 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,6 +1,6 @@ -- options --------------------------------------------------------------------- -- colorscheme -vim.cmd("colorscheme basic") -- TODO +vim.cmd.colorscheme("basic") -- leader vim.g.mapleader = " " @@ -24,19 +24,19 @@ vim.opt.colorcolumn = "+1" -- tabline, winbar, statusline vim.opt.showtabline = 2 --- vim.opt.winbar = "%f%( %h%m%r%) %y" +vim.opt.winbar = "%f%( %h%m%r%y %)" vim.opt.laststatus = 3 function _G.statusline() local col = vim.api.nvim_win_get_cursor(0)[2] + 1 - local char = vim.api.nvim_get_current_line():sub(col, col) + local char = vim.api.nvim_get_current_line():sub(col, col):gsub("%%", "%%%1") local wc = vim.fn.wordcount() return table.concat({ - vim.fn.pathshorten(vim.fn.getcwd()), + vim.fn.pathshorten(vim.fn.getcwd()), " %f", + "%( %h%m%r%y%)", "%=", - " %12(", "'", char, "' %b%)", - " %12(", wc.visual_chars or wc.cursor_chars, "/", wc.chars, "%)", - " %12(", wc.visual_words or wc.cursor_words, "/", wc.words, "%)", - " %12(%l,%c%V%) %P", + "<", char, "> %b ", + wc.visual_chars or wc.cursor_chars, "/", wc.chars, " ", + wc.visual_words or wc.cursor_words, "/", wc.words }) end vim.opt.statusline = "%!v:lua.statusline()" @@ -58,31 +58,28 @@ vim.opt.whichwrap = { ["["] = true, ["]"] = true } --- vim.opt.wildignorecase = true --- vim.opt.wildoptions:append("fuzzy") - --- -vim.cmd("cnoreabbrev W w") -vim.cmd("cnoreabbrev Q q") +vim.opt.wildoptions = { "fuzzy" } +vim.opt.wildignorecase = true -- langmap vim.opt.langmap = { "č\\;", "Č:", "š[", "Š{", "đ]", "Đ}", "ž#", "Ž~" } -- path vim.opt.path = ".,,**" +-- local root = vim.fs.find({ ".git" }, { upward = true })[1] -- completion vim.opt.completeopt = { "menuone", - "noinsert", "preview", + "noinsert", "noselect" } -- keymaps --------------------------------------------------------------------- -- clear hlsearch vim.keymap.set( "n", "", function() - vim.cmd("nohlsearch") + vim.cmd.nohlsearch() end, { desc = "Stop the highlighting for the 'hlsearch' option" }) -- move cursor with alt in c-mode @@ -156,16 +153,6 @@ vim.keymap.set("n", "cc", "cclose", { desc = "Close quickfix window" }) vim.keymap.set("n", "]q", "cnextzz", { desc = "Next quickfix item" }) vim.keymap.set("n", "[q", "cprevzz", { desc = "Previous quickfix item" }) --- highlight on yank ----------------------------------------------------------- -local yankhighlight_group = vim.api.nvim_create_augroup("YankHighlight", {}) -vim.api.nvim_create_autocmd("TextYankPost", { - group = yankhighlight_group, - desc = "Highlight on yank", - callback = function() - vim.highlight.on_yank() - end -}) - -- netrw ----------------------------------------------------------------------- vim.g.netrw_use_errorwindow = 0 vim.g.netrw_banner = 0 @@ -183,102 +170,3 @@ vim.api.nvim_create_autocmd("Filetype", { vim.keymap.set("n", "", "Rexplore", { buffer = true }) end }) - --- autopairs ------------------------------------------------------------------- -local brackets = { - "()", - "[]", - "{}", - "<>", -} - -for _,v in pairs(brackets) do - vim.keymap.set({ "i", "c" }, v:sub(1,1), ("%s"):format(v)) -end - -vim.keymap.set("i", "", function() - local l = vim.api.nvim_get_current_line() - local c = vim.api.nvim_win_get_cursor(0)[2] - local pair = l:sub(c, c + 1) - for _, bracket in pairs(brackets) do - if bracket == pair then - return "" - end - end - return "" -end, { expr = true }) - -vim.keymap.set("c", "", function() - local l = vim.fn.getcmdline() - local c = vim.fn.getcmdpos() - local pair = l:sub(c - 1, c) - for _, bracket in pairs(brackets) do - if bracket == pair then - return "" - end - end - return "" -end, { expr = true }) - --- comment --------------------------------------------------------------------- --- function toggle(line_start, line_end) --- -- make comment parts --- local buf_cs = vim.bo.commentstring:gsub("%%s", " %%s "):gsub("%s*$", "") --- local left, right = cs:match("^%s*(.*)%%s(.-)%s*$") --- -- get lines --- local lines = vim.api.nvim_buf_get_lines(0, line_start - 1, line_end, false) --- -- get indent --- local indent --- for _, l in pairs(lines) do --- _, n_indent_cur, indent_cur = l:find("^(%s*)") --- local is_blank = n_indent_cur == l:len() --- --- if n_indent_cur < n_indent and not is_blank then --- n_indent = n_indent_cur --- indent = indent_cur --- end --- end --- --- -- if is comment, make uncomment --- -- --- -- else make comment --- -- set lines --- end - --- vim.keymap.set("n", "gcc1", function() --- print("buf_cs", buf_cs) --- local buf_cs_before, buf_cs_after = buf_cs:match("^(.*)%%s(.*)$") --- --- local capture = ("^(%%s*)(%s)(.*)(%s)$"):format(buf_cs_before, buf_cs_after) --- --- print("capture", capture) --- --- local c_leading_space, c_buf_cs_before, c_line, c_buf_cs_after = --- vim.api.nvim_get_current_line():match(capture) --- --- print("|", c_leading_space, "|") --- --- print("c_leading_space", "|" .. c_leading_space .. "|") --- print("c_buf_cs_before", "|" .. c_buf_cs_before .. "|") --- print("c_line", "|" .. c_line .. "|") --- print("c_buf_cs_after", "|" .. c_buf_cs_after .. "|") --- --- -- if line:find(("^%%s*(%s).*(%s)$"):format(buf_cs_before, buf_commentstring_after)) then --- -- print("yes!") --- -- return --- -- end --- -- --- -- local leading_space, line = vim.api.nvim_get_current_line():match("(%s*)(.*)") --- -- --- -- local new_line = table.concat({ --- -- leading_space, --- -- buf_cs_before, --- -- " ", --- -- line, --- -- buf_commentstring_after --- -- }) --- -- --- -- local row = vim.api.nvim_win_get_cursor(0)[1] --- -- --- -- vim.api.nvim_buf_set_lines(0, row - 1, row, true, { new_line }) --- end) diff --git a/nvim/syntax/markdown.vim b/nvim/syntax/markdown.vim new file mode 100644 index 0000000..07be037 --- /dev/null +++ b/nvim/syntax/markdown.vim @@ -0,0 +1,277 @@ +" Vim syntax file +" Language: Markdown +" Maintainer: urosm +" Last Change: 2024 Jan 13 + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/html.vim +unlet! b:current_syntax + +syntax spell toplevel + +" comment +syn region markdownHTMLComment start=// keepend +hi def link markdownHTMLComment markdownComment + +" titleblock +syn region markdownTitleBlock start=/\%^%/ end=/\n\n/ contains=markdownTitleBlockDelimiter +hi def link markdownTitleBlock markdownBold +syn match markdownTitleBlockDelimiter /%\ / contained +hi def link markdownTitleBlockDelimiter markdownDelimiter + +" blockquote +syn match markdownBlockquote /^\s\{,3}>.*\n\(.*\n\@1\)\+/ contained containedin=markdownItalic,markdownBold,markdownPCite,markdownSuperscript,markdownSubscript,markdownStrike,markdownUListItem,markdownNoFormatted +hi def link markdownBlockquoteDelimiter markdownDelimiter + +" link +syn match markdownLink /!\=\[.\{-}\](.\{-})/ contains=markdownLinkLabel,markdownLinkURL +hi def link markdownLink markdownDelimiter +syn match markdownLinkLabel /\[\@1<=[^\]]\+/ contained +hi def link markdownLinkLabel markdownLabel +syn match markdownLinkURL /(\@1<=[^)]\+/ contained +hi def link markdownLinkURL markdownUnderlined + +" automatic link +syn match markdownAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/ contains=NONE +hi def link markdownAutomaticLink markdownUnderlined + +" wikilink +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 +hi def link markdownWikilinkURL markdownUnderlined + +" definition +syn region markdownReferenceDefinition start=/\[.\{-}\]:/ end=/\(\n\s*".*"$\|$\)/ keepend +hi def link markdownReferenceDefinition markdownDelimiter +syn match markdownReferenceDefinitionLabel /\[\zs.\{-}\ze\]:/ contained containedin=markdownReferenceDefinition display +hi def link markdownReferenceDefinitionLabel markdownLabel +syn match markdownReferenceDefinitionURL /:\s*\zs.*/ contained containedin=markdownReferenceDefinition +hi def link markdownReferenceDefinitionURL markdownUnderlined +syn match markdownReferenceDefinitionTitle /\s*".\{-}"/ contained containedin=markdownReferenceDefinition,markdownReferenceDefinitionURL contains=@Spell,markdownAmpersandEscape +hi def link markdownReferenceDefinitionTitle markdownTitle + +" citation +syn match markdownPCite "\^\@~/]*.\{-}\]" contains=markdownItalic,markdownBold,markdownLatex,markdownCiteKey,@Spell,markdownAmpersandEscape +syn match markdownICite "@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\s\[.\{-1,}\]" contains=markdownCiteKey,@Spell display +syn match markdownCiteKey /\(-\=@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\)/ containedin=markdownPCite,markdownICite contains=@NoSpell display +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,markdownLinkText,markdownLinkURL display +hi def link markdownAtxHeading Title +syn match markdownAtxHeadingDelimiter /\(^#\{1,6}\|\\\@/ contained containedin=markdownGridTableHeader,markdownPipeTableHeader contains=@Spell +hi def link markdownTableHeaderWord markdownBold + + +" delimited code blocks +syn region markdownDelimitedCodeBlock start=/^\(>\s\)\?\z(\([ ]\+\|\t\)\=\~\{3,}\~*\)/ end=/^\z1\~*/ skipnl contains=markdownDelimitedCodeBlockStart,markdownDelimitedCodeBlockEnd keepend +syn region markdownDelimitedCodeBlock start=/^\(>\s\)\?\z(\([ ]\+\|\t\)\=`\{3,}`*\)/ end=/^\z1`*/ skipnl contains=markdownDelimitedCodeBlockStart,markdownDelimitedCodeBlockEnd keepend +syn match markdownDelimitedCodeBlockStart /\(\(\_^\n\_^\|\%^\)\(>\s\)\?\( \+\|\t\)\=\)\@<=\(\~\{3,}\~*\|`\{3,}`*\)/ contained containedin=markdownDelimitedCodeBlock nextgroup=markdownDelimitedCodeBlockLanguage +syn match markdownDelimitedCodeBlockLanguage /\(\s\?\)\@<=.\+\(\_$\)\@=/ contained +syn match markdownDelimitedCodeBlockEnd /\(`\{3,}`*\|\~\{3,}\~*\)\(\_$\n\(>\s\)\?\_$\)\@=/ contained containedin=markdownDelimitedCodeBlock +syn match markdownBlockquoteinDelimitedCodeBlock '^>' contained containedin=markdownDelimitedCodeBlock +syn match markdownCodePre /
.\{-}<\/pre>/ skipnl
+syn match markdownCodePre /.\{-}<\/code>/ skipnl
+hi def link markdownDelimitedCodeBlock markdownSpecial
+hi def link markdownDelimitedCodeBlockStart markdownDelimiter
+hi def link markdownDelimitedCodeBlockEnd markdownDelimiter
+hi def link markdownDelimitedCodeBlockLanguage markdownComment
+hi def link markdownBlockquoteinDelimitedCodeBlock markdownBlockquote
+hi def link markdownCodePre markdownString
+
+" footnote
+syn match markdownFootnoteID /\[\^[^\]]\+\]/ nextgroup=markdownFootnoteDef
+hi def link markdownFootnoteID markdownLabel
+
+" inline footnote
+syn region markdownFootnoteDef start=/\^\[/ skip=/\[.\{-}]/ end=/\]/ contains=markdownLinkText,markdownLinkURL,markdownLatex,markdownPCite,markdownCiteKey,markdownBold,markdownItalic,markdownBoldItalic,markdownNoFormatted,markdownSuperscript,markdownSubscript,markdownStrike,markdownEnDash,markdownEmDash,markdownEllipses,markdownBeginQuote,markdownEndQuote,@Spell,markdownAmpersandEscape skipnl keepend
+hi def link markdownFootnoteDef markdownComment
+syn match markdownFootnoteDefHead /\^\[/ contained containedin=markdownFootnoteDef
+hi def link markdownFootnoteDefHead markdownDelimiter
+syn match markdownFootnoteDefTail /\]/ contained containedin=markdownFootnoteDef
+hi def link markdownFootnoteDefTail markdownDelimiter
+
+" regular footnotes
+syn region markdownFootnoteBlock start=/\[\^.\{-}\]:\s*\n*/ end=/^\n^\s\@!/ contains=markdownLinkText,markdownLinkURL,markdownLatex,markdownPCite,markdownCiteKey,markdownBold,markdownItalic,markdownNoFormatted,markdownSuperscript,markdownSubscript,markdownStrike,markdownEnDash,markdownEmDash,markdownNewLine,markdownBoldItalic,markdownEllipses,markdownBeginQuote,markdownEndQuote,markdownLaTeXInlineMath,markdownEscapedDollar,markdownLaTeXCommand,markdownLaTeXMathBlock,markdownLaTeXRegion,markdownAmpersandEscape,@Spell skipnl
+syn match markdownFootnoteBlockSeparator /:/ contained containedin=markdownFootnoteBlock
+hi def link markdownFootnoteBlockSeparator markdownDelimiter
+syn match markdownFootnoteID /\[\^.\{-}\]/ contained containedin=markdownFootnoteBlock
+syn match markdownFootnoteIDHead /\[\^/ contained containedin=markdownFootnoteID
+hi def link markdownFootnoteIDHead markdownDelimiter
+syn match markdownFootnoteIDTail /\]/ contained containedin=markdownFootnoteID
+hi def link markdownFootnoteIDTail markdownDelimiter
+
+" unordered list
+syn match markdownUListItem /^>\=\s*[*+-]\s\+-\@!.*$/ nextgroup=markdownUListItem,markdownLaTeXMathBlock,markdownLaTeXInlineMath,markdownEscapedDollar,markdownDelimitedCodeBlock,markdownListItemContinuation contains=@Spell,markdownItalic,markdownBold,markdownNoFormatted,markdownStrike,markdownSubscript,markdownSuperscript,markdownBoldItalic,markdownBoldItalic,markdownPCite,markdownICite,markdownCiteKey,markdownLinkText,markdownLaTeXCommand,markdownLaTeXMathBlock,markdownLaTeXInlineMath,markdownEscapedDollar,markdownLinkURL,markdownAutomaticLink,markdownFootnoteDef,markdownFootnoteBlock,markdownFootnoteID,markdownAmpersandEscape skipempty display
+syn match markdownUListItemBullet /^>\=\s*\zs[*+-]/ contained containedin=markdownUListItem
+hi def link markdownUListItemBullet markdownOperator
+
+" ordered list
+syn match markdownListItem /^\s*(\?\(\d\+\|\l\|\#\|@\)[.)].*$/ nextgroup=markdownListItem,markdownLaTeXMathBlock,markdownLaTeXInlineMath,markdownEscapedDollar,markdownDelimitedCodeBlock,markdownListItemContinuation contains=@Spell,markdownItalic,markdownBold,markdownNoFormatted,markdownStrike,markdownSubscript,markdownSuperscript,markdownBoldItalic,markdownBoldItalic,markdownPCite,markdownICite,markdownCiteKey,markdownLinkText,markdownLaTeXCommand,markdownLaTeXMathBlock,markdownLaTeXInlineMath,markdownEscapedDollar,markdownAutomaticLink,markdownFootnoteDef,markdownFootnoteBlock,markdownFootnoteID,markdownAmpersandEscape skipempty display
+syn match markdownListItem /^\s*(\?x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}[.)].*$/ nextgroup=markdownListItem,markdownMathBlock,markdownLaTeXInlineMath,markdownEscapedDollar,markdownDelimitedCodeBlock,markdownListItemContinuation,markdownAutomaticLink skipempty display
+syn match markdownListItemBullet /^(\?.\{-}[.)]/ contained containedin=markdownListItem
+syn match markdownListItemBulletId /\(\d\+\|\l\|\#\|@.\{-}\|x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}\)/ contained containedin=markdownListItemBullet
+hi def link markdownListItemBullet markdownOperator
+hi def link markdownListItemBulletId markdownIdentifier
+
+syn match markdownListItemContinuation /^\s\+\([-+*]\s\+\|(\?.\+[).]\)\@