Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Piotr Yordanov
committed
Mar 3, 2012
1 parent
daa2218
commit 7010ece
Showing
3 changed files
with
46 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
" Boilerplate | ||
if (exists("b:did_ftplugin")) | ||
finish | ||
endif | ||
let b:did_ftplugin = 1 | ||
|
||
let s:cpo_save = &cpo | ||
set cpo&vim | ||
|
||
function! Toggle_task_status_remove() | ||
let line = getline('.') | ||
if match(line, '^\(\s*\)-') == 0 | ||
let line = substitute(line, '^\(\s*\)-', '\1', '') | ||
else | ||
let line = substitute(line, '^\(\s*\)✓', '\1', '') | ||
endif | ||
call setline('.', line) | ||
endfunction | ||
|
||
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) | ||
endfunction | ||
|
||
inoremap <silent> <buffer> <M-z> <ESC>:call Toggle_task_status()<CR>i | ||
noremap <silent> <buffer> <M-z> :call Toggle_task_status()<CR> | ||
inoremap <silent> <buffer> <M-Z> :call Toggle_task_status_remove()<CR>i | ||
noremap <silent> <buffer> <M-Z> :call Toggle_task_status_remove()<CR> | ||
" Boilerplate | ||
let &cpo = s:cpo_save | ||
unlet s:cpo_save | ||
|