mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
feat: allow auto-open of journal entries (#125)
This commit is contained in:
@@ -254,6 +254,9 @@ require('telekasten').setup({
|
|||||||
dailies_create_nonexisting = true,
|
dailies_create_nonexisting = true,
|
||||||
weeklies_create_nonexisting = true,
|
weeklies_create_nonexisting = true,
|
||||||
|
|
||||||
|
-- skip telescope prompt for goto_today and goto_thisweek
|
||||||
|
journal_auto_open = false,
|
||||||
|
|
||||||
-- template for new notes (new_note, follow_link)
|
-- template for new notes (new_note, follow_link)
|
||||||
-- set to `nil` or do not specify if you do not want a template
|
-- set to `nil` or do not specify if you do not want a template
|
||||||
template_new_note = home .. '/' .. 'templates/new_note.md',
|
template_new_note = home .. '/' .. 'templates/new_note.md',
|
||||||
@@ -362,6 +365,7 @@ END
|
|||||||
| `follow_creates_nonexisting` | following a link to a non-existing note will create it | true |
|
| `follow_creates_nonexisting` | following a link to a non-existing note will create it | true |
|
||||||
| `dailies_create_nonexisting` | following a link to a non-existing daily note will create it | true |
|
| `dailies_create_nonexisting` | following a link to a non-existing daily note will create it | true |
|
||||||
| `weekly_create_nonexisting` | following a link to a non-existing weekly note will create it | true |
|
| `weekly_create_nonexisting` | following a link to a non-existing weekly note will create it | true |
|
||||||
|
| `journal_auto_open` | skip telekscope picker and automatically open the note with goto_today and goto_thisweek | false |
|
||||||
| `template_new_note` | markdown template for new notes | ~/zettelkasten/templates/new_note.md |
|
| `template_new_note` | markdown template for new notes | ~/zettelkasten/templates/new_note.md |
|
||||||
| | set to `nil` if you want none | |
|
| | set to `nil` if you want none | |
|
||||||
| `template_new_daily` | markdown template for new daily notes | ~/zettelkasten/templates/daily.md |
|
| `template_new_daily` | markdown template for new daily notes | ~/zettelkasten/templates/daily.md |
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ M.Cfg = {
|
|||||||
dailies_create_nonexisting = true,
|
dailies_create_nonexisting = true,
|
||||||
weeklies_create_nonexisting = true,
|
weeklies_create_nonexisting = true,
|
||||||
|
|
||||||
|
-- skip telescope prompt for goto_today and goto_thisweek
|
||||||
|
journal_auto_open = false,
|
||||||
|
|
||||||
-- templates for new notes
|
-- templates for new notes
|
||||||
-- template_new_note = home .. "/" .. "templates/new_note.md",
|
-- template_new_note = home .. "/" .. "templates/new_note.md",
|
||||||
-- template_new_daily = home .. "/" .. "templates/daily_tk.md",
|
-- template_new_daily = home .. "/" .. "templates/daily_tk.md",
|
||||||
@@ -1712,6 +1715,7 @@ local function GotoDate(opts)
|
|||||||
or M.Cfg.insert_after_inserting
|
or M.Cfg.insert_after_inserting
|
||||||
opts.close_after_yanking = opts.close_after_yanking
|
opts.close_after_yanking = opts.close_after_yanking
|
||||||
or M.Cfg.close_after_yanking
|
or M.Cfg.close_after_yanking
|
||||||
|
opts.journal_auto_open = opts.journal_auto_open or M.Cfg.journal_auto_open
|
||||||
|
|
||||||
local word = opts.date or os.date(dateformats.date)
|
local word = opts.date or os.date(dateformats.date)
|
||||||
|
|
||||||
@@ -1735,6 +1739,9 @@ local function GotoDate(opts)
|
|||||||
opts.erase_file = fname
|
opts.erase_file = fname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.journal_auto_open then
|
||||||
|
vim.cmd("e " .. fname)
|
||||||
|
else
|
||||||
find_files_sorted({
|
find_files_sorted({
|
||||||
prompt_title = "Goto day",
|
prompt_title = "Goto day",
|
||||||
cwd = M.Cfg.dailies,
|
cwd = M.Cfg.dailies,
|
||||||
@@ -1761,6 +1768,7 @@ local function GotoDate(opts)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- GotoToday:
|
-- GotoToday:
|
||||||
@@ -2551,6 +2559,7 @@ local function GotoThisWeek(opts)
|
|||||||
or M.Cfg.insert_after_inserting
|
or M.Cfg.insert_after_inserting
|
||||||
opts.close_after_yanking = opts.close_after_yanking
|
opts.close_after_yanking = opts.close_after_yanking
|
||||||
or M.Cfg.close_after_yanking
|
or M.Cfg.close_after_yanking
|
||||||
|
opts.journal_auto_open = opts.journal_auto_open or M.Cfg.journal_auto_open
|
||||||
|
|
||||||
if not global_dir_check() then
|
if not global_dir_check() then
|
||||||
return
|
return
|
||||||
@@ -2572,6 +2581,9 @@ local function GotoThisWeek(opts)
|
|||||||
opts.erase_file = fname
|
opts.erase_file = fname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.journal_auto_open then
|
||||||
|
vim.cmd("e " .. fname)
|
||||||
|
else
|
||||||
find_files_sorted({
|
find_files_sorted({
|
||||||
prompt_title = "Goto this week:",
|
prompt_title = "Goto this week:",
|
||||||
cwd = M.Cfg.weeklies,
|
cwd = M.Cfg.weeklies,
|
||||||
@@ -2589,6 +2601,7 @@ local function GotoThisWeek(opts)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Calendar Stuff
|
-- Calendar Stuff
|
||||||
|
|||||||
Reference in New Issue
Block a user