diff options
| author | nsfisis <nsfisis@gmail.com> | 2021-11-13 12:53:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2021-11-13 12:53:52 +0900 |
| commit | 74683ee2259e5eafc3960e4ba177f9c860026d1e (patch) | |
| tree | 525e7d98aa4587b9784e1d2d275f47cb9071d50f | |
| parent | 4cb2a109087addfaf20c5c4f0202f68e3e2c6d88 (diff) | |
| download | dotfiles-74683ee2259e5eafc3960e4ba177f9c860026d1e.tar.gz dotfiles-74683ee2259e5eafc3960e4ba177f9c860026d1e.tar.zst dotfiles-74683ee2259e5eafc3960e4ba177f9c860026d1e.zip | |
.vim: rm filetype todolist
| -rw-r--r-- | .vim/my/after/ftplugin/todolist.vim | 24 | ||||
| -rw-r--r-- | .vim/my/ftplugin/todolist.vim | 71 | ||||
| -rw-r--r-- | .vim/my/indent/todolist.vim | 32 | ||||
| -rw-r--r-- | .vim/my/syntax/todolist.vim | 21 |
4 files changed, 0 insertions, 148 deletions
diff --git a/.vim/my/after/ftplugin/todolist.vim b/.vim/my/after/ftplugin/todolist.vim deleted file mode 100644 index 1cad707..0000000 --- a/.vim/my/after/ftplugin/todolist.vim +++ /dev/null @@ -1,24 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_after_todolist') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 -FtpluginSetLocal foldmethod=indent - - -let b:caw_oneline_comment = '//' - - -nmap <buffer> ,x <Plug>(todolist-toggle-checkbox) -nmap <buffer> ,X <Plug>(todolist-toggle-checkbox-rec) - - - -let b:did_ftplugin_after_todolist = 1 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 <silent> <buffer> <expr> <Space> <SID>checkbox(0, ' ') -inoremap <silent> <buffer> <expr> x <SID>checkbox(1, 'x') - -nnoremap <silent> <buffer> <Plug>(todolist-toggle-checkbox) :<C-u>call <SID>toggle_checkbox()<CR> -nnoremap <silent> <buffer> <Plug>(todolist-toggle-checkbox-rec) :<C-u>call <SID>toggle_checkbox_rec()<CR> - - -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 diff --git a/.vim/my/indent/todolist.vim b/.vim/my/indent/todolist.vim deleted file mode 100644 index 0640a93..0000000 --- a/.vim/my/indent/todolist.vim +++ /dev/null @@ -1,32 +0,0 @@ -if exists('b:did_indent') - finish -endif - - -setlocal indentexpr=TodolistIndent() - - -function! TodolistIndent() - if v:lnum == 0 - return 0 - endif - - let line = getline(v:lnum - 1) - if s:starts_with_checkbox(line) - return indent(v:lnum - 1) - else - return 0 - endif -endfunction - - -function! s:starts_with_checkbox(line) - if a:line =~# '^\s*\[[ x]\]' - return 1 - else - return 0 - endif -endfunction - - -let b:did_indent = 1 diff --git a/.vim/my/syntax/todolist.vim b/.vim/my/syntax/todolist.vim deleted file mode 100644 index d2775e3..0000000 --- a/.vim/my/syntax/todolist.vim +++ /dev/null @@ -1,21 +0,0 @@ -scriptencoding utf-8 - - -if exists("b:current_syntax") - finish -endif - - - -syn match todolistCheckboxUnchecked /\[ \]/ -syn match todolistCheckboxChecked /\[x\]/ -syn region todolistComment start="//" end="$" - - - -hi def link todolistCheckboxUnchecked Operator -hi def link todolistCheckboxChecked Operator -hi def link todolistComment Comment - - -let b:current_syntax = "todolist" |
