diff options
author | Jersey <fonseca@uchicago.edu> | 2020-06-30 15:54:00 +0000 |
---|---|---|
committer | Jersey <fonseca@uchicago.edu> | 2020-06-30 15:54:00 +0000 |
commit | 46af9f393c9e7044ec66ec7cafdf8370d186d3e5 (patch) | |
tree | c9e710d6e361768e9c30d3076b4ee3347459c174 /plugin | |
parent | 3a0192d5528b10654431d34aeb3b25086a745eae (diff) |
adding branch
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/bujo.vim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugin/bujo.vim b/plugin/bujo.vim index a2fa976..b905b3a 100644 --- a/plugin/bujo.vim +++ b/plugin/bujo.vim | |||
@@ -2,8 +2,11 @@ | |||
2 | " Maintainer: Jersey Fonseca <http://www.jerseyfonseca.com/> | 2 | " Maintainer: Jersey Fonseca <http://www.jerseyfonseca.com/> |
3 | " Version: 0.5 | 3 | " Version: 0.5 |
4 | 4 | ||
5 | "Make bujo directory if it doesn't exist" | 5 | " Get custom configs |
6 | let g:bujo#todo_file_path = get(g:, "bujo#todo_file_path", $HOME . "/.cache/bujo") | 6 | let g:bujo#todo_file_path = get(g:, "bujo#todo_file_path", $HOME . "/.cache/bujo") |
7 | let g:bujo#window_width = get(g: "bujo#window_width", 30) | ||
8 | |||
9 | " Make bujo directory if it doesn't exist" | ||
7 | if empty(glob(g:bujo#todo_file_path)) | 10 | if empty(glob(g:bujo#todo_file_path)) |
8 | call mkdir(g:bujo#todo_file_path) | 11 | call mkdir(g:bujo#todo_file_path) |
9 | endif | 12 | endif |
@@ -43,14 +46,14 @@ function s:OpenTodo(...) | |||
43 | " If an argument was passed in, we open the general file | 46 | " If an argument was passed in, we open the general file |
44 | " a:0 will be false if no argument was passed in (a:0 == 0) | 47 | " a:0 will be false if no argument was passed in (a:0 == 0) |
45 | if a:0 || !s:InGitRepository() | 48 | if a:0 || !s:InGitRepository() |
46 | exe ":30vs" . g:bujo#todo_file_path . "/todo.md" | 49 | exe ":" . g:bujo#window_width . "vs" . g:bujo#todo_file_path . "/todo.md" |
47 | else | 50 | else |
48 | let repo_name_clean = s:GetToplevelFolder() | 51 | let repo_name_clean = s:GetToplevelFolder() |
49 | let todo_path = g:bujo#todo_file_path . "/" . repo_name_clean | 52 | let todo_path = g:bujo#todo_file_path . "/" . repo_name_clean |
50 | if empty(glob(todo_path)) | 53 | if empty(glob(todo_path)) |
51 | call mkdir(todo_path) | 54 | call mkdir(todo_path) |
52 | endif | 55 | endif |
53 | exe ":30vs" . todo_path . "/todo.md" | 56 | exe ":" . g:bujo#window_width "vs" . todo_path . "/todo.md" |
54 | endif | 57 | endif |
55 | endfunction | 58 | endfunction |
56 | 59 | ||
@@ -58,6 +61,7 @@ if !exists(":Todo") | |||
58 | command -nargs=? Todo :call s:OpenTodo(<f-args>) | 61 | command -nargs=? Todo :call s:OpenTodo(<f-args>) |
59 | endif | 62 | endif |
60 | 63 | ||
64 | " Update date upon enter. | ||
61 | autocmd bufnewfile todo.md call append(0, '#' . split(expand('%:p:h:t'), '\v\n')[0] . " todo") | 65 | autocmd bufnewfile todo.md call append(0, '#' . split(expand('%:p:h:t'), '\v\n')[0] . " todo") |
62 | autocmd bufnewfile todo.md call append(1, 'Date: ') | 66 | autocmd bufnewfile todo.md call append(1, 'Date: ') |
63 | autocmd bufnewfile,bufread,filewritepre todo.md exe "g/Date: */s/Date: *.*/Date: " .strftime("%a %d %b %Y") | 67 | autocmd bufnewfile,bufread,filewritepre todo.md exe "g/Date: */s/Date: *.*/Date: " .strftime("%a %d %b %Y") |