Commit 5da12254f0cd1f0a0963f8918c7466cff4823650 Parent: 52ab3ee2e324798016813b44ca7601720289016b Author: mcol <mcol@posteo.net> Date: 2019-02-20 19:18:31 +0000 Committer: mcol <mcol@posteo.net> Committed: 2019-02-20 19:18:31 +0000 add toggletodo() function
plugin/keybindings.vim Modified
@@ -67,6 +67,7 @@ "inoremap <C-L> <Esc><C-W><C-L> " move to start or end of line more easily +nnoremap 0 ^ nnoremap H 0 nnoremap L $ vnoremap H 0 @@ -89,3 +90,16 @@ " toggle spell checking nnoremap <leader>S :setlocal spell! spelllang=en_gb spell?<CR>:echo "zg to add new word"<CR> + +" toggle [ ] tick box on current line with ctrl-space +function! ToggleTodo() + let l:line = getline('.') + if match(l:line, '\[x\]') != -1 + let l:line = substitute(l:line, '\[x\]', '\[ \]', '') + call setline('.', l:line) + elseif match(l:line, '\[ \]') != -1 + let l:line = substitute(l:line, '\[ \]', '\[x\]', '') + call setline('.', l:line) + endif +endfunction +nnoremap <silent> <C-@> :call ToggleTodo()<CR>