Skip to content

Commit 1df8d51

Browse files
committed
Implements markdown compatibility and closes #18.
1 parent 11e1fc7 commit 1df8d51

File tree

3 files changed

+70
-63
lines changed

3 files changed

+70
-63
lines changed

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Plugin is automatically applied for files with `.todo` extension.
2828

2929
##### TODO Items
3030

31-
The sequence matching the expression '^\s\*[ ].\*' marks a line as a TODO list item.
31+
The sequence matching the expression `^\s\*- [ ].\*` marks a line as a TODO list item.
3232

3333
###### Example
3434

3535
```
36-
[ ] Not done
37-
[X] Done
36+
- [ ] Not done
37+
- [X] Done
3838
```
3939

4040
##### Items Hierarchy
@@ -45,9 +45,9 @@ to be **parent** and the second to be **child**.
4545
###### Example
4646

4747
```
48-
[ ] Parent
49-
[ ] Child1
50-
[ ] Child2
48+
- [ ] Parent
49+
- [ ] Child1
50+
- [ ] Child2
5151
```
5252

5353
###### Rules:
@@ -62,9 +62,9 @@ to be **parent** and the second to be **child**.
6262
Items are highlighted in accordance to the following scheme:
6363

6464
```
65-
[ ] ! Important item (Underlined)
66-
[ ] Normal item (Normal)
67-
[X] Done item (Comment)
65+
- [ ] ! Important item (Underlined)
66+
- [ ] Normal item (Normal)
67+
- [X] Done item (Comment)
6868
```
6969

7070
##### Items moving on state change
@@ -80,19 +80,19 @@ If done list doesn't exist, item is placed just after the last not done item.
8080
*Before*
8181

8282
```
83-
[ ] Not Done 1
84-
[ ] Will be done now
85-
[ ] Not Done 2
86-
[X] Done
83+
- [ ] Not Done 1
84+
- [ ] Will be done now
85+
- [ ] Not Done 2
86+
- [X] Done
8787
```
8888

8989
*After*
9090

9191
```
92-
[ ] Not Done 1
93-
[ ] Not Done 2
94-
[X] Done
95-
[X] Will be done now
92+
- [ ] Not Done 1
93+
- [ ] Not Done 2
94+
- [X] Done
95+
- [X] Will be done now
9696
```
9797

9898
###### Mark item undone
@@ -103,18 +103,18 @@ If all items are marked done, the items is moved before the first done item.
103103
*Before*
104104

105105
```
106-
[ ] Not Done 1
107-
[ ] Not Done 2
108-
[X] Done
109-
[X] Will be undone now
106+
- [ ] Not Done 1
107+
- [ ] Not Done 2
108+
- [X] Done
109+
- [X] Will be undone now
110110
```
111111
*After*
112112

113113
```
114-
[ ] Not Done 1
115-
[ ] Not Done 2
116-
[ ] Will be done now
117-
[X] Done
114+
- [ ] Not Done 1
115+
- [ ] Not Done 2
116+
- [ ] Will be done now
117+
- [X] Done
118118
```
119119

120120
###### Interaction with items hierarchy
@@ -235,6 +235,10 @@ Changelog
235235

236236
* Added items moving on state change
237237

238+
#### 0.7.0
239+
240+
* Makes items list markdown compatible
241+
238242
Credits
239243
-------
240244

doc/vim-todo-lists.txt

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ Plugin is automatically applied for files with `.todo` extension.
5050
TODO Items
5151
----------
5252

53-
The sequence matching the expression '^ [ ] ' marks a line as a TODO list
54-
item.
53+
The sequence matching the expression `^\s\*- [ ].\*` marks a line as a TODO list item.
5554

5655
Example
5756
-------
5857

59-
[ ] Not done
60-
[X] Done
58+
- [ ] Not done
59+
- [X] Done
6160

6261
Items Hierarchy
6362
---------------
@@ -68,9 +67,9 @@ to be 'parent' and the second to be 'child'.
6867
Example
6968
-------
7069

71-
[ ] Parent
72-
[ ] Child1
73-
[ ] Child2
70+
- [ ] Parent
71+
- [ ] Child1
72+
- [ ] Child2
7473

7574
Rules:
7675
* Changing state of the parent item changes the state of all children items accorndantly
@@ -84,9 +83,9 @@ Items Highlighting
8483

8584
Items are highlighted in accordance to the following scheme:
8685

87-
[ ] ! Important item (Underlined)
88-
[ ] Normal item (Normal)
89-
[X] Done item (Comment)
86+
- [ ] ! Important item (Underlined)
87+
- [ ] Normal item (Normal)
88+
- [X] Done item (Comment)
9089

9190

9291

@@ -105,18 +104,18 @@ If done list doesn't exist, item is placed just after the last not done item.
105104
Before
106105
------
107106

108-
[ ] Not Done 1
109-
[ ] Will be done now
110-
[ ] Not Done 2
111-
[X] Done
107+
- [ ] Not Done 1
108+
- [ ] Will be done now
109+
- [ ] Not Done 2
110+
- [X] Done
112111

113112
After
114113
-----
115114

