@@ -217,36 +217,34 @@ 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*\[.\]'
238
238
silent ! exec ' noh'
239
- normal ! f [
240
239
normal ! l
241
240
endfunction
242
241
243
242
244
- " Moves te cursor to the previous item
243
+ " Moves the cursor to the previous item
245
244
function ! VimTodoListsGoToPreviousItem ()
246
245
normal ! 0
247
246
silent ! exec ' ?^\s*\[.\]'
248
247
silent ! exec ' noh'
249
- normal ! f [
250
248
normal ! l
251
249
endfunction
252
250
@@ -255,12 +253,19 @@ endfunction
255
253
function ! VimTodoListsToggleItem ()
256
254
let l: line = getline (' .' )
257
255
256
+ " Store current cursor position
257
+ let l: cursor_pos = getcurpos ()
258
+
258
259
if VimTodoListsItemIsNotDone (l: line ) == 1
259
260
call VimTodoListsForEachChild (line (' .' ), ' VimTodoListsSetItemDone' )
260
261
elseif VimTodoListsItemIsDone (l: line ) == 1
261
262
call VimTodoListsForEachChild (line (' .' ), ' VimTodoListsSetItemNotDone' )
262
263
endif
263
264
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 ])
268
+
264
269
call VimTodoListsUpdateParent (line (' .' ))
265
270
endfunction
266
271
0 commit comments