diff options
author | Tyler Szabo <tyler@szabomail.ca> | 2020-12-24 14:59:30 -0800 |
---|---|---|
committer | Tyler Szabo <tyler@szabomail.ca> | 2020-12-24 14:59:30 -0800 |
commit | bcd0ab67cdea75a120921b0825faed6fb93e95a3 (patch) | |
tree | 4908621e5da499dbbc87d31823e7c1b14aa825bb | |
parent | c8e97f68468fce686257287aae9f43a44cb1b6ac (diff) | |
download | todo.txt-vim-bcd0ab67cdea75a120921b0825faed6fb93e95a3.zip |
Detect based on directory name and env vars
- Detect .todo/*.txt and $TODO_DIR/*.txt
- Detect $TODO_FILE and $DONE_FILE
Based on variables and defaults in [todo.cfg](https://github.com/todotxt/todo.txt-cli/blob/master/todo.cfg)
-rw-r--r-- | README.markdown | 9 | ||||
-rw-r--r-- | doc/todo.txt | 10 | ||||
-rw-r--r-- | ftdetect/todo.vim | 13 |
3 files changed, 30 insertions, 2 deletions
diff --git a/README.markdown b/README.markdown index da08ccd..0e9f593 100644 --- a/README.markdown +++ b/README.markdown @@ -136,8 +136,11 @@ names are recognized as todo: [Tt]odo-YYYY-MM-DD.txt [Tt]odo.txt [Tt]oday.txt + .todo/*.txt + $TODO_DIR/*.txt + $TODO_FILE -And obviously the same are recognize as done: +Similarly, the following are recognized as done: YYYY-MM-[Dd]one.txt YYYY-MM-DD[Dd]one.txt @@ -145,6 +148,10 @@ And obviously the same are recognize as done: [Dd]one-YYYY-MM-DD.txt [Dd]one.txt [Dd]one-[Tt]oday.txt + $DONE_FILE + +Where `$TODO_DIR`, `$TODO_FILE`, and `$DONE_FILE` are optional environment variables +that correspond to those used by [todo.txt-cli](https://github.com/todotxt/todo.txt-cli/) Moreover, `<LocalLeader>D` moves the task under the cursor to the done.txt file corresponding to the current todo.txt, aka if you are editing diff --git a/doc/todo.txt b/doc/todo.txt index 163828c..142a1df 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -143,8 +143,11 @@ names are recognized as todo: [Tt]odo-YYYY-MM-DD.txt [Tt]odo.txt [Tt]oday.txt + .todo/*.txt + $TODO_DIR/*.txt + $TODO_FILE < -And obviously the same are recognize as done: +Similarly, the following are recognized as done: > YYYY-MM-[Dd]one.txt YYYY-MM-DD[Dd]one.txt @@ -152,7 +155,12 @@ And obviously the same are recognize as done: [Dd]one-YYYY-MM-DD.txt [Dd]one.txt [Dd]one-[Tt]oday.txt + $DONE_FILE < +Where `$TODO_DIR`, `$TODO_FILE`, and `$DONE_FILE` are optional environment +variables that correspond to those used by todo.txt-cli +(https://github.com/todotxt/todo.txt-cli/) + Moreover, `<LocalLeader>D` moves the task under the cursor to the done.txt file corresponding to the current todo.txt, aka if you are editing 2015-07-07-todo.txt, the done file while be 2015-07-07-done.txt. If you don't diff --git a/ftdetect/todo.vim b/ftdetect/todo.vim index d73e589..7e667b6 100644 --- a/ftdetect/todo.vim +++ b/ftdetect/todo.vim @@ -16,5 +16,18 @@ autocmd BufNewFile,BufRead [Dd]one-\d\\\{4\}-\d\\\{2\}.txt set filetype=todo autocmd BufNewFile,BufRead \d\\\{4\}-\d\\\{2\}-\d\\\{2\}-[Dd]one.txt set filetype=todo autocmd BufNewFile,BufRead \d\\\{4\}-\d\\\{2\}-[Dd]one.txt set filetype=todo autocmd BufNewFile,BufRead [Dd]one-[Tt]oday.txt set filetype=todo +autocmd BufNewFile,BufRead */.todo/*.txt set filetype=todo + +if exists("$TODO_DIR") + au BufNewFile,BufRead $TODO_DIR/*.txt set filetype=todo +endif + +if exists("$TODO_FILE") + au BufNewFile,BufRead $TODO_FILE set filetype=todo +endif + +if exists("$DONE_FILE") + au BufNewFile,BufRead $DONE_FILE set filetype=todo +endif " vim: tabstop=4 shiftwidth=4 softtabstop=4 expandtab foldmethod=marker |