116-
[ ] Not Done 1
117-
[ ] Not Done 2
118-
[X] Done
119-
[X] Will be done now
115+
- [ ] Not Done 1
116+
- [ ] Not Done 2
117+
- [X] Done
118+
- [X] Will be done now
120119

121120
Mark item undone
122121
----------------
@@ -127,18 +126,18 @@ If all items are marked done, the items is moved before the first done item.
127126
Before
128127
------
129128

130-
[ ] Not Done 1
131-
[ ] Not Done 2
132-
[X] Done
133-
[X] Will be undone now
129+
- [ ] Not Done 1
130+
- [ ] Not Done 2
131+
- [X] Done
132+
- [X] Will be undone now
134133

135134
After
136135
-----
137136

138-
[ ] Not Done 1
139-
[ ] Not Done 2
140-
[ ] Will be done now
141-
[X] Done
137+
- [ ] Not Done 1
138+
- [ ] Not Done 2
139+
- [ ] Will be done now
140+
- [X] Done
142141

143142
Interaction with items hierarchy
144143
--------------------------------
@@ -211,7 +210,7 @@ https://github.com/aserebryakov/vim-todo-lists
211210

212211
MIT License
213212

214-
Copyright (c) 2017 Alexander Serebryakov ([email protected])
213+
Copyright (c) 2018 Alexander Serebryakov ([email protected])
215214

216215
Permission is hereby granted, free of charge, to any person obtaining a copy
217216
of this software and associated documentation files (the "Software"), to deal
@@ -271,6 +270,10 @@ SOFTWARE.
271270

272271
* Added items moving on state change
273272

273+
0.7.0
274+
275+
* Makes items list markdown compatible
276+
274277
==============================================================================
275278
8. Credits *VimTodoListsCredits*
276279

plugin/vim-todo-lists.vim

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" MIT License
22
"
3-
" Copyright (c) 2017 Alexander Serebryakov ([email protected])
3+
" Copyright (c) 2018 Alexander Serebryakov ([email protected])
44
"
55
" Permission is hereby granted, free of charge, to any person obtaining a copy
66
" of this software and associated documentation files (the "Software"), to
@@ -47,20 +47,20 @@ endfunction
4747
" Sets the item done
4848
function! VimTodoListsSetItemDone(lineno)
4949
let l:line = getline(a:lineno)
50-
call setline(a:lineno, substitute(l:line, '^\(\s*\)\[ \]', '\1[X]', ''))
50+
call setline(a:lineno, substitute(l:line, '^\(\s*- \)\[ \]', '\1[X]', ''))
5151
endfunction
5252

5353

5454
" Sets the item not done
5555
function! VimTodoListsSetItemNotDone(lineno)
5656
let l:line = getline(a:lineno)
57-
call setline(a:lineno, substitute(l:line, '^\(\s*\)\[X\]', '\1[ ]', ''))
57+
call setline(a:lineno, substitute(l:line, '^\(\s*- \)\[X\]', '\1[ ]', ''))
5858
endfunction
5959

6060

6161
" Checks that line is a todo list item
6262
function! VimTodoListsLineIsItem(line)
63-
if match(a:line, '^\s*\[[ X]\].*') != -1
63+
if match(a:line, '^\s*- \[[ X]\].*') != -1
6464
return 1
6565
endif
6666

@@ -70,7 +70,7 @@ endfunction
7070

7171
" Checks that item is not done
7272
function! VimTodoListsItemIsNotDone(line)
73-
if match(a:line, '^\s*\[ \].*') != -1
73+
if match(a:line, '^\s*- \[ \].*') != -1
7474
return 1
7575
endif
7676

@@ -80,7 +80,7 @@ endfunction
8080

8181
" Checks that item is done
8282
function! VimTodoListsItemIsDone(line)
83-
if match(a:line, '^\s*\[X\].*') != -1
83+
if match(a:line, '^\s*- \[X\].*') != -1
8484
return 1
8585
endif
8686

@@ -332,29 +332,29 @@ endfunction
332332

333333
" Creates a new item above the current line
334334
function! VimTodoListsCreateNewItemAbove()
335-
normal! O [ ]
335+
normal! O- [ ]
336336
startinsert!
337337
endfunction
338338

339339

340340
" Creates a new item below the current line
341341
function! VimTodoListsCreateNewItemBelow()
342-
normal! o [ ]
342+
normal! o- [ ]
343343
startinsert!
344344
endfunction
345345

346346

347347
" Creates a new item in the current line
348348
function! VimTodoListsCreateNewItem()
349-
normal! 0i [ ]
349+
normal! 0i- [ ]
350350
startinsert!
351351
endfunction
352352

353353

354354
" Moves the cursor to the next item
355355
function! VimTodoListsGoToNextItem()
356356
normal! $
357-
silent! exec '/^\s*\[.\]'
357+
silent! exec '/^\s*- \[.\]'
358358
silent! exec 'noh'
359359
normal! l
360360
endfunction
@@ -363,7 +363,7 @@ endfunction
363363
" Moves the cursor to the previous item
364364
function! VimTodoListsGoToPreviousItem()
365365
normal! 0
366-
silent! exec '?^\s*\[.\]'
366+
silent! exec '?^\s*- \[.\]'
367367
silent! exec 'noh'
368368
normal! l
369369
endfunction

0 commit comments

Comments
 (0)