@@ -6,86 +6,23 @@ if (exists("b:loaded_simpletodolugin"))
6
6
finish
7
7
endif
8
8
9
- function ! ToggleTodoLogged ()
10
- let done_icon = " ✔"
11
- let notdone_icon = " ❒"
12
- let save_cursor = getpos (" ." )
9
+ command ! - buffer -nargs =1 CreatePage call STL_CreateAndOpenPage (<f-args> )
13
10
14
- " FML this didn't work for multibyte char
15
- " let first_char = getline('.')[col('.')-1]
16
- normal ! ^
17
- normal ! " lyl
18
- let first_char = @l
11
+ command ! - buffer -complete =custom ,STL_ListPagesComp -nargs =1 OpenPage call STL_OpenPageByName (<f-args> )
19
12
20
- if first_char == done_icon
21
- " Move to log
22
- normal ! dd
23
- call search (" DONE LOG" )
24
- normal ! jp
13
+ command ! - buffer FindPage call fzf#run (fzf#wrap ({ ' sink' : function (' STL_OpenPageByName' ), ' source' :' note page list' }))
25
14
26
- elseif first_char == notdone_icon
27
- " Move to todo list
28
- normal ! dd
29
- call search (" TODO LIST" , " b" )
30
- normal ! jp
15
+ nnoremap <buffer> <silent> <Leader> m :call STL_ToggleTodoDone()<CR>
16
+ nnoremap <buffer> <silent> <Leader> l :call STL_ToggleTodoLogged()<CR>
17
+ nnoremap <buffer> <silent> <Leader> d :call STL_ToggleTodoDoneAndLogged()<CR>
31
18
32
- else
33
- " do nothing
34
- end
35
-
36
- call setpos (' .' , save_cursor)
37
- endfunction
38
-
39
- function ! ToggleTodoDone ()
40
- let done_icon = " ✔"
41
- let notdone_icon = " ❒"
42
- let save_cursor = getpos (" ." )
43
-
44
- " FML this didn't work for multibyte char
45
- " let first_char = getline('.')[col('.')-1]
46
- normal ! ^
47
- normal ! " lyl
48
- let first_char = @l
49
-
50
- if first_char == done_icon
51
- " Mark as not done
52
- s / \[.*\]/ /
53
- execute " normal! xi" .notdone_icon
54
-
55
- elseif first_char == notdone_icon
56
- " Mark as done
57
- let date_command = " date " .shellescape (" +%h %d, %Y %l:%M%p" )
58
- let timestamp = substitute (system (date_command), " \n " , " " , " " )
59
- execute " normal! xi" .done_icon." [" .timestamp." ]"
60
-
61
- else
62
- execute " normal! i" .notdone_icon." "
63
- end
64
-
65
- call setpos (' .' , save_cursor)
66
- endfunction
67
-
68
- function ! ToggleTodoDoneAndLogged ()
69
- call ToggleTodoDone ()
70
- call ToggleTodoLogged ()
71
- endfunction
72
-
73
- function ! ToggleSectionTitle ()
74
- let regionName = synIDattr (synID (line (" ." ), col (" ." ), 0 ), " name" )
75
- if regionName == " simpleTodoTitle"
76
- normal ! jddk
77
- else
78
- normal ! yypVr- k
79
- endif
80
- endfunction
81
-
82
- nnoremap <buffer> <silent> <Leader> m :call ToggleTodoDone()<CR>
83
- nnoremap <buffer> <silent> <Leader> l :call ToggleTodoLogged()<CR>
84
- nnoremap <buffer> <silent> <Leader> d :call ToggleTodoDoneAndLogged()<CR>
85
-
86
- nnoremap <buffer> <silent> <Leader> T :call ToggleSectionTitle()<CR>
19
+ nnoremap <buffer> <silent> <Leader> T :call STL_ToggleSectionTitle()<CR>
87
20
88
21
nnoremap <buffer> <C-n> /^----<CR><CR>
89
22
nnoremap <buffer> <C-p> ?^----<CR> n<CR>
90
23
24
+ nnoremap <buffer> <silent> <Leader> o :FindPage<CR>
25
+
26
+ set formatoptions += t
27
+
91
28
let b: loaded_simpletodolugin = 1
0 commit comments