blob: 0640a93a78998dad0c83ae3d58f5b9ef091ab8bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
if exists('b:did_indent')
finish
endif
setlocal indentexpr=TodolistIndent()
function! TodolistIndent()
if v:lnum == 0
return 0
endif
let line = getline(v:lnum - 1)
if s:starts_with_checkbox(line)
return indent(v:lnum - 1)
else
return 0
endif
endfunction
function! s:starts_with_checkbox(line)
if a:line =~# '^\s*\[[ x]\]'
return 1
else
return 0
endif
endfunction
let b:did_indent = 1
|