diff --git a/vimrc b/vimrc index 5b70d83..e055d7e 100644 --- a/vimrc +++ b/vimrc @@ -29,6 +29,7 @@ inoremap inoremap ^ inoremap $ inoremap :w +inoremap #TODO:# inoremap =strftime('%Y-%m-%dT%H:%M') inoremap inoremap @@ -38,6 +39,7 @@ inoremap nnoremap :call ACPToggleMargins() nnoremap :Limelight!! nnoremap :w +nnoremap :call ACPNModeTodo() nnoremap :setlocal spell! spelllang=en_us nnoremap :setlocal spell! spelllang=en_gb nnoremap @@ -224,6 +226,24 @@ function! ACPToggleMargins() execute "set colorcolumn=" . (&colorcolumn == "0" ? "73,81" : "0") endfunction +function! ACPNModeTodo() + " Toggles between TODO, WORK, WAIT, DONE, and blank. + " All are highlighted except DONE and blank. + " Must be at the start of the line, optionally preceeded with an + " asterisk and a space. This makes it work for Asciidoc lists. + if getline(line(".")) =~# "[#]TODO:[#] " + s/^\(\**\s*\)#TODO:# /\1#WORK:# /e + elseif getline(line(".")) =~# "[#]WORK:[#] " + s/^\(\**\s*\)#WORK:# /\1#WAIT:# /e + elseif getline(line(".")) =~# "[#]WAIT:[#] " + s/^\(\**\s*\)#WAIT:# /\1*DONE:* /e + elseif getline(line(".")) =~# "[*]DONE:[*] " + s/^\(\**\s*\)\*DONE:\* /\1/e + else + s/^\(\**\s*\)/\1#TODO:# /e + endif +endfunction + " Customise colour schemes. Keep this near the end. if &background ==# 'light' highlight SpecialKey ctermfg=lightgray ctermbg=NONE