summaryrefslogtreecommitdiff
path: root/ftplugin
diff options
context:
space:
mode:
authorJersey <fonseca@uchicago.edu>2020-06-28 19:19:40 +0000
committerJersey <fonseca@uchicago.edu>2020-06-28 19:19:40 +0000
commit2d689127908c429a29807b3b151abb13d73aab6e (patch)
treea3c17314a74d14efee6110f8d5c735ebd019f2bf /ftplugin
parent3a0192d5528b10654431d34aeb3b25086a745eae (diff)
Added the ability to uncheck
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/markdown_bujo.vim19
1 files changed, 17 insertions, 2 deletions
diff --git a/ftplugin/markdown_bujo.vim b/ftplugin/markdown_bujo.vim
index 22bdd19..2330b35 100644
--- a/ftplugin/markdown_bujo.vim
+++ b/ftplugin/markdown_bujo.vim
@@ -1,6 +1,21 @@
1" markdown_bujo.vim - A minimalist todo list manager
2" Maintainer: Jersey Fonseca <http://www.jerseyfonseca.com/>
3" Version: 0.5
4
5" SearchCheck() searches for whether or not BujoCheck... was called on a
6" checked or unchecked task. We need to call search() twice with and without
7" the 'b' tag because search() only allows you to search forward or backwards,
8" not both ways.
9"
10" search() returns 0 if it the pattern was not found
11function <SID>SearchCheck()
12 return (search('\[\]', 'nc', line('.')) || search('\[\]', 'nbc', line('.')))
13endfunction
14
1" Edit markdown lists 15" Edit markdown lists
2" Add and remove bullets with ease 16" Add and remove bullets with ease
17" If we are already checked then we uncheck
18nnoremap <expr> <silent> <buffer> <Plug>BujoChecknormal <SID>SearchCheck() ? ':.s/\[\]/\[x\]<Enter>' : ':.s/\[x\]/\[\]<Enter>'
3nnoremap <silent> <buffer> <Plug>BujoAddnormal i-[] 19nnoremap <silent> <buffer> <Plug>BujoAddnormal i-[]
4nnoremap <silent> <buffer> <Plug>BujoChecknormal :.s/\[\]/\[x\]<Enter>
5inoremap <silent> <buffer> <Plug>BujoAddinsert -[] 20inoremap <silent> <buffer> <Plug>BujoAddinsert -[]
6inoremap <silent> <buffer> <Plug>BujoCheckinsert <esc>:.s/\[\]/\[x\]<Enter> 21inoremap <expr> <silent> <buffer> <Plug>BujoCheckinsert <SID>SearchCheck() ? '<esc>:.s/\[\]/\[x\]<Enter>' : '<esc>:.s/\[x\]/\[\]<Enter>'