]> git.r.bdr.sh - rbdr/nota.nvim/blame - lua/learning.lua
Allow next and previous
[rbdr/nota.nvim] / lua / learning.lua
CommitLineData
56292c79
RBR
1-------------------------------------------------------------------------------
2-- Tools to deal with the learning file
3-------------------------------------------------------------------------------
503d09fc
RBR
4local Learning = {}
5
6local Configuration = require('configuration')
7local Util = require('util')
8-------------------------------------------------------------------------------
9-- Internal Functions
10-------------------------------------------------------------------------------
56292c79
RBR
11-------------------------------------------------------------------------------
12-- Public Interface
13-------------------------------------------------------------------------------
14
15--- Opens the learning file
503d09fc
RBR
16function Learning.open()
17 local learning_path = Configuration.path_for(Configuration.configuration.learning.learning_file)
18 local learning_parent = Util.directory_name(learning_path)
19 Util.ensure_directory_exists(learning_parent)
20 vim.cmd('edit ' .. learning_path)
56292c79
RBR
21end
22
23--- Capture a learning entry
503d09fc
RBR
24function Learning.capture()
25 local prefix = os.date(Configuration.configuration.learning.prefix)
26 Learning.open()
27 vim.cmd('normal! ggO'..prefix)
28 vim.cmd('startinsert!')
56292c79
RBR
29end
30
503d09fc 31return Learning