added goto_today

This commit is contained in:
Rene Schallner
2021-11-21 01:57:50 +01:00
parent 613d2080e2
commit 7914a4607b
2 changed files with 13 additions and 0 deletions

View File

@@ -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 <leader>zf :lua require('telekasten').find_notes()<CR>
nnoremap <leader>zd :lua require('telekasten').find_daily_notes()<CR>
nnoremap <leader>zg :lua require('telekasten').search_notes()<CR>
nnoremap <leader>zz :lua require('telekasten').follow_link()<CR>
nnoremap <leader>zt :lua require('telekasten').goto_today()<CR>
" note: we define [[ in **insert mode** to call insert link
inoremap [[ <ESC>:lua require('telekasten').insert_link()<CR>

View File

@@ -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