diff --git a/README.md b/README.md index 8fd40da..3b29e8e 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ The plugin defines the following functions. - `search_notes()`: live grep for word under cursor in all notes (search in notes), via Telescope - `insert_link()` : select a note by name, via Telescope, and place a `[[link]]` at the current cursor position - `follow_link()`: take text between brackets (linked note) and open a Telescope file finder with it: selects note to open (incl. preview) +- `goto_today()` : pops up a Telescope window with today's daily note pre-selected. Today's note will be created if not present. - `install_daily_finder()` : installs the daily finder tool used by the plugin - `setup(opts)`: used for configuring paths, file extension, etc. @@ -74,6 +75,7 @@ nnoremap zf :lua require('telekasten').find_notes() nnoremap zd :lua require('telekasten').find_daily_notes() nnoremap zg :lua require('telekasten').search_notes() nnoremap zz :lua require('telekasten').follow_link() +nnoremap zt :lua require('telekasten').goto_today() " note: we define [[ in **insert mode** to call insert link inoremap [[ :lua require('telekasten').insert_link() diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 92fc2b5..ffed5cd 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -121,6 +121,16 @@ follow_link = function(opts) end +goto_today = function(opts) + local word = os.date("%Y-%m-%d") + builtin.find_files({ + prompt_title = "Follow link to note...", + cwd = zkcfg.home, + default_text = word, + find_command = { zkcfg.daily_finder }, + entry_maker = zk_entry_maker, + }) +end -- -- find_notes: @@ -207,6 +217,7 @@ local M = { follow_link = follow_link, setup = setup, install_daily_finder = install_daily_finder, + goto_today = goto_today, } print("telekasten reloaded") return M