]> git.r.bdr.sh - rbdr/nota.nvim/blame_incremental - lua/nota/learning.lua
Namespace the plugin
[rbdr/nota.nvim] / lua / nota / learning.lua
... / ...
CommitLineData
1-------------------------------------------------------------------------------
2-- Tools to deal with the learning file
3-------------------------------------------------------------------------------
4local Learning = {}
5
6local Configuration = require('nota.configuration')
7local Util = require('nota.util')
8-------------------------------------------------------------------------------
9-- Internal Functions
10-------------------------------------------------------------------------------
11-------------------------------------------------------------------------------
12-- Public Interface
13-------------------------------------------------------------------------------
14
15--- Opens the learning file
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)
21end
22
23--- Capture a learning entry
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!')
29end
30
31return Learning