From a519618e20aa29858497d03edfb1b79015c4031e Mon Sep 17 00:00:00 2001 From: FaultyBranches Date: Thu, 2 Apr 2026 06:23:43 -0500 Subject: [PATCH] fix: Updates to telekasten to use the built in toggle_todo function instead of the custom one (works well enough), removing lazy loading of the plugin to allow calling from telekasten commands from nvim load, and adding ZSH functions to open a new note or today's note immediately. --- nvim/lua/plugins/telekasten.lua | 45 +++++++++++++++++---------------- zsh/zsh_functions | 8 ++++-- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/nvim/lua/plugins/telekasten.lua b/nvim/lua/plugins/telekasten.lua index 787b55a..b304e44 100644 --- a/nvim/lua/plugins/telekasten.lua +++ b/nvim/lua/plugins/telekasten.lua @@ -2,28 +2,28 @@ function string.insert(str1, str2, pos) return str1:sub(1, pos) .. str2 .. str1:sub(pos + 1) end -function toggleTODO(current_line) - local todo_str = '%- %[ %] ' - local todo_checked_str = '%- %[x%] ' +-- function ToggleTODO(current_line) + -- local todo_str = '%- %[ %] ' + -- local todo_checked_str = '%- %[x%] ' - if current_line:find(todo_str, 1) then - return string.gsub(current_line, todo_str, '', 1) - elseif current_line:find(todo_checked_str, 1) then - return string.gsub(current_line, todo_checked_str, '', 1) - else - local first_idx = current_line:find('[%-%w]', 1) - 1 - return string.insert(current_line, '- [ ] ', first_idx) - end -end + -- if current_line:find(todo_str, 1) then + -- return string.gsub(current_line, todo_str, '', 1) + -- elseif current_line:find(todo_checked_str, 1) then + -- return string.gsub(current_line, todo_checked_str, '', 1) + -- else + -- local first_idx = current_line:find('[%-%w]', 1) - 1 + -- return string.insert(current_line, '- [ ] ', first_idx) + -- end +-- end -vim.api.nvim_create_user_command('ToggleTODO', function() - local current_line = vim.api.nvim_get_current_line() - local row, _ = unpack(vim.api.nvim_win_get_cursor(0)) +-- vim.api.nvim_create_user_command('ToggleTODO', function() + -- local current_line = vim.api.nvim_get_current_line() + -- local row, _ = unpack(vim.api.nvim_win_get_cursor(0)) - local new_line = toggleTODO(current_line) + -- local new_line = ToggleTODO(current_line) - vim.api.nvim_buf_set_lines(0, row - 1, row, true, { new_line }) -end, {}) + -- vim.api.nvim_buf_set_lines(0, row - 1, row, true, { new_line }) +-- end, {}) return { 'renerocksai/telekasten.nvim', @@ -49,10 +49,11 @@ return { vim.api.nvim_set_hl(0, 'tkTag', { ctermfg = 'gray', fg = 'gray' }) end, keys = { + { 'tt', ':Telekasten toggle_todo' }, + { 'zfn', ':Telekasten find_notes' }, + { 'zft', ':Telekasten show_tags' }, + { 'zn', ':Telekasten new_note' }, { 'zp', ':Telekasten panel' }, - { 'zn', ':Telekasten find_notes' }, - { 'zt', ':Telekasten show_tags' }, - { 'tt', ':ToggleTODO' }, }, - -- lazy = false + lazy = false } diff --git a/zsh/zsh_functions b/zsh/zsh_functions index dbdb8f0..cf49d2b 100644 --- a/zsh/zsh_functions +++ b/zsh/zsh_functions @@ -17,8 +17,12 @@ function rmv() { find ./* -depth -type d -empty -exec rmdir "{}" \; } -function new_note() { - nvim +function note() { + nvim -c ":Telekasten new_note" +} + +function today() { + nvim -c ":Telekasten goto_today" } function path() {