vim-simple-todo icon indicating copy to clipboard operation
vim-simple-todo copied to clipboard

[feat] request: Create a new todo in current line if none, otherwise create below

Open juanMarinero opened this issue 7 months ago • 0 comments

Overwrite <leader>o since add [ ] to an already ToDo line is doubly the intention.

fun! SimpleTodoCheckAndCreateTodo()
  let current_line = getline('.')
  let is_task_line = current_line =~# '^\s*\(- \)\?\[ \?[x]\?\]'

  if is_task_line
    echo "current line is a task line, creating a new task below..."
    execute "normal! \<Plug>(simple-todo-below)"
  else
    execute "normal! \<Plug>(simple-todo-new-start-of-line)"
  endif
endf
nmap <silent> <leader>o :call SimpleTodoCheckAndCreateTodo()<CR>

juanMarinero avatar Jul 09 '25 12:07 juanMarinero