From 477256e48b026d01043a416c1bb20178bcc3cdd1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 15 Oct 2021 21:28:53 +0200 Subject: Add new motions to move between regular and important TODOs The existing `[u` and `]u` bindings allow moving to the previous and next unfinished to-do, but when there are many low priority to-dos, and a handful of regular and high priority items between them, those commands are ineffective for quickly moving to the relevant ones. Add two new sets of commands: * `[o` & `]o` to move between regular priority to-dos * `[y` & `]y` to move between high priority to-dos I was looking for bracket mappings that aren't bound by default. Using `o` seems to work, meaning "ordinary". And `y` could refer to "yimportant". Close enough. --- ftplugin/todo.vim | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'ftplugin') diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index e1b3ddb..9ad32dd 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -36,6 +36,16 @@ nnoremap TwodoPreviousIncomplete :call todo#motion# onoremap TwodoNextIncomplete :call todo#motion#NextIncomplete() onoremap TwodoPreviousIncomplete :call todo#motion#PreviousIncomplete() +nnoremap TwodoNextRegular :call todo#motion#NextRegular() +nnoremap TwodoPreviousRegular :call todo#motion#PreviousRegular() +onoremap TwodoNextRegular :call todo#motion#NextRegular() +onoremap TwodoPreviousRegular :call todo#motion#PreviousRegular() + +nnoremap TwodoNextImportant :call todo#motion#NextImportant() +nnoremap TwodoPreviousImportant :call todo#motion#PreviousImportant() +onoremap TwodoNextImportant :call todo#motion#NextImportant() +onoremap TwodoPreviousImportant :call todo#motion#PreviousImportant() + if !hasmapto('TwodoNewTodoBelow') && !maparg('n', 'n') nmap n TwodoNewTodoBelow endif @@ -83,3 +93,35 @@ endif if !hasmapto('TwodoPreviousIncomplete', 'o') && !maparg('[u', 'o') omap [u TwodoPreviousIncomplete endif + +if !hasmapto('TwodoNextRegular', 'n') && !maparg(']o', 'n') + nmap ]o TwodoNextRegular +endif + +if !hasmapto('TwodoNextRegular', 'o') && !maparg(']o', 'o') + omap ]o TwodoNextRegular +endif + +if !hasmapto('TwodoPreviousRegular', 'n') && !maparg('[o', 'n') + nmap [o TwodoPreviousRegular +endif + +if !hasmapto('TwodoPreviousRegular', 'o') && !maparg('[o', 'o') + omap [o TwodoPreviousRegular +endif + +if !hasmapto('TwodoNextImportant', 'n') && !maparg(']y', 'n') + nmap ]y TwodoNextImportant +endif + +if !hasmapto('TwodoNextImportant', 'o') && !maparg(']y', 'o') + omap ]y TwodoNextImportant +endif + +if !hasmapto('TwodoPreviousImportant', 'n') && !maparg('[y', 'n') + nmap [y TwodoPreviousImportant +endif + +if !hasmapto('TwodoPreviousImportant', 'o') && !maparg('[y', 'o') + omap [y TwodoPreviousImportant +endif -- cgit v1.2.3