From 6a9876afd797eb306f63cda250bc2815d3f3ceef Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 15 Mar 2020 16:08:59 +0100 Subject: Add mappings to move to the next and previous to-do `[u` and `]u` for "unfinished". --- ftplugin/todo.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ftplugin') 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 TwodoNewTodoBelow o- nnoremap TwodoNewTodoAbove O- @@ -13,6 +15,9 @@ nnoremap TwodoRemoveOldTodos :g/^\s*[vx] /d \| nohl nnoremap TwodoEscalate :call todo#Escalate() nnoremap TwodoDescalate :call todo#Descalate() +nnoremap TwodoNextIncomplete :call todo#motion#NextIncomplete() +nnoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete() + if !hasmapto('TwodoNewTodoBelow') || !maparg('n', 'n') nmap n TwodoNewTodoBelow endif @@ -44,3 +49,11 @@ endif if !hasmapto('TwodoDescalate') || !maparg('-', 'n') nmap - TwodoDescalate endif + +if !hasmapto('TwodoNextIncomplete') && !maparg(']u', 'n') + nmap ]u TwodoNextIncomplete +endif + +if !hasmapto('TwodoPreviousIncomplete') && !maparg('[u', 'n') + nmap [u TwodoPreviousIncomplete +endif -- cgit v1.2.3 From 5ee078bc4c434764f413b036fcb39ca97b5ae74e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 21 Mar 2020 17:59:40 +0100 Subject: Try adding xmaps and omaps for next and previous commands The xmaps don't really work. Going to the next/previous TODO works, but extending the selection doesn't because of the way I set it up with the mark system. We'd probably need a more involved function here to do what we want. Currently doesn't support counts. I'll have to add that in. --- ftplugin/todo.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ftplugin') diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index a223984..c876313 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -17,6 +17,10 @@ nnoremap TwodoDescalate :call todo#Descalate() nnoremap TwodoNextIncomplete :call todo#motion#NextIncomplete() nnoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete() +xnoremap TwodoNextIncomplete :call todo#motion#NextIncomplete()v''o +xnoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete()v''o +onoremap TwodoNextIncomplete :call todo#motion#NextIncomplete() +onoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete() if !hasmapto('TwodoNewTodoBelow') || !maparg('n', 'n') nmap n TwodoNewTodoBelow @@ -52,8 +56,12 @@ endif if !hasmapto('TwodoNextIncomplete') && !maparg(']u', 'n') nmap ]u TwodoNextIncomplete + xmap ]u TwodoNextIncomplete + omap ]u TwodoNextIncomplete endif if !hasmapto('TwodoPreviousIncomplete') && !maparg('[u', 'n') nmap [u TwodoPreviousIncomplete + xmap [u TwodoPreviousIncomplete + omap [u TwodoPreviousIncomplete endif -- cgit v1.2.3 From 374682458aeecb6b02cd88a612201feca8a0be12 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 21 Mar 2020 20:11:00 +0100 Subject: Remove `TwodoNextIncomplete` `TwodoPreviousIncomplete` xmaps I don't really use visual mode, and don't feel like trying to make these work. --- ftplugin/todo.vim | 4 ---- 1 file changed, 4 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index c876313..22880ac 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -17,8 +17,6 @@ nnoremap TwodoDescalate :call todo#Descalate() nnoremap TwodoNextIncomplete :call todo#motion#NextIncomplete() nnoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete() -xnoremap TwodoNextIncomplete :call todo#motion#NextIncomplete()v''o -xnoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete()v''o onoremap TwodoNextIncomplete :call todo#motion#NextIncomplete() onoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete() @@ -56,12 +54,10 @@ endif if !hasmapto('TwodoNextIncomplete') && !maparg(']u', 'n') nmap ]u TwodoNextIncomplete - xmap ]u TwodoNextIncomplete omap ]u TwodoNextIncomplete endif if !hasmapto('TwodoPreviousIncomplete') && !maparg('[u', 'n') nmap [u TwodoPreviousIncomplete - xmap [u TwodoPreviousIncomplete omap [u TwodoPreviousIncomplete endif -- cgit v1.2.3 From c7ac0e17fe4acb714b135f9b4ffac24351b3de56 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 21 Mar 2020 20:17:22 +0100 Subject: Add conditions for `[u` `]u` default omaps I put these in the normal mode conditions for ease of testing and implementation. Now check the mappings properly. --- ftplugin/todo.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 22880ac..e7664d8 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -52,12 +52,18 @@ if !hasmapto('TwodoDescalate') || !maparg('-', 'n') nmap - TwodoDescalate endif -if !hasmapto('TwodoNextIncomplete') && !maparg(']u', 'n') +if !hasmapto('TwodoNextIncomplete', 'n') && !maparg(']u', 'n') nmap ]u TwodoNextIncomplete +endif + +if !hasmapto('TwodoNextIncomplete', 'o') && !maparg(']u', 'o') omap ]u TwodoNextIncomplete endif -if !hasmapto('TwodoPreviousIncomplete') && !maparg('[u', 'n') +if !hasmapto('TwodoPreviousIncomplete', 'n') && !maparg('[u', 'n') nmap [u TwodoPreviousIncomplete +endif + +if !hasmapto('TwodoPreviousIncomplete', 'o') && !maparg('[u', 'o') omap [u TwodoPreviousIncomplete endif -- cgit v1.2.3