diff options
author | Jersey Fonseca <fonseca@uchicago.edu> | 2020-06-25 00:44:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 00:44:39 +0000 |
commit | 3b24c57ef433b79f24af8ae6ae4b7466bb89c483 (patch) | |
tree | 10c7412075bf0b5838d6556d76d345046c964cfd | |
parent | 9c3df779c9355086819c7abf0641827ae242f169 (diff) | |
parent | e126e779aefb5e6b1144a9f27d7f373595db2fb4 (diff) |
Merge pull request #1 from ahmedselim2017/master
Added variables for cache file and mappings
-rw-r--r-- | README.md | 30 | ||||
-rw-r--r-- | doc/bujo.txt | 17 | ||||
-rw-r--r-- | ftplugin/markdown_bujo.vim | 8 | ||||
-rw-r--r-- | plugin/bujo.vim | 9 |
4 files changed, 42 insertions, 22 deletions
@@ -14,14 +14,28 @@ Plug 'jfonseca8/vim-bujo' | |||
14 | ``` | 14 | ``` |
15 | 15 | ||
16 | 16 | ||
17 | ## Use | 17 | |
18 | 18 | ## Use / Mappings | |
19 | * Conveniently open your todo list in vim | 19 | |
20 | - Run :Todo | 20 | * Run: |
21 | * Easily insert a new task | 21 | ``` |
22 | - Press Ctrl-Enter | 22 | :Todo |
23 | * Easily check off a task | 23 | ``` |
24 | - Press Ctrl-Backspace | 24 | * Insert a new task: |
25 | ``` | ||
26 | nmap <C-Enter> <Plug>bujo#AddTodoNormal | ||
27 | imap <C-Enter> <Plug>bujo#AddTodoInsert | ||
28 | ``` | ||
29 | * Check off a task: | ||
30 | ``` | ||
31 | nmap <C-BS> <Plug>bujo#CheckTodoNormal | ||
32 | imap <C-BS> <Plug>bujo#CheckTodoInsert | ||
33 | ``` | ||
34 | * Change cache directory: | ||
35 | ``` | ||
36 | let g:bujo#todo_file_path = $HOME . "/.cache/bujo" | ||
37 | ``` | ||
38 | |||
25 | 39 | ||
26 | 40 | ||
27 | ## Screenshots | 41 | ## Screenshots |
diff --git a/doc/bujo.txt b/doc/bujo.txt index c74d128..74af942 100644 --- a/doc/bujo.txt +++ b/doc/bujo.txt | |||
@@ -34,12 +34,17 @@ very simple and minimialist. | |||
34 | *bujo-features* | 34 | *bujo-features* |
35 | 2. Features~ | 35 | 2. Features~ |
36 | 36 | ||
37 | * Conveniently open your todo list in vim | 37 | * Run: |
38 | - Run :Todo | 38 | :Todo |
39 | * Easily insert a new task | 39 | * Insert a new task: |
40 | - Press <Ctrl-Enter> | 40 | nmap <C-Enter> <Plug>bujo#AddTodoNormal |
41 | * Easily check off a task | 41 | imap <C-Enter> <Plug>bujo#AddTodoInsert |
42 | - Press <Ctrl-Backspace> | 42 | * Check off a task: |
43 | nmap <C-BS> <Plug>bujo#CheckTodoNormal | ||
44 | imap <C-BS> <Plug>bujo#CheckTodoInsert | ||
45 | * Change cache directory: | ||
46 | let g:bujo#todo_file_path = $HOME . "/.cache/bujo" | ||
47 | |||
43 | 48 | ||
44 | ======================================================= | 49 | ======================================================= |
45 | *bujo-notes* | 50 | *bujo-notes* |
diff --git a/ftplugin/markdown_bujo.vim b/ftplugin/markdown_bujo.vim index cf79d6f..6838885 100644 --- a/ftplugin/markdown_bujo.vim +++ b/ftplugin/markdown_bujo.vim | |||
@@ -1,6 +1,6 @@ | |||
1 | " Edit markdown lists | 1 | " Edit markdown lists |
2 | " Add and remove bullets with ease | 2 | " Add and remove bullets with ease |
3 | nnoremap <buffer> <C-Enter> i-[] | 3 | nnoremap <buffer> <Plug>bujo#AddTodoNormal i-[] |
4 | nnoremap <buffer> <C-BS> :.s/\[\]/\[x\]<Enter> | 4 | nnoremap <buffer> <Plug>bujo#CheckTodoNormal :.s/\[\]/\[x\]<Enter> |
5 | inoremap <buffer> <C-Enter> -[] | 5 | inoremap <buffer> <Plug>bujo#AddTodoInsert -[] |
6 | inoremap <buffer> <C-BS> <esc>:.s/\[\]/\[x\]<Enter> | 6 | inoremap <buffer> <Plug>bujo#CheckTodoInsert <esc>:.s/\[\]/\[x\]<Enter> |
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") |