From: Ruben Beltran del Rio Date: Mon, 1 Jul 2024 21:06:18 +0000 (+0200) Subject: Namespace the plugin X-Git-Url: https://git.r.bdr.sh/rbdr/nota.nvim/commitdiff_plain?ds=sidebyside Namespace the plugin --- diff --git a/lua/nota.lua b/lua/nota.lua index 3043d77..6dcbdec 100644 --- a/lua/nota.lua +++ b/lua/nota.lua @@ -1,7 +1,7 @@ local Nota = {} function Nota.setup(user_configuration) - configuration = require('configuration').configure(user_configuration) + configuration = require('nota.configuration').configure(user_configuration) end return Nota diff --git a/lua/configuration.lua b/lua/nota/configuration.lua similarity index 99% rename from lua/configuration.lua rename to lua/nota/configuration.lua index f251eb9..4eb1a12 100644 --- a/lua/configuration.lua +++ b/lua/nota/configuration.lua @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------- local Configuration = {} -local Util = require('util') +local Util = require('nota.util') ------------------------------------------------------------------------------- -- Internal Functions ------------------------------------------------------------------------------- diff --git a/lua/keybinds.lua b/lua/nota/keybinds.lua similarity index 100% rename from lua/keybinds.lua rename to lua/nota/keybinds.lua diff --git a/lua/learning.lua b/lua/nota/learning.lua similarity index 92% rename from lua/learning.lua rename to lua/nota/learning.lua index b730c6a..22ad325 100644 --- a/lua/learning.lua +++ b/lua/nota/learning.lua @@ -3,8 +3,8 @@ ------------------------------------------------------------------------------- local Learning = {} -local Configuration = require('configuration') -local Util = require('util') +local Configuration = require('nota.configuration') +local Util = require('nota.util') ------------------------------------------------------------------------------- -- Internal Functions ------------------------------------------------------------------------------- diff --git a/lua/notes.lua b/lua/nota/notes.lua similarity index 98% rename from lua/notes.lua rename to lua/nota/notes.lua index ca61735..abb1bf7 100644 --- a/lua/notes.lua +++ b/lua/nota/notes.lua @@ -3,8 +3,8 @@ ------------------------------------------------------------------------------- local Notes = {} -local Util = require('util') -local Configuration = require('configuration') +local Util = require('nota.util') +local Configuration = require('nota.configuration') local api = vim.api ------------------------------------------------------------------------------- -- Internal Functions diff --git a/lua/plan.lua b/lua/nota/plan.lua similarity index 96% rename from lua/plan.lua rename to lua/nota/plan.lua index 477ff9a..85f32ba 100644 --- a/lua/plan.lua +++ b/lua/nota/plan.lua @@ -3,8 +3,8 @@ ------------------------------------------------------------------------------- local Plan = {} -local Configuration = require('configuration') -local Util = require('util') +local Configuration = require('nota.configuration') +local Util = require('nota.util') ------------------------------------------------------------------------------- -- Internal Functions ------------------------------------------------------------------------------- diff --git a/lua/task_views.lua b/lua/nota/task_views.lua similarity index 98% rename from lua/task_views.lua rename to lua/nota/task_views.lua index 9309ad3..a088aa9 100644 --- a/lua/task_views.lua +++ b/lua/nota/task_views.lua @@ -2,8 +2,8 @@ -- Tools to deal with task views ------------------------------------------------------------------------------- local TaskViews = {} -local Util = require('util') -local Configuration = require('configuration') +local Util = require('nota.util') +local Configuration = require('nota.configuration') local api = vim.api ------------------------------------------------------------------------------- -- Internal Functions diff --git a/lua/tasks.lua b/lua/nota/tasks.lua similarity index 98% rename from lua/tasks.lua rename to lua/nota/tasks.lua index 33fce8f..f2a3ef1 100644 --- a/lua/tasks.lua +++ b/lua/nota/tasks.lua @@ -2,9 +2,9 @@ -- Tools to deal with tasks ------------------------------------------------------------------------------- local Tasks = {} -local Configuration = require('configuration') -local Notes = require('notes') -local Util = require('util') +local Configuration = require('nota.configuration') +local Notes = require('nota.notes') +local Util = require('nota.util') local api = vim.api ------------------------------------------------------------------------------- -- Internal Functions diff --git a/lua/util.lua b/lua/nota/util.lua similarity index 100% rename from lua/util.lua rename to lua/nota/util.lua diff --git a/plugin/nota.lua b/plugin/nota.lua index 180c84d..1864deb 100644 --- a/plugin/nota.lua +++ b/plugin/nota.lua @@ -46,44 +46,44 @@ end local command = api.nvim_create_user_command -local configuration = require('configuration').configuration +local configuration = require('nota.configuration').configuration if configuration.default_keybinds then - require('keybinds').bind() + require('nota.keybinds').bind() end -- Note Handling Commands -command('NotaOpenDailyNote', function(options) require('notes').open_daily(options.args) end, { nargs = '?' }) -command('NotaOpenWeeklyNote', function() require('notes').open_weekly() end, { nargs = 0 }) -command('NotaOpenMonthlyNote', function() require('notes').open_monthly() end, { nargs = 0 }) -command('NotaOpenSeasonalNote', function() require('notes').open_seasonal() end, { nargs = 0 }) -command('NotaOpenYearlyNote', function() require('notes').open_yearly() end, { nargs = 0 }) -command('NotaOpenNote', function() require('notes').open() end, { nargs = 0 }) -command('NotaOpenNextNote', function() require('notes').open_next() end, { nargs = 0 }) -command('NotaOpenPreviousNote', function() require('notes').open_previous() end, { nargs = 0 }) +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() end, { nargs = 0 }) -command('NotaOpenOpen', function() require('task_views').open_open() end, { nargs = 0 }) -command('NotaOpenOpenImportant', function() require('task_views').open_open_important() end, { nargs = 0 }) -command('NotaOpenJournal', function() require('task_views').open_journal() end, { nargs = 0 }) +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() end, { nargs = 0 }) -command('NotaToggleTaskImportance', function() require('tasks').toggle_importance() end, { nargs = 0 }) -command('NotaInsertTask', function() require('tasks').insert() end, { nargs = 0 }) -command('NotaCaptureTask', function() require('tasks').capture() end, { nargs = 0 }) -command('NotaTagTask', function(options) require('tasks').tag(options.args) end, { nargs = '?' }) -command('NotaRemoveTagTask', function(options) require('tasks').remove_tag(options.args) end, { nargs = '?' }) -command('NotaRescheduleTaskToday', function() require('tasks').reschedule_for_today() end, { nargs = 0 }) -command('NotaRescheduleTaskTomorrow', function() require('tasks').reschedule_for_tomorrow() end, { nargs = 0 }) -command('NotaRescheduleTaskSomeday', function() require('tasks').reschedule_for_someday() end, { nargs = 0 }) -command('NotaRescheduleTask', function(options) require('tasks').reschedule(options.args) end, { nargs = '?' }) +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() end, { nargs = 0 }) -command('NotaCapturePlan', function() require('plan').capture() end, { nargs = 0 }) +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() end, { nargs = 0 }) -command('NotaCaptureLearning', function() require('learning').capture() end, { nargs = 0 }) +command('NotaOpenLearning', function() require('nota.learning').open() end, { nargs = 0 }) +command('NotaCaptureLearning', function() require('nota.learning').capture() end, { nargs = 0 })