@@ -108,6 +108,11 @@ if !exists('g:bullets_checkbox_partials_toggle')
108108 let g: bullets_checkbox_partials_toggle = 1
109109endif
110110
111+ if ! exists (' g:bullets_auto_indent_after_colon' )
112+ " Should a line ending in a colon result in the next line being indented (1)?
113+ let g: bullets_auto_indent_after_colon = 1
114+ endif
115+
111116" ------------------------------------------------------ }}}
112117
113118" Parse Bullet Type ------------------------------------------- {{{
@@ -456,6 +461,7 @@ fun! s:insert_new_bullet()
456461 " searching up from there
457462 let l: send_return = 1
458463 let l: normal_mode = mode () == # ' n'
464+ let l: indent_next = s: line_ends_in_colon (l: curr_line_num ) && g: bullets_auto_indent_after_colon
459465
460466 " check if current line is a bullet and we are at the end of the line (for
461467 " insert mode only)
@@ -485,12 +491,23 @@ fun! s:insert_new_bullet()
485491
486492 " insert next bullet
487493 call append (l: curr_line_num , l: next_bullet_list )
488- " got to next line after the new bullet
494+
495+
496+ " go to next line after the new bullet
489497 let l: col = strlen (getline (l: next_line_num )) + 1
490- if g: bullets_renumber_on_change
498+ call setpos (' .' , [0 , l: next_line_num , l: col ])
499+
500+ " indent if previous line ended in a colon
501+ if l: indent_next
502+ " demote the new bullet
503+ call s: change_bullet_level_and_renumber (-1 )
504+ " reset cursor position after indenting
505+ let l: col = strlen (getline (l: next_line_num )) + 1
506+ call setpos (' .' , [0 , l: next_line_num , l: col ])
507+ elseif g: bullets_renumber_on_change
491508 call s: renumber_whole_list ()
492509 endif
493- call setpos ( ' . ' , [ 0 , l: next_line_num , l: col ])
510+
494511 let l: send_return = 0
495512 endif
496513 endif
@@ -514,6 +531,14 @@ fun! s:is_at_eol()
514531endfun
515532
516533command ! InsertNewBullet call <SID> insert_new_bullet ()
534+
535+ " Helper for Colon Indent
536+ " returns 1 if current line ends in a colon, else 0
537+ fun ! s: line_ends_in_colon (lnum)
538+ return getline (a: lnum )[strlen (getline (a: lnum ))-1 :] == # ' :'
539+ endfun
540+ " --------------------------------------------------------- }}}
541+
517542" --------------------------------------------------------- }}}
518543
519544" Checkboxes ---------------------------------------------- {{{
@@ -945,11 +970,11 @@ fun! s:change_bullet_level(direction)
945970endfun
946971
947972fun ! s: change_bullet_level_and_renumber (direction)
948- " Calls change_bullet_level and then renumber_whole_list if required
949- call s: change_bullet_level (a: direction )
950- if g: bullets_renumber_on_change
951- call s: renumber_whole_list ()
952- endif
973+ " Calls change_bullet_level and then renumber_whole_list if required
974+ call s: change_bullet_level (a: direction )
975+ if g: bullets_renumber_on_change
976+ call s: renumber_whole_list ()
977+ endif
953978endfun
954979
955980fun ! s: visual_change_bullet_level (direction)
0 commit comments