diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-09 23:46:22 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-09 23:46:22 +0900 |
| commit | 82184cdfa758fdb1193bd1a82de6fce236b7d174 (patch) | |
| tree | d273c4fd6f43b716d8c4d286a1da8373f4b93b9f | |
| parent | 73fa3647434b800e502231da81c3c5a1f2c35bb5 (diff) | |
| download | dotfiles-82184cdfa758fdb1193bd1a82de6fce236b7d174.tar.gz dotfiles-82184cdfa758fdb1193bd1a82de6fce236b7d174.tar.zst dotfiles-82184cdfa758fdb1193bd1a82de6fce236b7d174.zip | |
nvim: remove leaf
| -rw-r--r-- | .config/nvim/after/ftplugin/leaf.lua | 18 | ||||
| -rw-r--r-- | .config/nvim/ftplugin/leaf.vim | 24 | ||||
| -rw-r--r-- | .config/nvim/indent/leaf.vim | 7 | ||||
| -rw-r--r-- | .config/nvim/lua/leaf/calendar.lua | 43 | ||||
| -rw-r--r-- | .config/nvim/lua/leaf/fold.lua | 61 | ||||
| -rw-r--r-- | .config/nvim/lua/leaf/indent.lua | 16 | ||||
| -rw-r--r-- | .config/nvim/lua/leaf/init.lua | 88 | ||||
| -rw-r--r-- | .config/nvim/plugin/leaf.vim | 15 | ||||
| -rw-r--r-- | .config/nvim/syntax/leaf.vim | 27 |
9 files changed, 0 insertions, 299 deletions
diff --git a/.config/nvim/after/ftplugin/leaf.lua b/.config/nvim/after/ftplugin/leaf.lua deleted file mode 100644 index 0f38ac2..0000000 --- a/.config/nvim/after/ftplugin/leaf.lua +++ /dev/null @@ -1,18 +0,0 @@ -vimrc.after_ftplugin('leaf', function(conf) - vim.wo.foldlevel = 1 - - vim.b.caw_oneline_comment = '#' - - if vim.fn.exists(':AutosaveEnable') == 2 then - vim.cmd('AutosaveEnable') - end - - vim.cmd([=[ - nnoremap <buffer> ,t <Plug>(leaf-switch-task-status-to-todo) - nnoremap <buffer> ,T <Plug>(leaf-switch-task-status-to-todo-rec) - nnoremap <buffer> ,d <Plug>(leaf-switch-task-status-to-done) - nnoremap <buffer> ,D <Plug>(leaf-switch-task-status-to-done-rec) - nnoremap <buffer> ,c <Plug>(leaf-switch-task-status-to-canceled) - nnoremap <buffer> ,C <Plug>(leaf-switch-task-status-to-canceled-rec) - ]=]) -end) diff --git a/.config/nvim/ftplugin/leaf.vim b/.config/nvim/ftplugin/leaf.vim deleted file mode 100644 index c25a462..0000000 --- a/.config/nvim/ftplugin/leaf.vim +++ /dev/null @@ -1,24 +0,0 @@ -scriptencoding utf-8 - -if exists('b:did_ftplugin_leaf') - finish -endif - - -inoremap <buffer> <expr> <Space> v:lua.require'leaf'.checkbox(v:false, ' ') -inoremap <buffer> <expr> x v:lua.require'leaf'.checkbox(v:true, 'x') - -nnoremap <buffer> <Plug>(leaf-switch-task-status-to-todo) <Cmd>lua require'leaf'.switch_task_status(' ')<CR> -nnoremap <buffer> <Plug>(leaf-switch-task-status-to-todo-rec) <Cmd>lua require'leaf'.switch_task_status_rec(' ')<CR> -nnoremap <buffer> <Plug>(leaf-switch-task-status-to-done) <Cmd>lua require'leaf'.switch_task_status('x')<CR> -nnoremap <buffer> <Plug>(leaf-switch-task-status-to-done-rec) <Cmd>lua require'leaf'.switch_task_status_rec('x')<CR> -nnoremap <buffer> <Plug>(leaf-switch-task-status-to-canceled) <Cmd>lua require'leaf'.switch_task_status('-')<CR> -nnoremap <buffer> <Plug>(leaf-switch-task-status-to-canceled-rec) <Cmd>lua require'leaf'.switch_task_status_rec('-')<CR> - - -setlocal foldmethod=expr -setlocal foldexpr=v:lua.require'leaf.fold'.foldexpr() -setlocal foldtext=v:lua.require'leaf.fold'.foldtext() - - -let b:did_ftplugin_leaf = 1 diff --git a/.config/nvim/indent/leaf.vim b/.config/nvim/indent/leaf.vim deleted file mode 100644 index b76dedd..0000000 --- a/.config/nvim/indent/leaf.vim +++ /dev/null @@ -1,7 +0,0 @@ -if exists('b:did_indent') - finish -endif - -setlocal indentexpr=v:lua.require'leaf.indent'.indentexpr() - -let b:did_indent = 1 diff --git a/.config/nvim/lua/leaf/calendar.lua b/.config/nvim/lua/leaf/calendar.lua deleted file mode 100644 index f998785..0000000 --- a/.config/nvim/lua/leaf/calendar.lua +++ /dev/null @@ -1,43 +0,0 @@ -local M = {} - - -local floor = math.floor - - -M.MON = 1 -M.TUE = 2 -M.WED = 3 -M.THU = 4 -M.FRI = 5 -M.SAT = 6 -M.SUN = 7 - - -function M.calc_week_of_day(y, m, d) - -- Zeller's congruence - if m == 1 or m == 2 then - m = m + 12 - y = y - 1 - end - local C = floor(y / 100) - local Y = y % 100 - local G = 5*C + floor(C/4) - return 1 + (d + floor(26 * (m+1) / 10) + Y + floor(Y/4) + G + 5) % 7 -end - - -function M.translate_week_of_day(w, locale) - -- assert(locale == 'ja_JP') - return ({ - [M.MON] = '月', - [M.TUE] = '火', - [M.WED] = '水', - [M.THU] = '木', - [M.FRI] = '金', - [M.SAT] = '土', - [M.SUN] = '日', - })[w] -end - - -return M diff --git a/.config/nvim/lua/leaf/fold.lua b/.config/nvim/lua/leaf/fold.lua deleted file mode 100644 index 0221dda..0000000 --- a/.config/nvim/lua/leaf/fold.lua +++ /dev/null @@ -1,61 +0,0 @@ -local M = {} - - -local F = vim.fn -local V = vim.v - - -local function find_plain_string(haystack, needle, start) - return haystack:find(needle, start or 1, true) -end - - -function M.foldexpr() - local lnum = V.lnum - local current_line_indent = F.indent(lnum) - local task_level = math.floor(current_line_indent / F.shiftwidth()) - if lnum == F.line('$') then - return task_level - end - local next_line_indent = F.indent(lnum + 1) - if current_line_indent < next_line_indent then - return ('>%d'):format(task_level + 1) - else - return task_level - end -end - - -function M.foldtext() - local foldstart = V.foldstart - local foldend = V.foldend - local shiftwidth = F.shiftwidth() - local current_line_indent = F.indent(foldstart) - - local todo = 0 - local done = 0 - for i = foldstart + 1, foldend do - local line = F.getline(i) - local line_indent = F.indent(i) - if line_indent == current_line_indent + shiftwidth then - if find_plain_string(line, '[x] ') then - done = done + 1 - elseif find_plain_string(line, '[ ] ') then - todo = todo + 1 - elseif find_plain_string(line, '[-] ') then - done = done + 1 - end - end - end - - local progress - if done + todo == 0 then - progress = '...' - else - progress = (' [%d/%d]'):format(done, done + todo) - end - return F.getline(foldstart) .. progress -end - - -return M diff --git a/.config/nvim/lua/leaf/indent.lua b/.config/nvim/lua/leaf/indent.lua deleted file mode 100644 index d1df34a..0000000 --- a/.config/nvim/lua/leaf/indent.lua +++ /dev/null @@ -1,16 +0,0 @@ -local M = {} - -local F = vim.fn -local V = vim.v - - -function M.indentexpr() - local lnum = V.lnum - if lnum == 0 then - return 0 - end - return F.indent(lnum - 1) -end - - -return M diff --git a/.config/nvim/lua/leaf/init.lua b/.config/nvim/lua/leaf/init.lua deleted file mode 100644 index c389ffd..0000000 --- a/.config/nvim/lua/leaf/init.lua +++ /dev/null @@ -1,88 +0,0 @@ -local M = {} - - -local A = vim.api -local F = vim.fn - -local TASK_STATUS_PATTERN = [=[\[[ x-]\] ]=] -local TASK_STATUS_PATTERN_EXCEPT_DONE = [=[\[[ -]\] ]=] -local TASK_STATUS_PATTERN_EXCEPT_CANCELED = [=[\[[ x]\] ]=] --- op = T --- T => T --- D => T --- C => T --- op = D --- T => D --- D => D --- C => C --- op = C --- T => C --- D => D --- C => C - - -local function vim_match(s, pattern) - return vim.regex(pattern):match_str(s) -end - -local function switch_task_status_internal(line_num, op, is_subtask) - local line = F.getline(line_num) - local pattern - if is_subtask then - if op == ' ' then - pattern = TASK_STATUS_PATTERN - elseif op == 'x' then - pattern = TASK_STATUS_PATTERN_EXCEPT_CANCELED - elseif op == '-' then - pattern = TASK_STATUS_PATTERN_EXCEPT_DONE - else - assert('unexpected op: ' .. tostring(op)) - end - else - pattern = TASK_STATUS_PATTERN - end - if vim_match(line, pattern) then - local replacement = ('[%s] '):format(op) - F.setline(line_num, F.substitute(line, pattern, replacement, '')) - return true - else - return false - end -end - - -function M.checkbox(check, char) - local line = F.getline('.') - if vim_match(line, [[^\s*$]]) and #line % F.shiftwidth() == 0 then - return check and '[x] ' or '[ ] ' - else - return char - end -end - -function M.switch_task_status(op) - switch_task_status_internal(F.line('.'), op) -end - -function M.switch_task_status_rec(op) - local current_line_num = F.line('.') - local replaced = switch_task_status_internal(current_line_num, op) - if not replaced then - return - end - local last_line_num = F.line('$') - if current_line_num == last_line_num then - return - end - - local base_indent_level = F.indent('.') - for l = current_line_num + 1, last_line_num do - if F.indent(l) <= base_indent_level then - break - end - switch_task_status_internal(l, op, true) - end -end - - -return M diff --git a/.config/nvim/plugin/leaf.vim b/.config/nvim/plugin/leaf.vim deleted file mode 100644 index bc19053..0000000 --- a/.config/nvim/plugin/leaf.vim +++ /dev/null @@ -1,15 +0,0 @@ -scriptencoding utf-8 - -if exists('g:loaded_leaf') - finish -endif - - -nmap <Space> <Nop> -nmap <Space>l (leaf) -nnoremap (leaf) <Nop> - -nnoremap (leaf)l <Cmd>SmartTabEdit ~/leaves/INBOX.leaf <Bar>normal G<CR> - - -let g:loaded_leaf = 1 diff --git a/.config/nvim/syntax/leaf.vim b/.config/nvim/syntax/leaf.vim deleted file mode 100644 index ea86de4..0000000 --- a/.config/nvim/syntax/leaf.vim +++ /dev/null @@ -1,27 +0,0 @@ -scriptencoding utf-8 - -if exists('b:current_syntax') - finish -endif - - -syn match leafCheckboxTodo /\[ \]/ -syn match leafCheckboxDone /\[x\]/ -syn match leafCheckboxCanceled /\[-\]/ -syn region leafComment start="# " end="$" -syn match leafTag /@\w\+/ -syn match leafProperty /\<\%(DEADLINE\|SCHEDULED\|ARCHIVED\): / -syn match leafTimestamp /<\d\d\d\d-\d\d-\d\d\%( [月火水木金土日]\)\?\%( \d\d:\d\d\)\?>/ -syn match leafTimestamp /<\d\d\d\d-\d\d-\d\d\%( [月火水木金土日]\)\?\%( \d\d:\d\d\)\?>--<\d\d\d\d-\d\d-\d\d\%( [月火水木金土日]\)\?\%( \d\d:\d\d\)\?>/ - - -hi default link leafCheckboxTodo Special -hi default link leafCheckboxDone Comment -hi default link leafCheckboxCanceled Comment -hi default link leafComment Comment -hi default link leafTag String -hi default link leafProperty Identifier -hi default link leafTimestamp Identifier - - -let b:current_syntax = 'leaf' |
