generated from ellisonleao/nvim-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dneumann
committed
Feb 10, 2024
1 parent
5005478
commit ef16509
Showing
3 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# A wickedly cool wiki manager | ||
|
||
# Usage | ||
|
||
## Daily Notes | ||
|
||
Open daily note by running the WikidDaily command | ||
|
||
```lua | ||
:WikidDaily<cr> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
local dashboard_module = require("wikid.dashboard") | ||
local daily_module = require("wikid.daily") | ||
|
||
local config = { | ||
wiki_dir = "~/.wiki", | ||
daily_date_format = "%m-%d-%Y", | ||
daily_subdir = "daily" | ||
} | ||
|
||
local M = { | ||
setup_called = false | ||
setup_called = false, | ||
config = config, | ||
} | ||
|
||
M.config = config | ||
|
||
M.setup = function(args) | ||
M.setup_called = true | ||
M.config = vim.tbl_deep_extend("force", M.config, args or {}) | ||
end | ||
|
||
M.dashboard = function() | ||
assert(M.setup_called) | ||
dashboard_module.show_dashboard() | ||
if not M.setup_called then | ||
return | ||
end | ||
require("wikid.dashboard").show_dashboard() | ||
end | ||
|
||
M.daily = function() | ||
assert(M.setup_called) | ||
daily_module.open_daily_entry(M.config) | ||
if not M.setup_called then | ||
return | ||
end | ||
require("wikid.daily").open_daily_entry(M.config) | ||
end | ||
|
||
M.commands = function() | ||
local commands = { "dashboard", "daily" } | ||
vim.ui.select(commands, { prompt = "Wikid" }, function(itm) | ||
M[itm]() | ||
end) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
local wikid = require("wikid") | ||
vim.api.nvim_create_user_command("WikidDashboard", wikid.dashboard, {}) | ||
vim.api.nvim_create_user_command("WikidDaily", wikid.daily, {}) | ||
vim.api.nvim_create_user_command("WikidCommands", wikid.commands, {}) |