You've already forked dotfiles
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.
This commit is contained in:
@@ -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 = {
|
||||
{ '<leader>tt', ':Telekasten toggle_todo<CR>' },
|
||||
{ '<leader>zfn', ':Telekasten find_notes<CR>' },
|
||||
{ '<leader>zft', ':Telekasten show_tags<CR>' },
|
||||
{ '<leader>zn', ':Telekasten new_note<CR>' },
|
||||
{ '<leader>zp', ':Telekasten panel<CR>' },
|
||||
{ '<leader>zn', ':Telekasten find_notes<CR>' },
|
||||
{ '<leader>zt', ':Telekasten show_tags<CR>' },
|
||||
{ '<leader>tt', ':ToggleTODO<CR>' },
|
||||
},
|
||||
-- lazy = false
|
||||
lazy = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user