diff options
author | ahmedselim2017 <ahmedselimuzum@gmail.com> | 2020-06-24 23:47:47 +0000 |
---|---|---|
committer | ahmedselim2017 <ahmedselimuzum@gmail.com> | 2020-06-24 23:47:47 +0000 |
commit | 727a5ab3612bfd7823a0608bf04c0fb1cc1d317c (patch) | |
tree | ba9f4b08d5bac73fffae73302c6b3ae03775a497 /plugin | |
parent | 227ce0d7705c72297deabca4cc7adb855632e9f2 (diff) |
Added todo_file_path
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/bujo.vim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugin/bujo.vim b/plugin/bujo.vim index bc13304..d5203e9 100644 --- a/plugin/bujo.vim +++ b/plugin/bujo.vim | |||
@@ -1,18 +1,19 @@ | |||
1 | "Make bujo directory if it doesn't exist" | 1 | "Make bujo directory if it doesn't exist" |
2 | if empty(glob('~/bujo')) | 2 | let g:bujo#todo_file_path = get(g:, "bujo#todo_file_path", $HOME . "/.cache/bujo") |
3 | call mkdir($HOME . '/bujo', 'p') | 3 | if empty(glob(g:bujo#todo_file_path)) |
4 | call mkdir(g:bujo#todo_file_path) | ||
4 | endif | 5 | endif |
5 | autocmd bufnewfile todo.md call append(0, '#Todo') | 6 | autocmd bufnewfile todo.md call append(0, '#Todo') |
6 | autocmd bufnewfile todo.md call append(1, 'Date: ') | 7 | autocmd bufnewfile todo.md call append(1, 'Date: ') |
7 | autocmd bufnewfile,bufreadpre todo.md exe "g/Date: */s/Date: /Date: " .strftime("%a %d %b %Y") | 8 | autocmd bufnewfile,bufreadpre todo.md exe "g/Date: */s/Date: /Date: " .strftime("%a %d %b %Y") |
8 | autocmd bufnewfile,Bufwritepre,filewritepre todo.md execute "normal G" | 9 | autocmd bufnewfile,Bufwritepre,filewritepre todo.md execute "normal Go" |
9 | 10 | ||
10 | 11 | ||
11 | 12 | ||
12 | " Open the bujo todo list file | 13 | " Open the bujo todo list file |
13 | function s:OpenTodo() | 14 | function s:OpenTodo() |
14 | "30 makes it open at width 30 | 15 | "30 makes it open at width 30 |
15 | exe ":30vs ~/bujo/todo.md" | 16 | exe ":30vs" . g:bujo#todo_file_path . "/todo.md" |
16 | endfunction | 17 | endfunction |
17 | 18 | ||
18 | if !exists(":Todo") | 19 | if !exists(":Todo") |