From 52e1527e9b456c8431974ff9a57462afedea3a58 Mon Sep 17 00:00:00 2001 From: naught101 Date: Tue, 7 Apr 2015 22:55:42 +1000 Subject: [PATCH] allow prefixed files like blah.todo.txt --- ftdetect/todo.vim | 2 ++ ftplugin/todo.vim | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ftdetect/todo.vim b/ftdetect/todo.vim index a12a122..6268180 100644 --- a/ftdetect/todo.vim +++ b/ftdetect/todo.vim @@ -6,5 +6,7 @@ " Version: 0.1 autocmd BufNewFile,BufRead [Tt]odo.txt set filetype=todo +autocmd BufNewFile,BufRead *.[Tt]odo.txt set filetype=todo autocmd BufNewFile,BufRead [Dd]one.txt set filetype=todo +autocmd BufNewFile,BufRead *.[Dd]one.txt set filetype=todo diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 132f9c9..33718fc 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -52,8 +52,10 @@ endfunction function! TodoTxtRemoveCompleted() " Check if we can write to done.txt before proceeding. + let l:target_dir = expand('%:p:h') - let l:done_file = l:target_dir.'/done.txt' + let l:todo_file = expand('%:p') + let l:done_file = substitute(substitute(l:todo_file, 'todo.txt$', 'done.txt', ''), 'Todo.txt$', 'Done.txt', '') if !filewritable(l:done_file) && !filewritable(l:target_dir) echoerr "Can't write to file 'done.txt'" return