@@ -731,10 +731,8 @@ function OrgMappings:insert_heading_respect_content(suffix)
731
731
if not item then
732
732
self :_insert_heading_from_plain_line (suffix )
733
733
else
734
- local line = config :respect_blank_before_new_entry ({ string.rep (' *' , item :get_level ()) .. ' ' .. suffix })
735
- local end_line = item :get_range ().end_line
736
- vim .fn .append (end_line , line )
737
- vim .fn .cursor (end_line + # line , 1 )
734
+ vim .fn .cursor (item :get_range ().start_line , 1 )
735
+ return self :meta_return (suffix )
738
736
end
739
737
return vim .cmd ([[ startinsert!]] )
740
738
end
@@ -745,13 +743,16 @@ end
745
743
746
744
function OrgMappings :insert_todo_heading ()
747
745
local item = self .files :get_closest_headline_or_nil ()
748
- local first_todo_keyword = config :get_todo_keywords ():first_by_type (' TODO' )
746
+ local first_todo_keyword = config :get_todo_keywords ():first_by_type (' TODO' ). value .. ' '
749
747
if not item then
750
- self :_insert_heading_from_plain_line (first_todo_keyword . value .. ' ' )
748
+ self :_insert_heading_from_plain_line (first_todo_keyword )
751
749
return vim .cmd ([[ startinsert!]] )
752
750
else
753
- vim .fn .cursor (item :get_range ().start_line , 1 )
754
- return self :meta_return (first_todo_keyword .value .. ' ' )
751
+ local level = string.rep (' *' , item :get_level ()) .. ' '
752
+ local line = config :respect_blank_before_new_entry ({ level .. first_todo_keyword })
753
+ local start_line = item :get_range ().start_line
754
+ vim .fn .append (start_line , line )
755
+ vim .fn .cursor (start_line + # line , 1 )
755
756
end
756
757
end
757
758
0 commit comments