]> git.r.bdr.sh - rbdr/nota.nvim/blame - plugin/nota.lua
Namespace the plugin
[rbdr/nota.nvim] / plugin / nota.lua
CommitLineData
56292c79
RBR
1--- @type tNotaConfiguration
2-- @field [nota_home] string the location of your notes. All other paths will be relative to this. Defaults to $XDG_DATA_HOME/nota or ~/.local/share/nota
3-- @field [default_keybinds] boolean whether to use the default key bindings or not. Defaults to true.
4-- @field [periodic_locations] tPeriodicLocationsConfiguration (optional) the location of periodic notes.
5-- @field [templates] tTemplatesConfiguration (optional) the location of templates for periodic notes.
6-- @field [tasks] tTasksConfiguration (optional) configuration for task tools
7-- @field [learning] tLearningConfiguration (optional) configuration for learning tools
8-- @field [plan] tPlanConfiguration (optional) configuration for .plan file tools
9
10--- @type tPeriodicLocationsConfiguration
11-- @field [daily] string (optional) the location where daily notes are stored relative to nota_home. Defaults to periodic/daily.
12-- @field [weekly] string (optional) the location where weekly notes are stored relative to nota_home. Defaults to periodic/weekly.
13-- @field [monthly] string (optional) the location where monthly notes are stored relative to nota_home. Defaults to periodic/monthly.
14-- @field [seasonal] string (optional) the location where seasonal notes are stored relative to nota_home. Defaults to periodic/seasonal.
15-- @field [yearly] string (optional) the location where yearly notes are stored relative to nota_home. Defaults to periodic/yearly.
16
17--- @type tTemplatesConfiguration
18-- @field [daily] string (optional) the location to the daily note template file relative to nota_home. Defaults to templates/daily.md
19-- @field [weekly] string (optional) the location to the weekly note template file relative to nota_home. Defaults to templates/weekly.md
20-- @field [monthly] string (optional) the location to the monthly note template file relative to nota_home. Defaults to templates/monthly.md
21-- @field [seasonal] string (optional) the location to the seasonal note template file relative to nota_home. Defaults to templates/seasonal.md
22-- @field [yearly] string (optional) the location to the seasonal note template file relative to nota_home. Defaults to templates/yearly.md
23-- @field [plan] string (optional) the location to the plan template file relative to nota_home. Defaults to templates/plan.md
24
25--- @type tTasksConfiguration
26-- @field [inbox] string (optional) the location of the inbox for capturing tasks relative to nota_home. Default is "inbox.md"
27-- @field [someday] string (optional) the location of the inbox for indefinitely deferred tasks relative to nota_home. Default is "someday.md"
28
29--- @type tLearningConfiguration
30-- @field [learning_file] string (optional) the location of the learning file for capturing entries relative to nota_home. Default is "learning.md"
31-- @field [prefix] string (optional) the prefix to add when capturing learning entries. Default is "%Y-%m-%d: "
32
33--- @type tPlanConfiguration
34-- @field [archive] string (optional) the location of the plan archive relative to nota_home. Default is "plans"
35-- @field [plan_file] string (optional) the location of the active plan file. Default is "~/.plan"
36
37--- Sets up the Nota commands and keybins
38-- @param user_configuration tNotaConfiguration the user provided configuration for the plugin
503d09fc
RBR
39local api = vim.api
40local fs = vim.loop
41local fn = vim.fs
56292c79 42
503d09fc
RBR
43if not api.nvim_create_user_command then
44 return
45end
56292c79 46
503d09fc 47local command = api.nvim_create_user_command
56292c79 48
503bfaa9 49local configuration = require('nota.configuration').configuration
56292c79 50
503d09fc 51if configuration.default_keybinds then
503bfaa9 52 require('nota.keybinds').bind()
503d09fc 53end
56292c79 54
503d09fc 55-- Note Handling Commands
503bfaa9
RBR
56command('NotaOpenDailyNote', function(options) require('nota.notes').open_daily(options.args) end, { nargs = '?' })
57command('NotaOpenWeeklyNote', function() require('nota.notes').open_weekly() end, { nargs = 0 })
58command('NotaOpenMonthlyNote', function() require('nota.notes').open_monthly() end, { nargs = 0 })
59command('NotaOpenSeasonalNote', function() require('nota.notes').open_seasonal() end, { nargs = 0 })
60command('NotaOpenYearlyNote', function() require('nota.notes').open_yearly() end, { nargs = 0 })
61command('NotaOpenNote', function() require('nota.notes').open() end, { nargs = 0 })
62command('NotaOpenNextNote', function() require('nota.notes').open_next() end, { nargs = 0 })
63command('NotaOpenPreviousNote', function() require('nota.notes').open_previous() end, { nargs = 0 })
56292c79 64
503d09fc 65-- Task View Handling Commands
503bfaa9
RBR
66command('NotaOpenAgenda', function() require('nota.task_views').open_agenda() end, { nargs = 0 })
67command('NotaOpenOpen', function() require('nota.task_views').open_open() end, { nargs = 0 })
68command('NotaOpenOpenImportant', function() require('nota.task_views').open_open_important() end, { nargs = 0 })
69command('NotaOpenJournal', function() require('nota.task_views').open_journal() end, { nargs = 0 })
56292c79 70
503d09fc 71-- Task Handling Commands
503bfaa9
RBR
72command('NotaToggleTask', function() require('nota.tasks').toggle() end, { nargs = 0 })
73command('NotaToggleTaskImportance', function() require('nota.tasks').toggle_importance() end, { nargs = 0 })
74command('NotaInsertTask', function() require('nota.tasks').insert() end, { nargs = 0 })
75command('NotaCaptureTask', function() require('nota.tasks').capture() end, { nargs = 0 })
76command('NotaTagTask', function(options) require('nota.tasks').tag(options.args) end, { nargs = '?' })
77command('NotaRemoveTagTask', function(options) require('nota.tasks').remove_tag(options.args) end, { nargs = '?' })
78command('NotaRescheduleTaskToday', function() require('nota.tasks').reschedule_for_today() end, { nargs = 0 })
79command('NotaRescheduleTaskTomorrow', function() require('nota.tasks').reschedule_for_tomorrow() end, { nargs = 0 })
80command('NotaRescheduleTaskSomeday', function() require('nota.tasks').reschedule_for_someday() end, { nargs = 0 })
81command('NotaRescheduleTask', function(options) require('nota.tasks').reschedule(options.args) end, { nargs = '?' })
56292c79 82
503d09fc 83-- .plan Handling Commands
503bfaa9
RBR
84command('NotaOpenPlan', function() require('nota.plan').open() end, { nargs = 0 })
85command('NotaCapturePlan', function() require('nota.plan').capture() end, { nargs = 0 })
56292c79 86
503d09fc 87-- Learning File Handling Commands
503bfaa9
RBR
88command('NotaOpenLearning', function() require('nota.learning').open() end, { nargs = 0 })
89command('NotaCaptureLearning', function() require('nota.learning').capture() end, { nargs = 0 })