aboutsummaryrefslogtreecommitdiff
path: root/lua/simple-denote
diff options
context:
space:
mode:
authorDefaultGen <gravel.justness270@slmail.me>2024-06-06 04:45:03 -0400
committerDefaultGen <gravel.justness270@slmail.me>2024-06-06 04:45:03 -0400
commitdd178bb90f501297c3b5e714f95d0f233a4303a4 (patch)
tree5518aea5db95c27e44036cf3f5ff823885d77f87 /lua/simple-denote
parentcfcc416696167f560e8c08c41b888e1b891c0c4c (diff)
downloadsimple-denote.nvim-dd178bb90f501297c3b5e714f95d0f233a4303a4.tar.gz
Manual install section
Diffstat (limited to 'lua/simple-denote')
-rw-r--r--lua/simple-denote/config.lua2
-rw-r--r--lua/simple-denote/init.lua46
2 files changed, 1 insertions, 47 deletions
diff --git a/lua/simple-denote/config.lua b/lua/simple-denote/config.lua
index ad7dffc..efd69c0 100644
--- a/lua/simple-denote/config.lua
+++ b/lua/simple-denote/config.lua
@@ -5,7 +5,7 @@ M.defaults = {
dir = "~/notes/",
add_heading = true,
retitle_heading = true,
- heading_char = ""
+ heading_char = "" -- This gets set automatically
}
M.options = M.defaults
diff --git a/lua/simple-denote/init.lua b/lua/simple-denote/init.lua
deleted file mode 100644
index 3f199fe..0000000
--- a/lua/simple-denote/init.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-local M = {}
-
-local api = require("simple-denote.api")
-local config = require("simple-denote.config")
-
-function M.load_cmd(options)
- vim.api.nvim_create_user_command("Denote", function(opts)
- if opts.fargs[1] == "note" then
- api.note(options)
- elseif opts.fargs[1] == "title" then
- api.title(options)
- elseif opts.fargs[1] == "tag" then
- api.tag(options)
- elseif opts.fargs[1] == "signature" then
- api.signature(options)
- else
- error("Unsupported operation " .. opts.fargs[1])
- end
- end, {
- nargs = 1,
- complete = function()
- return { "note", "title", "tag", "signature" }
- end,
- })
-end
-
----Add / to directory if necessary and set the heading_char based on the ext
-function M.fix_options()
- if config.options.dir:sub(-1) ~= "/" then
- config.options.dir = config.options.dir .. "/"
- end
- if config.options.ext == "md" then
- config.options.heading_char = "#"
- elseif config.options.ext == "org" or config.options.ext == "norg" then
- config.options.heading_char = "*"
- end
-end
-
----@param options? table user configuration
-function M.setup(options)
- config.options = vim.tbl_deep_extend("force", config.defaults, options or {})
- M.fix_options()
- M.load_cmd(config.options)
-end
-
-return M