aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2020-09-08 06:14:51 +0900
committernsfisis <nsfisis@gmail.com>2020-09-08 06:14:51 +0900
commitd2732d24689189f02d1b3680b5c560a678321564 (patch)
tree40a474a7efa3a3642e9f679fd0d98eac979bb044
parent7574b72a50cf2f4658e7695afd3367fec028f5e1 (diff)
downloaddotfiles-d2732d24689189f02d1b3680b5c560a678321564.tar.gz
dotfiles-d2732d24689189f02d1b3680b5c560a678321564.tar.zst
dotfiles-d2732d24689189f02d1b3680b5c560a678321564.zip
Add .vim
-rw-r--r--.vim/my/after/ftplugin/c.vim20
-rw-r--r--.vim/my/after/ftplugin/cmake.vim16
-rw-r--r--.vim/my/after/ftplugin/cpp.vim20
-rw-r--r--.vim/my/after/ftplugin/css.vim16
-rw-r--r--.vim/my/after/ftplugin/gitcommit.vim14
-rw-r--r--.vim/my/after/ftplugin/go.vim17
-rw-r--r--.vim/my/after/ftplugin/haskell.vim22
-rw-r--r--.vim/my/after/ftplugin/html.vim16
-rw-r--r--.vim/my/after/ftplugin/javascript.vim16
-rw-r--r--.vim/my/after/ftplugin/json.vim16
-rw-r--r--.vim/my/after/ftplugin/lua.vim16
-rw-r--r--.vim/my/after/ftplugin/python.vim21
-rw-r--r--.vim/my/after/ftplugin/qf.vim40
-rw-r--r--.vim/my/after/ftplugin/ruby.vim19
-rw-r--r--.vim/my/after/ftplugin/todolist.vim29
-rw-r--r--.vim/my/after/ftplugin/toml.vim16
-rw-r--r--.vim/my/after/ftplugin/vim.vim22
-rw-r--r--.vim/my/after/ftplugin/yaml.vim16
-rw-r--r--.vim/my/after/syntax/json.vim23
-rw-r--r--.vim/my/after/syntax/python.vim19
-rw-r--r--.vim/my/after/syntax/vim.vim30
-rw-r--r--.vim/my/colors/ocean.vim146
-rw-r--r--.vim/my/ftplugin/todolist.vim71
-rw-r--r--.vim/my/indent/todolist.vim32
-rw-r--r--.vim/my/syntax/todolist.vim21
25 files changed, 694 insertions, 0 deletions
diff --git a/.vim/my/after/ftplugin/c.vim b/.vim/my/after/ftplugin/c.vim
new file mode 100644
index 0000000..12de33e
--- /dev/null
+++ b/.vim/my/after/ftplugin/c.vim
@@ -0,0 +1,20 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_c_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=4
+FtpluginSetLocal softtabstop=4
+FtpluginSetLocal cinoptions=:0,l1
+
+let g:c_comment_strings = v:true
+let g:c_space_errors = v:true
+
+
+
+let b:did_ftplugin_c_after = 1
diff --git a/.vim/my/after/ftplugin/cmake.vim b/.vim/my/after/ftplugin/cmake.vim
new file mode 100644
index 0000000..b4f5591
--- /dev/null
+++ b/.vim/my/after/ftplugin/cmake.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_cmake_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_cmake_after = 1 \ No newline at end of file
diff --git a/.vim/my/after/ftplugin/cpp.vim b/.vim/my/after/ftplugin/cpp.vim
new file mode 100644
index 0000000..13c0374
--- /dev/null
+++ b/.vim/my/after/ftplugin/cpp.vim
@@ -0,0 +1,20 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_cpp_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=4
+FtpluginSetLocal softtabstop=4
+FtpluginSetLocal cinoptions=:0,l1,g0,N-s
+
+let g:c_comment_strings = v:true
+let g:c_space_errors = v:true
+
+
+
+let b:did_ftplugin_cpp_after = 1 \ No newline at end of file
diff --git a/.vim/my/after/ftplugin/css.vim b/.vim/my/after/ftplugin/css.vim
new file mode 100644
index 0000000..e4743e8
--- /dev/null
+++ b/.vim/my/after/ftplugin/css.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_css_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_css_after = 1
diff --git a/.vim/my/after/ftplugin/gitcommit.vim b/.vim/my/after/ftplugin/gitcommit.vim
new file mode 100644
index 0000000..915a193
--- /dev/null
+++ b/.vim/my/after/ftplugin/gitcommit.vim
@@ -0,0 +1,14 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_gitcommit_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal spell
+
+
+
+let b:did_ftplugin_gitcommit_after = 1
diff --git a/.vim/my/after/ftplugin/go.vim b/.vim/my/after/ftplugin/go.vim
new file mode 100644
index 0000000..54aa34b
--- /dev/null
+++ b/.vim/my/after/ftplugin/go.vim
@@ -0,0 +1,17 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_go_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal noexpandtab
+FtpluginSetLocal shiftwidth=4
+FtpluginSetLocal softtabstop=4
+FtpluginSetLocal tabstop=4
+
+
+
+let b:did_ftplugin_go_after = 1 \ No newline at end of file
diff --git a/.vim/my/after/ftplugin/haskell.vim b/.vim/my/after/ftplugin/haskell.vim
new file mode 100644
index 0000000..676dcce
--- /dev/null
+++ b/.vim/my/after/ftplugin/haskell.vim
@@ -0,0 +1,22 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_haskell_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=4
+FtpluginSetLocal softtabstop=4
+
+let g:hs_highlight_boolean = v:true
+let g:hs_highlight_types = v:true
+let g:hs_highlight_more_types = v:true
+let g:hs_highlight_debug = v:true
+let g:hs_allow_hash_operator = v:true
+
+
+
+let b:did_ftplugin_haskell_after = 1
diff --git a/.vim/my/after/ftplugin/html.vim b/.vim/my/after/ftplugin/html.vim
new file mode 100644
index 0000000..a7b36ad
--- /dev/null
+++ b/.vim/my/after/ftplugin/html.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_html_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_html_after = 1 \ No newline at end of file
diff --git a/.vim/my/after/ftplugin/javascript.vim b/.vim/my/after/ftplugin/javascript.vim
new file mode 100644
index 0000000..a79e644
--- /dev/null
+++ b/.vim/my/after/ftplugin/javascript.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_javascript_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_javascript_after = 1
diff --git a/.vim/my/after/ftplugin/json.vim b/.vim/my/after/ftplugin/json.vim
new file mode 100644
index 0000000..9886a95
--- /dev/null
+++ b/.vim/my/after/ftplugin/json.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_json_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_json_after = 1
diff --git a/.vim/my/after/ftplugin/lua.vim b/.vim/my/after/ftplugin/lua.vim
new file mode 100644
index 0000000..d0eb8b2
--- /dev/null
+++ b/.vim/my/after/ftplugin/lua.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_lua_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=3
+FtpluginSetLocal softtabstop=3
+
+
+
+let b:did_ftplugin_lua_after = 1
diff --git a/.vim/my/after/ftplugin/python.vim b/.vim/my/after/ftplugin/python.vim
new file mode 100644
index 0000000..edeac06
--- /dev/null
+++ b/.vim/my/after/ftplugin/python.vim
@@ -0,0 +1,21 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_python_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=4
+FtpluginSetLocal softtabstop=4
+
+let g:python_highlight_all = v:true
+
+" Overrides the default value: shiftwidth()*2
+let g:pyindent_continue = shiftwidth()
+
+
+
+let b:did_ftplugin_python_after = 1 \ No newline at end of file
diff --git a/.vim/my/after/ftplugin/qf.vim b/.vim/my/after/ftplugin/qf.vim
new file mode 100644
index 0000000..364759c
--- /dev/null
+++ b/.vim/my/after/ftplugin/qf.vim
@@ -0,0 +1,40 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_qf_after')
+ finish
+endif
+
+
+
+nnoremap <buffer> p <Return>zz<C-w>p
+nnoremap <silent> <buffer> dd :call <SID>del_entry()<Return>
+xnoremap <silent> <buffer> d :call <SID>del_entry()<Return>
+nnoremap <silent> <buffer> u :<C-u>call <SID>undo_entry()<Return>
+
+
+if exists('*s:undo_entry')
+ finish
+endif
+
+
+function! s:undo_entry()
+ let history = get(w:, 'qf_history', [])
+ if !empty(history)
+ call setqflist(remove(history, -1), 'r')
+ endif
+endfunction
+
+function! s:del_entry() range
+ let qf = getqflist()
+ let history = get(w:, 'qf_history', [])
+ call add(history, copy(qf))
+ let w:qf_history = history
+ unlet! qf[a:firstline - 1 : a:lastline - 1]
+ call setqflist(qf, 'r')
+ execute a:firstline
+endfunction
+
+
+
+let b:did_ftplugin_qf_after = 1
diff --git a/.vim/my/after/ftplugin/ruby.vim b/.vim/my/after/ftplugin/ruby.vim
new file mode 100644
index 0000000..4d246e8
--- /dev/null
+++ b/.vim/my/after/ftplugin/ruby.vim
@@ -0,0 +1,19 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_ruby_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+let g:ruby_operators = v:true
+let g:ruby_space_errors = v:true
+
+
+
+let b:did_ftplugin_ruby_after = 1
diff --git a/.vim/my/after/ftplugin/todolist.vim b/.vim/my/after/ftplugin/todolist.vim
new file mode 100644
index 0000000..7235deb
--- /dev/null
+++ b/.vim/my/after/ftplugin/todolist.vim
@@ -0,0 +1,29 @@
+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 = '//'
+
+
+let b:lexima_disabled = 1
+" for lexima
+inoremap <nowait> <buffer> <ESC> <ESC>
+
+
+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/after/ftplugin/toml.vim b/.vim/my/after/ftplugin/toml.vim
new file mode 100644
index 0000000..84f6ca7
--- /dev/null
+++ b/.vim/my/after/ftplugin/toml.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_toml_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_toml_after = 1
diff --git a/.vim/my/after/ftplugin/vim.vim b/.vim/my/after/ftplugin/vim.vim
new file mode 100644
index 0000000..1ffa6a3
--- /dev/null
+++ b/.vim/my/after/ftplugin/vim.vim
@@ -0,0 +1,22 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_vim_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal colorcolumn=+1
+FtpluginSetLocal expandtab
+FtpluginSetLocal iskeyword-=#
+FtpluginSetLocal keywordprg=:help
+FtpluginSetLocal shiftwidth=4
+FtpluginSetLocal softtabstop=4
+FtpluginSetLocal textwidth=78
+
+let g:vim_indent_cont = 4
+
+
+
+let b:did_ftplugin_vim_after = 1 \ No newline at end of file
diff --git a/.vim/my/after/ftplugin/yaml.vim b/.vim/my/after/ftplugin/yaml.vim
new file mode 100644
index 0000000..5b4734e
--- /dev/null
+++ b/.vim/my/after/ftplugin/yaml.vim
@@ -0,0 +1,16 @@
+scriptencoding utf-8
+
+
+if exists('b:did_ftplugin_yaml_after')
+ finish
+endif
+
+
+
+FtpluginSetLocal expandtab
+FtpluginSetLocal shiftwidth=2
+FtpluginSetLocal softtabstop=2
+
+
+
+let b:did_ftplugin_yaml_after = 1
diff --git a/.vim/my/after/syntax/json.vim b/.vim/my/after/syntax/json.vim
new file mode 100644
index 0000000..0d2651e
--- /dev/null
+++ b/.vim/my/after/syntax/json.vim
@@ -0,0 +1,23 @@
+scriptencoding utf-8
+
+if exists("b:current_syntax_my_json")
+ finish
+endif
+
+if b:current_syntax !=# 'json'
+ finish
+endif
+
+
+" $VIMRUNTIME/syntax/json.vim
+" Language: JSON
+" Maintainer: Eli Parra <eli@elzr.com>
+" Last Change: 2014 Aug 23
+" Version: 0.12
+" Overwrite syntax by non-conceal version even if 'conceal' is enabled.
+syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
+syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained
+
+
+
+let b:current_syntax_my_json = 1
diff --git a/.vim/my/after/syntax/python.vim b/.vim/my/after/syntax/python.vim
new file mode 100644
index 0000000..834ab1f
--- /dev/null
+++ b/.vim/my/after/syntax/python.vim
@@ -0,0 +1,19 @@
+scriptencoding utf-8
+
+
+if exists("b:current_syntax_my_python")
+ finish
+endif
+
+if b:current_syntax !=# 'python'
+ finish
+endif
+
+
+
+" Highlight "self".
+syn keyword pythonSelf self
+hi default link pythonSelf Identifier
+
+
+let b:current_syntax_my_python = 1
diff --git a/.vim/my/after/syntax/vim.vim b/.vim/my/after/syntax/vim.vim
new file mode 100644
index 0000000..a6b0d31
--- /dev/null
+++ b/.vim/my/after/syntax/vim.vim
@@ -0,0 +1,30 @@
+scriptencoding utf-8
+
+
+if exists("b:current_syntax_my_vim")
+ finish
+endif
+
+if b:current_syntax !=# 'vim'
+ finish
+endif
+
+
+
+" Tags
+syn match vimrcDocTagFollowingName /@\(param\|var\|const\|field\)/ contained skipwhite nextgroup=vimrcDocName,vimrcDocName2
+syn match vimrcDocTagFollowingType /@\(return\|class\|ctor\|method\|type\)/ contained skipwhite nextgroup=vimrcDocType
+syn match vimrcDocName /\w\+/ contained skipwhite nextgroup=vimrcDocType
+syn match vimrcDocName2 /\[\w\+\]/hs=s+1,he=e-1 contained skipwhite nextgroup=vimrcDocType
+syn match vimrcDocType /(\w\+)/hs=s+1,he=e-1 contained skipwhite nextgroup=vimrcDocType
+
+syn cluster vimCommentGroup add=vimrcDocTagFollowingName,vimrcDocTagFollowingType
+
+hi def link vimrcDocTagFollowingName Statement
+hi def link vimrcDocTagFollowingType Statement
+hi def link vimrcDocName Identifier
+hi def link vimrcDocName2 Identifier
+hi def link vimrcDocType Type
+
+
+let b:current_syntax_my_vim = 1
diff --git a/.vim/my/colors/ocean.vim b/.vim/my/colors/ocean.vim
new file mode 100644
index 0000000..f220740
--- /dev/null
+++ b/.vim/my/colors/ocean.vim
@@ -0,0 +1,146 @@
+scriptencoding utf-8
+
+
+hi clear
+let g:colors_name = 'ocean'
+
+
+
+let s:dark = {
+ \ 'NONE' : 'NONE',
+ \ 'bg' : '#101020',
+ \ 'fg' : '#b1b1c8',
+ \ 'gray1' : '#a7a7a7',
+ \ 'gray2' : '#353535',
+ \ 'gray3' : '#464646',
+ \ 'gray4' : '#252525',
+ \ 'red' : '#a65f49',
+ \ 'red2' : '#2e1f28',
+ \ 'orange' : '#deab52',
+ \ 'yellow' : '#a68f49',
+ \ 'yellow2' : '#a89562',
+ \ 'yellow3' : '#5c5241',
+ \ 'green' : '#c4e088',
+ \ 'blue' : '#6e6eff',
+ \ 'blue2' : '#70b0ff',
+ \ 'diff_add' : '#202050',
+ \ 'diff_change' : '#204020',
+ \ 'diff_delete' : '#402020',
+ \ 'diff_text' : '#3e6333',
+ \ 'visual' : '#303060',
+ \ 'comment' : '#8686bf',
+ \ 'cursor' : '#5b5bb6',
+ \ }
+
+let s:light = {
+ \ 'NONE' : 'NONE',
+ \ 'bg' : '#f5f5ff',
+ \ 'fg' : '#203050',
+ \ 'gray1' : '#4f4f4f',
+ \ 'gray2' : '#bebebe',
+ \ 'gray3' : '#aeaeae',
+ \ 'gray4' : '#cecece',
+ \ 'red' : '#d77253',
+ \ 'red2' : '#dcc8c2',
+ \ 'orange' : '#e79230',
+ \ 'yellow' : '#cba224',
+ \ 'yellow2' : '#af8e29',
+ \ 'yellow3' : '#c6b683',
+ \ 'green' : '#6f9226',
+ \ 'blue' : '#6e6eff',
+ \ 'blue2' : '#6f8fff',
+ \ 'diff_add' : '#202050',
+ \ 'diff_change' : '#204020',
+ \ 'diff_delete' : '#402020',
+ \ 'diff_text' : '#c4ff88',
+ \ 'visual' : '#f0f0d0',
+ \ 'comment' : '#a0a0e0',
+ \ 'cursor' : '#5b5bb6',
+ \ }
+
+
+function! s:hi(group_name, guifg, guibg, ...) abort
+ let attributes = get(a:000, 0, 'NONE')
+ " Even if 'termguicolors' is enabled the attribute "gui" is ignored,
+ " instead, "cterm" is used.
+ execute printf('hi %s guifg=%s guibg=%s gui=%s cterm=%s',
+ \ a:group_name,
+ \ s:pallete[a:guifg], s:pallete[a:guibg], attributes, attributes)
+endfunction
+
+command! -nargs=*
+ \ Hi
+ \ call s:hi(<f-args>)
+
+
+
+let s:pallete = &background ==# 'dark' ? s:dark : s:light
+
+Hi ColorColumn NONE red2
+Hi Comment comment NONE
+Hi Constant red NONE
+Hi Cursor fg cursor
+Hi DiffAdd NONE diff_add
+Hi DiffChange NONE diff_change
+Hi DiffDelete NONE diff_delete
+Hi DiffText NONE diff_text
+Hi EndOfBuffer bg bg
+Hi Error red NONE
+Hi Identifier green NONE
+Hi LineNr gray1 visual
+Hi MatchParen NONE NONE
+Hi MoreMsg comment NONE
+Hi Normal fg bg
+Hi PMenu fg gray2
+Hi PMenuSbar NONE gray2
+Hi PMenuSel fg visual
+Hi PMenuThumb NONE gray4
+Hi PreProc orange NONE
+Hi Search bg yellow3 bold
+Hi Special red NONE
+Hi SpecialComment comment NONE bold
+Hi SpecialKey gray2 NONE
+Hi SpellBad red NONE underline
+Hi SpellCap red NONE underline
+Hi SpellLocal yellow2 NONE underline
+Hi SpellRare yellow2 NONE underline
+Hi Statement blue NONE
+Hi StatusLine gray1 gray2
+Hi StatusLineNC gray1 gray3
+Hi String yellow NONE
+Hi Title orange NONE
+Hi Todo fg NONE bold
+Hi Type blue2 NONE
+Hi Underlined NONE NONE underline
+Hi Visual NONE visual
+Hi WarningMsg yellow2 NONE bold
+
+
+hi! link Character String
+hi! link CursorColumn CursorLine
+hi! link CursorIM Cursor
+hi! link CursorLine Visual
+hi! link CursorLineNr Normal
+hi! link Directory Type
+hi! link ErrorMsg Error
+hi! link FoldColumn LineNr
+hi! link Folded Comment
+hi! link IncSearch Search
+hi! link ModeMsg Comment
+hi! link NonText SpecialKey
+hi! link Operator Identifier
+hi! link Question MoreMsg
+hi! link SignColumn LineNr
+hi! link TabLine StatusLineNC
+hi! link TabLineFill EndOfBuffer
+hi! link TabLineSel StatusLine
+hi! link VertSplit StatusLine
+hi! link WildMenu Title
+
+
+
+unlet s:pallete
+unlet s:dark
+unlet s:light
+delfunction s:hi
+delcommand Hi
diff --git a/.vim/my/ftplugin/todolist.vim b/.vim/my/ftplugin/todolist.vim
new file mode 100644
index 0000000..e65faa3
--- /dev/null
+++ b/.vim/my/ftplugin/todolist.vim
@@ -0,0 +1,71 @@
+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
new file mode 100644
index 0000000..0640a93
--- /dev/null
+++ b/.vim/my/indent/todolist.vim
@@ -0,0 +1,32 @@
+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
new file mode 100644
index 0000000..d2775e3
--- /dev/null
+++ b/.vim/my/syntax/todolist.vim
@@ -0,0 +1,21 @@
+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"