hi MDTask ctermfg=1 hi MDDoneText ctermfg=37 cterm=italic,strikethrough hi MDTodoText cterm=NONE hi MDDoneDate cterm=strikethrough ctermfg=71 hi MDTodoDate ctermfg=71 hi Deadline ctermfg=162 cterm=bold,underline hi NearDeadline ctermfg=178 cterm=bold au FileType markdown syn match markdownError "\w\@<=\w\@=" au FileType markdown syn match MDDoneDate /[SD]:\d\{4\}\([\/-]\d\d\)\{2\}/ contained au FileType markdown syn match MDTodoDate /[SD]:\d\{4\}\([\/-]\d\d\)\{2\}/ contained au FileType markdown syn match MDDoneText /- \[x\] \zs.*/ contains=MDDoneDate contained au FileType markdown syn match MDTodoText /- \[ \] \zs.*/ contains=MDTodoDate contained au FileType markdown syn match MDTask /- \[\(x\| \)\] .*/ contains=MDDoneText,MDTodoText au FileType markdown call matchadd('Deadline', 'D:'.strftime("%Y-%m-%d")) au FileType markdown call matchadd('NearDeadline', 'D:'.strftime("%Y-%m-%d", localtime() + 3600 * 24)) au FileType markdown call matchadd('NearDeadline', 'D:'.strftime("%Y-%m-%d", localtime() + 3600 * 48)) let b:md_block = '```' setlocal shiftwidth=2 setlocal softtabstop=2 setlocal tabstop=2 nnoremap :call toggleTodoStatus() nnoremap <2-LeftMouse> :call toggleTodoStatus():w<2-LeftMouse> vnoremap B :call SurroundVaddPairs("**", "**") vnoremap I :call SurroundVaddPairs("*", "*") vnoremap T :call SurroundVaddPairs("- [ ] ", "") vnoremap ` :call SurroundVaddPairs("`", "`") vnoremap C :call SurroundVaddPairs("```plaintext", "```") fun! s:toggleTodoStatus() let line = getline('.') if line =~ glob2regpat('*- \[ \]*') call setline('.', substitute(line, '\[ \]', '[x]', '')) elseif line =~ glob2regpat('*- \[x\]*') call setline('.', substitute(line, '\[x\]', '[ ]', '')) endif endf nnoremap :call toggleMPTheme() inoremap :call toggleMPTheme() fun! s:toggleMPTheme() if g:mkdp_theme == 'dark' let g:mkdp_theme = 'light' else let g:mkdp_theme = 'dark' endif exec 'MarkdownPreviewStop' sleep 1 exec 'MarkdownPreview' endf