From 3879b80ce517c823782621cba74e2888468edc3c Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 20 Feb 2023 10:43:08 +0000 Subject: [PATCH] Cycle TODO WORK WAIT DONE for adoc lists --- vimrc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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