aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autoload/todo/motion.vim13
-rw-r--r--ftplugin/todo.vim13
2 files changed, 26 insertions, 0 deletions
diff --git a/autoload/todo/motion.vim b/autoload/todo/motion.vim
new file mode 100644
index 0000000..3ebab2d
--- /dev/null
+++ b/autoload/todo/motion.vim
@@ -0,0 +1,13 @@
+let s:INCOMPLETE_MATCHER = '^\s*[\-_!] '
+
+
+function! todo#motion#NextIncomplete()
+ normal! m'
+ call search(s:INCOMPLETE_MATCHER)
+endfunction
+
+
+function! todo#motion#PreviousIncomplete()
+ normal! m'
+ call search(s:INCOMPLETE_MATCHER, 'b')
+endfunction
diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim
index f392c94..a223984 100644
--- a/ftplugin/todo.vim
+++ b/ftplugin/todo.vim
@@ -3,6 +3,8 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
+" TODO: Add no_plugin_mappings or whatever
+
nnoremap <silent> <buffer> <Plug>TwodoNewTodoBelow o-
nnoremap <silent> <buffer> <Plug>TwodoNewTodoAbove O-
@@ -13,6 +15,9 @@ nnoremap <silent> <buffer> <Plug>TwodoRemoveOldTodos :<c-u>g/^\s*[vx] /d \| nohl
nnoremap <silent> <buffer> <Plug>TwodoEscalate :<c-u>call todo#Escalate()<cr>
nnoremap <silent> <buffer> <Plug>TwodoDescalate :<c-u>call todo#Descalate()<cr>
+nnoremap <silent> <buffer> <Plug>TwodoNextIncomplete :<c-u>call todo#motion#NextIncomplete()<cr>
+nnoremap <silent> <buffer> <Plug>TwodoPreviousIncomplete :<c-u>call todo#motion#PreviousIncomplete()<cr>
+
if !hasmapto('<Plug>TwodoNewTodoBelow') || !maparg('<leader>n', 'n')
nmap <silent> <buffer> <leader>n <Plug>TwodoNewTodoBelow
endif
@@ -44,3 +49,11 @@ endif
if !hasmapto('<Plug>TwodoDescalate') || !maparg('<leader>-', 'n')
nmap <silent> <buffer> <leader>- <Plug>TwodoDescalate
endif
+
+if !hasmapto('<Plug>TwodoNextIncomplete') && !maparg(']u', 'n')
+ nmap <buffer> ]u <Plug>TwodoNextIncomplete
+endif
+
+if !hasmapto('<Plug>TwodoPreviousIncomplete') && !maparg('[u', 'n')
+ nmap <buffer> [u <Plug>TwodoPreviousIncomplete
+endif