" lib.vim - Miscelaneous functions {{{ " " Author: Silvio Rhatto " " Checkbox handling {{{ " " This is commented out because vitalk/vim-simple-todo is being used instead. " " Thanks https://www.reddit.com/r/vim/comments/slqsao/readymade_solution_for_handling_markdown/ "function! ToggleCheckbox() " let line = getline('.') " " if line =~ '- \[ \]' " call setline('.', substitute(line, '- \[ \]', '- \[x\]', '')) " elseif line =~ '- \[x\]' " call setline('.', substitute(line, '- \[x\]', '- \[ \]', '')) " elseif line =~ '- ' " call setline('.', substitute(line, '- ', '- \[ \] ', '')) " endif "endf " }}} " Remove trailing spaces {{{ " " Thanks https://vi.stackexchange.com/a/456 fun! TrimWhitespace() let l:save = winsaveview() keeppatterns %s/\s\+$//e call winrestview(l:save) endfun command! TrimWhitespace call TrimWhitespace() " }}}