Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move common function/vars to autoload
Functions needed by both systems and the default variables have been moved into an autoload file, and the default variable setting has been moved to a function and called at the beginning of both the syntax/ftplugin file. This solves an issue where if the syntax file is loaded first (if you have syntax on before filetype plugin on in your .vimrc), it doesn't have access to the default variables and task state function, causing errors.
- Loading branch information
Showing
5 changed files
with
56 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
" Vim filetype plugin for heirarchical TODO lists | ||
" Maintainer: Mark Harrison <mark@mivok.net> | ||
" License: ISC - See LICENSE file for details | ||
|
||
" Utility functions | ||
" TodoParseTaskState - Parse TODO(t) into state and shortcut key {{{1 | ||
function! vimtodo#TodoParseTaskState(state) | ||
let state=matchstr(a:state, '^[A-Z]\+') | ||
let key=matchstr(a:state, '\(^[A-Z]\+(\)\@<=[a-zA-Z0-9]\()\)\@=') | ||
return { "state": state, "key": key } | ||
endfunction | ||
"1}}} | ||
|
||
" Default settings | ||
" Set - setup script variables {{{1 | ||
function! vimtodo#Set(varname, value) | ||
if !exists(a:varname) | ||
exec "let" a:varname "=" string(a:value) | ||
endif | ||
endfunction | ||
"1}}} | ||
|
||
" Default variables {{{1 | ||
function! vimtodo#SetDefaultVars() | ||
call vimtodo#Set("g:todo_states", | ||
\[["TODO(t)", "|", "DONE(d)", "CANCELLED(c)"], | ||
\["WAITING(w)", "CLOSED(l)"]]) | ||
call vimtodo#Set("g:todo_state_colors", { "TODO" : "Blue", "DONE": "Green", | ||
\ "CANCELLED" : "Red", "WAITING": "Yellow", "CLOSED": "Grey" }) | ||
call vimtodo#Set("g:todo_checkbox_states", [[" ", "X"], ["+", "-", "."], | ||
\["Y", "N", "?"]]) | ||
call vimtodo#Set("g:todo_log_done", 1) | ||
call vimtodo#Set("g:todo_log_into_drawer", "LOGBOOK") | ||
call vimtodo#Set("g:todo_done_file", "done.txt") | ||
endfunction | ||
"1}}} |
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 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 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 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