@@ -217,21 +217,21 @@ function! VimTodoListsCreateNewItemAbove()
217
217
endfunction
218
218
219
219
220
- " Creates e new item below the current line
220
+ " Creates a new item below the current line
221
221
function ! VimTodoListsCreateNewItemBelow ()
222
222
normal ! o [ ]
223
223
startinsert !
224
224
endfunction
225
225
226
226
227
- " Creates e new item in the current line
227
+ " Creates a new item in the current line
228
228
function ! VimTodoListsCreateNewItem ()
229
229
normal ! 0 i [ ]
230
230
startinsert !
231
231
endfunction
232
232
233
233
234
- " Moves te cursor to the next item
234
+ " Moves the cursor to the next item
235
235
function ! VimTodoListsGoToNextItem ()
236
236
normal ! $
237
237
silent ! exec ' /^\s*\[.\]'
@@ -240,7 +240,7 @@ function! VimTodoListsGoToNextItem()
240
240
endfunction
241
241
242
242
243
- " Moves te cursor to the previous item
243
+ " Moves the cursor to the previous item
244
244
function ! VimTodoListsGoToPreviousItem ()
245
245
normal ! 0
246
246
silent ! exec ' ?^\s*\[.\]'
@@ -253,14 +253,18 @@ endfunction
253
253
function ! VimTodoListsToggleItem ()
254
254
let l: line = getline (' .' )
255
255
256
+ " Store current cursor position
257
+ let l: cursor_pos = getcurpos ()
258
+
256
259
if VimTodoListsItemIsNotDone (l: line ) == 1
257
260
call VimTodoListsForEachChild (line (' .' ), ' VimTodoListsSetItemDone' )
258
261
elseif VimTodoListsItemIsDone (l: line ) == 1
259
262
call VimTodoListsForEachChild (line (' .' ), ' VimTodoListsSetItemNotDone' )
260
263
endif
261
264
262
- " Restore the cursor position
263
- normal ! f [l
265
+ " Restore the current position
266
+ " Using the {curswant} value to set the proper column
267
+ call cursor (l: cursor_pos [1 ], l: cursor_pos [4 ])
264
268
265
269
call VimTodoListsUpdateParent (line (' .' ))
266
270
endfunction
0 commit comments