From 3f7f85cfc6a0008c59a5f2ce4c71513e7b77c2d4 Mon Sep 17 00:00:00 2001 From: Henry Qin Date: Wed, 27 Feb 2019 19:45:39 -0800 Subject: [PATCH] Add command and map to jump to the next unfinished task. Introduce the command `VimwikiNextTask` and the mapping `gnt` to jump to the next unfinished task. --- autoload/vimwiki/base.vim | 5 +++++ doc/vimwiki.txt | 9 +++++++++ ftplugin/vimwiki.vim | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index c131bfb..a61c276 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1156,6 +1156,11 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header, call winrestview(winview_save) endfunction +function! vimwiki#base#find_next_task() + let taskRegex = vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB') + \ . '\+\(\[ \]\s\+\)\zs' + call vimwiki#base#search_word(taskRegex, '') +endfunction function! vimwiki#base#find_next_link() call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), '') diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 5ebb612..f8502fc 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -317,6 +317,12 @@ NORMAL MODE *vimwiki-local-mappings* Maps to |:VimwikiPrevLink|. To remap: > :nmap wp VimwikiPrevLink +< +gnt *vimwiki_gnt* + Find next unfinished task in the current page. + Maps to |:VimwikiNextTask| + To remap: > + :nmap nt VimwikiNextTask < *vimwiki_wd* wd Delete wiki page you are in. @@ -723,6 +729,9 @@ Vimwiki file. *:VimwikiRenameLink* Rename the wiki page you are in. +*:VimwikiNextTask* + Jump to the next unfinished task in the current wiki page. + *:Vimwiki2HTML* Convert current wiki page to HTML using Vimwiki's own converter or a user-supplied script (see |vimwiki-option-custom_wiki2html|). diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 7e812a4..5c2dd2d 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -253,6 +253,7 @@ command! -buffer VimwikiAll2HTML command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1) +command! -buffer VimwikiNextTask call vimwiki#base#find_next_task() command! -buffer VimwikiNextLink call vimwiki#base#find_next_link() command! -buffer VimwikiPrevLink call vimwiki#base#find_prev_link() command! -buffer VimwikiDeleteLink call vimwiki#base#delete_link() @@ -381,6 +382,11 @@ endif vnoremap