forked from ayamir/nvimdots
-
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
Showing
8 changed files
with
84 additions
and
22 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
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
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
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
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,44 @@ | ||
return function(_, opts) | ||
require("obsidian").setup(opts) | ||
return function() | ||
require("obsidian").setup({ | ||
dir = "/Users/tonywu/Library/Mobile Documents/com~apple~CloudDocs/MPhil/Work/Final_thesis", | ||
completion = { | ||
-- 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", | ||
prepend_note_id = false, | ||
}, | ||
note_id_func = function(title) | ||
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix. | ||
-- In this case a note with the title 'My new note' will given an ID that looks | ||
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' | ||
local suffix = "" | ||
if title ~= nil then | ||
-- If title is given, transform it into valid file name. | ||
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() | ||
else | ||
-- If title is nil, just add 4 random uppercase letters to the suffix. | ||
for _ = 1, 4 do | ||
suffix = suffix .. string.char(math.random(65, 90)) | ||
end | ||
end | ||
return tostring(os.time()) .. "-" .. suffix | ||
end, | ||
note_frontmatter_func = function(note) | ||
-- This is equivalent to the default frontmatter function. | ||
local out = { id = note.id, aliases = note.aliases, tags = note.tags, todos = note.todos } | ||
-- `note.metadata` contains any manually added fields in the frontmatter. | ||
-- So here we just make sure those fields are kept in the frontmatter. | ||
if note.metadata ~= nil and require("obsidian").util.table_length(note.metadata) > 0 then | ||
for k, v in pairs(note.metadata) do | ||
out[k] = v | ||
end | ||
end | ||
return out | ||
end, | ||
}) | ||
end |
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
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
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