Skip to content

Commit

Permalink
document new options in README
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Jun 27, 2023
1 parent 3e9e127 commit c852dce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ return {
-- Optional, if you keep notes in a specific subdirectory of your vault.
notes_subdir = "notes",

-- Optional, set the log level for Obsidian. This is an integer corresponding to one of the log
-- levels defined by "vim.log.levels.*" or nil, which is equivalent to DEBUG (1).
log_level = vim.log.levels.DEBUG,

daily_notes = {
-- Optional, if you keep daily notes in a separate directory.
folder = "notes/dailies",
Expand All @@ -92,7 +96,14 @@ return {

-- Optional, completion.
completion = {
nvim_cmp = true, -- if using nvim-cmp, otherwise set to false
-- If using nvim-cmp, otherwise set to false
nvim_cmp = true,
-- Trigger completion at 2 chars
min_chars = 2,
-- Where to put new notes created from completion. Valid options are
-- * "current_dir" - put new notes in same directory as the current buffer
-- * "notes_subdir" - put new notes in the default notes subdirectory.
new_notes_location = "current_dir"
},

-- Optional, customize how names/IDs for new notes are created.
Expand Down
2 changes: 1 addition & 1 deletion lua/cmp_obsidian_new.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ source.execute = function(_, item, callback)
---@type obsidian.Client
local client = obsidian.new(data.opts)
local dir = vim.fn.expand "%:p:h"
if client.opts.completion.new_notes_location == "notes_subdir" then
if client.opts.completion ~= nil and client.opts.completion.new_notes_location == "notes_subdir" then
dir = nil
end
client:new_note(data.title, data.id, dir)
Expand Down

0 comments on commit c852dce

Please sign in to comment.