From 55ad3d9a7c196d07c6bdd3c6239a298bb4566bc9 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 6 May 2020 20:37:38 +0200 Subject: projects/aodocs.vim: Add mapping to copy the last TODO entry I've been keeping a daily to-do list. Every day, I copy yesterday's entry and use it as today's with some modifications. Add a mapping to automate copying the previous day's entry. --- projects/aodocs.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'projects') diff --git a/projects/aodocs.vim b/projects/aodocs.vim index 72ec2ab..109f336 100644 --- a/projects/aodocs.vim +++ b/projects/aodocs.vim @@ -37,6 +37,9 @@ augroup AODocs autocmd BufRead,BufEnter $VIM_PROJECT_PATH_AODOCS_GO/* \ let g:go_play_browser_command = 'open -a Nightly %URL% &' + + autocmd BufRead,BufEnter *.todo + \ nnoremap yy :call TodoCopyLast() augroup END " Insert a path to UFO ticket folders @@ -77,3 +80,15 @@ function! s:ESLintAddMappings() nnoremap eda :silent !eslint-yes-debugger.sh -a :redraw! nnoremap edd :silent !eslint-yes-debugger.sh -d :redraw! endfunction + + +function! s:TodoCopyLast() + " Copy the last entry to the bottom + ?\n\n\d?,$t$ + + " Move to date line + ?\n\n\zs\d? + + " Increment day, then put the current entry at the top of the window + execute "normal! $h\zt2\" +endfunction -- cgit v1.2.3