aboutsummaryrefslogtreecommitdiffstats
path: root/projects
diff options
context:
space:
mode:
authorTeddy Wing2020-05-06 20:37:38 +0200
committerTeddy Wing2020-05-08 17:25:51 +0200
commit55ad3d9a7c196d07c6bdd3c6239a298bb4566bc9 (patch)
tree862a0e722069910eef0cb252bf75a3d7bcbc55f2 /projects
parent7d2624a352a3d8beb21d28ea03800c1e11880fd1 (diff)
downloaddotvim-55ad3d9a7c196d07c6bdd3c6239a298bb4566bc9.tar.bz2
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.
Diffstat (limited to 'projects')
-rw-r--r--projects/aodocs.vim15
1 files changed, 15 insertions, 0 deletions
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 <buffer> <Leader>yy :call <SID>TodoCopyLast()<CR>
augroup END
" Insert a path to UFO ticket folders
@@ -77,3 +80,15 @@ function! s:ESLintAddMappings()
nnoremap <buffer> <leader>eda :silent !eslint-yes-debugger.sh -a<CR> <Bar> :redraw!<CR>
nnoremap <buffer> <leader>edd :silent !eslint-yes-debugger.sh -d<CR> <Bar> :redraw!<CR>
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\<C-a>zt2\<C-e>"
+endfunction