diff --git a/README.markdown b/README.markdown index 81edb8e..22cba49 100644 --- a/README.markdown +++ b/README.markdown @@ -30,3 +30,6 @@ becomes * [x] Do some work. and vice versa. + +If there is nothing to toggle a checkbox is added to the beginning of +the current line. diff --git a/plugin/checkbox.vim b/plugin/checkbox.vim index 8c853b3..194f0eb 100644 --- a/plugin/checkbox.vim +++ b/plugin/checkbox.vim @@ -23,6 +23,8 @@ fu! checkbox#ToggleCB() let line = substitute(line, "\\[ \\]", "[x]", "") elseif(match(line, "\\[x\\]") != -1) let line = substitute(line, "\\[x\\]", "[ ]", "") + else + let line = substitute(line, "^", "[ ] ", "") endif call setline('.', line)