Permalink
Browse files

add 1 space between ✓|- and the task item, make sure it still works w…

…ith nested task, also reformatted the code to indent with 2 spaces
  • Loading branch information...
samsonw committed Mar 6, 2012
1 parent 7e93a0c commit 5e9155f3dfe6f6a8ba2e95a7a09696b65d150ff7
Showing with 10 additions and 10 deletions.
  1. +10 −10 plugin/task.vim
View
@@ -1,22 +1,22 @@
" Boilerplate
if (exists("b:did_ftplugin"))
finish
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
function! Toggle_task_status()
let line = getline('.')
if match(line, '^\(\s*\)-') == 0
let line = substitute(line, '^\(\s*\)-', '\1✓', '')
elseif match(line, '^\(\s*\)✓') == 0
let line = substitute(line, '^\(\s*\)✓', '\1', '')
else
let line = substitute(line, '^\(\s*\)', '\1-', '')
endif
call setline('.', line)
let line = getline('.')
if match(line, '^\(\s*\)-') == 0
let line = substitute(line, '^\(\s*\)-', '\1✓', '')
elseif match(line, '^\(\s*\)✓') == 0
let line = substitute(line, '^\(\s*\)✓\s\=\<', '\1', '')
else
let line = substitute(line, '^\(\s\{-}\)\(\s\=\)\<', '\2\1- ', '')
endif
call setline('.', line)
endfunction
inoremap <silent> <buffer> <C-D-CR> <ESC>:call Toggle_task_status()<CR>i

0 comments on commit 5e9155f

Please sign in to comment.