X-Git-Url: https://git.r.bdr.sh/rbdr/nota.nvim/blobdiff_plain/56292c7915662bbf721ca8c3d2cee6a04134a9c6..refs/heads/main:/plugin/nota.lua?ds=sidebyside diff --git a/plugin/nota.lua b/plugin/nota.lua index 4e62170..1864deb 100644 --- a/plugin/nota.lua +++ b/plugin/nota.lua @@ -36,51 +36,54 @@ --- Sets up the Nota commands and keybins -- @param user_configuration tNotaConfiguration the user provided configuration for the plugin -function setup(user_configuration) - local api = vim.api - local fs = vim.loop - local fn = vim.fs +local api = vim.api +local fs = vim.loop +local fn = vim.fs - if not api.nvim_create_user_command then - return - end +if not api.nvim_create_user_command then + return +end - local command = api.nvim_create_user_command +local command = api.nvim_create_user_command - local configuration = require('configuration').configure(user_configuration) +local configuration = require('nota.configuration').configuration - if configuration.default_keybinds then - local configuration = require('keybinds').bind() - end +if configuration.default_keybinds then + require('nota.keybinds').bind() +end - -- Note Handling Commands - command('NotaOpenDailyNote', function() require('notes').open_daily(configuration) end, { nargs = 0 }) - command('NotaOpenWeeklyNote', function() require('notes').open_weekly(configuration) end, { nargs = 0 }) - command('NotaOpenMonthlyNote', function() require('notes').open_monthly(configuration) end, { nargs = 0 }) - command('NotaOpenSeasonalNote', function() require('notes').open_seasonal(configuration) end, { nargs = 0 }) - command('NotaOpenYearlyNote', function() require('notes').open_yearly(configuration) end, { nargs = 0 }) - command('NotaOpenNote', function() require('notes').open(configuration) end, { nargs = 0 }) +-- Note Handling Commands +command('NotaOpenDailyNote', function(options) require('nota.notes').open_daily(options.args) end, { nargs = '?' }) +command('NotaOpenWeeklyNote', function() require('nota.notes').open_weekly() end, { nargs = 0 }) +command('NotaOpenMonthlyNote', function() require('nota.notes').open_monthly() end, { nargs = 0 }) +command('NotaOpenSeasonalNote', function() require('nota.notes').open_seasonal() end, { nargs = 0 }) +command('NotaOpenYearlyNote', function() require('nota.notes').open_yearly() end, { nargs = 0 }) +command('NotaOpenNote', function() require('nota.notes').open() end, { nargs = 0 }) +command('NotaOpenNextNote', function() require('nota.notes').open_next() end, { nargs = 0 }) +command('NotaOpenPreviousNote', function() require('nota.notes').open_previous() end, { nargs = 0 }) - -- Task View Handling Commands - command('NotaOpenAgenda', function() require('task_views').open_agenda(configuration) end, { nargs = 0 }) - command('NotaOpenOpen', function() require('task_views').open_open(configuration) end, { nargs = 0 }) - command('NotaOpenJournal', function() require('task_views').open_journal(configuration) end, { nargs = 0 }) +-- Task View Handling Commands +command('NotaOpenAgenda', function() require('nota.task_views').open_agenda() end, { nargs = 0 }) +command('NotaOpenOpen', function() require('nota.task_views').open_open() end, { nargs = 0 }) +command('NotaOpenOpenImportant', function() require('nota.task_views').open_open_important() end, { nargs = 0 }) +command('NotaOpenJournal', function() require('nota.task_views').open_journal() end, { nargs = 0 }) - -- Task Handling Commands - command('NotaToggleTask', function() require('tasks').toggle(configuration) end, { nargs = 0 }) - command('NotaInsertTask', function() require('tasks').insert(configuration) end, { nargs = 0 }) - command('NotaCaptureTask', function() require('tasks').capture(configuration) end, { nargs = 0 }) - command('NotaTagTask', function() require('tasks').tag(configuration) end, { nargs = 0 }) - command('NotaRescheduleTaskToday', function() require('tasks').reschedule_for_today(configuration) end, { nargs = 0 }) - command('NotaRescheduleTaskTomorrow', function() require('tasks').reschedule_for_tomorrow(configuration) end, { nargs = 0 }) - command('NotaRescheduleTaskSomeday', function() require('tasks').reschedule_for_someday(configuration) end, { nargs = 0 }) - command('NotaRescheduleTask', function(options) require('tasks').reschedule(configuration, options.args) end, { nargs = 1 }) +-- Task Handling Commands +command('NotaToggleTask', function() require('nota.tasks').toggle() end, { nargs = 0 }) +command('NotaToggleTaskImportance', function() require('nota.tasks').toggle_importance() end, { nargs = 0 }) +command('NotaInsertTask', function() require('nota.tasks').insert() end, { nargs = 0 }) +command('NotaCaptureTask', function() require('nota.tasks').capture() end, { nargs = 0 }) +command('NotaTagTask', function(options) require('nota.tasks').tag(options.args) end, { nargs = '?' }) +command('NotaRemoveTagTask', function(options) require('nota.tasks').remove_tag(options.args) end, { nargs = '?' }) +command('NotaRescheduleTaskToday', function() require('nota.tasks').reschedule_for_today() end, { nargs = 0 }) +command('NotaRescheduleTaskTomorrow', function() require('nota.tasks').reschedule_for_tomorrow() end, { nargs = 0 }) +command('NotaRescheduleTaskSomeday', function() require('nota.tasks').reschedule_for_someday() end, { nargs = 0 }) +command('NotaRescheduleTask', function(options) require('nota.tasks').reschedule(options.args) end, { nargs = '?' }) - -- .plan Handling Commands - command('NotaOpenPlan', function() require('plan').open(configuration) end, { nargs = 0 }) - command('NotaCapturePlan', function() require('plan').capture(configuration) end, { nargs = 0 }) +-- .plan Handling Commands +command('NotaOpenPlan', function() require('nota.plan').open() end, { nargs = 0 }) +command('NotaCapturePlan', function() require('nota.plan').capture() end, { nargs = 0 }) - -- Learning File Handling Commands - command('NotaOpenLearning', function() require('learning').open(configuration) end, { nargs = 0 }) - command('NotaCaptureLearning', function() require('learning').capture(configuration) end, { nargs = 0 }) -end +-- Learning File Handling Commands +command('NotaOpenLearning', function() require('nota.learning').open() end, { nargs = 0 }) +command('NotaCaptureLearning', function() require('nota.learning').capture() end, { nargs = 0 })