From 74683ee2259e5eafc3960e4ba177f9c860026d1e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 13 Nov 2021 12:53:52 +0900 Subject: .vim: rm filetype todolist --- .vim/my/ftplugin/todolist.vim | 71 ------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 .vim/my/ftplugin/todolist.vim (limited to '.vim/my/ftplugin') diff --git a/.vim/my/ftplugin/todolist.vim b/.vim/my/ftplugin/todolist.vim deleted file mode 100644 index e65faa3..0000000 --- a/.vim/my/ftplugin/todolist.vim +++ /dev/null @@ -1,71 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_todolist') - finish -endif - - - -inoremap checkbox(0, ' ') -inoremap x checkbox(1, 'x') - -nnoremap (todolist-toggle-checkbox) :call toggle_checkbox() -nnoremap (todolist-toggle-checkbox-rec) :call toggle_checkbox_rec() - - -function! s:checkbox(check, char) - let line = getline('.') - if line =~# '^\s*$' && len(line) % shiftwidth() == 0 - if a:check - return '[x] ' - else - return '[ ] ' - endif - else - return a:char - endif -endfunction - - -function! s:toggle_checkbox() - call s:toggle_checkbox_internal(line('.'), -1) -endfunction - - -function! s:toggle_checkbox_rec() - let checked = s:toggle_checkbox_internal(line('.'), -1) - if checked == -1 - return - endif - if line('.') == line('$') - return - endif - - let indent_lv = indent('.') - for l in range(line('.') + 1, line('$')) - if indent(l) <= indent_lv - break - end - call s:toggle_checkbox_internal(l, checked) - endfor -endfunction - - -function! s:toggle_checkbox_internal(line_num, ck_force) - let line = getline(a:line_num) - let match = matchlist(line, '^\(\s*\)\[\([x ]\)\]\(.*\)') - if empty(match) - return -1 - endif - - let [whole, spaces, ck, rest; _] = match - let checked = a:ck_force == -1 ? ck == 'x' : a:ck_force - let line = spaces . '[' . (checked ? ' ' : 'x') . ']' . rest - call setline(a:line_num, line) - return checked -endfunction - - - -let b:did_ftplugin_todolist = 1 -- cgit v1.2.3-70-g09d2