diff options
| author | Teddy Wing | 2021-10-15 21:28:53 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2021-10-15 21:28:53 +0200 | 
| commit | 477256e48b026d01043a416c1bb20178bcc3cdd1 (patch) | |
| tree | f2700568deff34d51fd8ef73bf8779f8c167d2b5 /autoload | |
| parent | e24499b61189c1cde025a1fd1063a9b21f8e101b (diff) | |
| download | vim-twodo-477256e48b026d01043a416c1bb20178bcc3cdd1.tar.bz2 | |
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.
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/todo/motion.vim | 30 | 
1 files changed, 26 insertions, 4 deletions
| diff --git a/autoload/todo/motion.vim b/autoload/todo/motion.vim index 82dd092..ea97b16 100644 --- a/autoload/todo/motion.vim +++ b/autoload/todo/motion.vim @@ -14,26 +14,48 @@  " along with Twodo. If not, see <http://www.gnu.org/licenses/>.  let s:INCOMPLETE_MATCHER = '^\s*[\-_!] ' +let s:REGULAR_MATCHER = '^\s*- ' +let s:IMPORTANT_MATCHER = '^\s*! ' -function! s:Incomplete(extra_search_flags) +function! s:Search(pattern, extra_search_flags)  	let cnt = v:count1  	let search_flags = 's' . a:extra_search_flags  	let i = 0  	while i < cnt -		call search(s:INCOMPLETE_MATCHER, search_flags) +		call search(a:pattern, search_flags)  		let i += 1  	endwhile  endfunction  function! todo#motion#NextIncomplete() -	call s:Incomplete('') +	call s:Search(s:INCOMPLETE_MATCHER, '')  endfunction  function! todo#motion#PreviousIncomplete() -	call s:Incomplete('b') +	call s:Search(s:INCOMPLETE_MATCHER, 'b') +endfunction + + +function! todo#motion#NextRegular() +	call s:Search(s:REGULAR_MATCHER, '') +endfunction + + +function! todo#motion#PreviousRegular() +	call s:Search(s:REGULAR_MATCHER, 'b') +endfunction + + +function! todo#motion#NextImportant() +	call s:Search(s:IMPORTANT_MATCHER, '') +endfunction + + +function! todo#motion#PreviousImportant() +	call s:Search(s:IMPORTANT_MATCHER, 'b')  endfunction | 
