105 lines
3.6 KiB
Lua
105 lines
3.6 KiB
Lua
vim.opt.conceallevel = 1
|
|
|
|
plugin({
|
|
"obsidian-nvim/obsidian.nvim",
|
|
version = "*", -- recommended, use latest release instead of latest commit
|
|
lazy = false,
|
|
ft = "markdown",
|
|
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
|
-- event = {
|
|
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
|
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
|
-- -- refer to `:h file-pattern` for more examples
|
|
-- "BufReadPre path/to/my-vault/*.md",
|
|
-- "BufNewFile path/to/my-vault/*.md",
|
|
-- },
|
|
dependencies = {
|
|
-- Required.
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
-- see below for full list of optional dependencies 👇
|
|
},
|
|
opts = {
|
|
legacy_commands = false,
|
|
workspaces = {
|
|
{
|
|
name = "personal",
|
|
path = "~/Documents/obsidian/Personal",
|
|
},
|
|
{
|
|
name = "Quikserve",
|
|
path = "~/Documents/obsidian/Quikserve",
|
|
},
|
|
{
|
|
name = "Visage",
|
|
path = "~/Documents/obsidian/Visage",
|
|
},
|
|
},
|
|
notes_subdir = "notes",
|
|
new_notes_location = "notes_subdir",
|
|
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 be given an ID that looks
|
|
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'.
|
|
-- You may have as many periods in the note ID as you'd like—the ".md" will be added automatically
|
|
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
|
|
prefix = os.date("%Y%m%d%H%M")
|
|
return tostring(prefix .. "-" .. suffix)
|
|
end,
|
|
daily_notes = {
|
|
-- Optional, if you keep daily notes in a separate directory.
|
|
folder = "dailies",
|
|
-- Optional, if you want to change the date format for the ID of daily notes.
|
|
date_format = "%Y-%m-%d",
|
|
-- Optional, if you want to change the date format of the default alias of daily notes.
|
|
alias_format = "%B %-d, %Y",
|
|
-- Optional, default tags to add to each new daily note created.
|
|
default_tags = { "daily-notes" },
|
|
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
|
|
template = "daily",
|
|
},
|
|
templates = {
|
|
folder = "templates",
|
|
date_format = "%Y-%m-%d-%a",
|
|
time_format = "%H:%M",
|
|
},
|
|
completion = {
|
|
blink = true,
|
|
},
|
|
picker = {
|
|
-- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'.
|
|
name = "snacks.pick",
|
|
-- Optional, configure key mappings for the picker. These are the defaults.
|
|
-- Not all pickers support all mappings.
|
|
note_mappings = {
|
|
-- Create a new note from your query.
|
|
new = "<C-x>",
|
|
-- Insert a link to the selected note.
|
|
insert_link = "<C-l>",
|
|
},
|
|
tag_mappings = {
|
|
-- Add tag(s) to current note.
|
|
tag_note = "<C-x>",
|
|
-- Insert a tag at the current location.
|
|
insert_tag = "<C-l>",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
map("n", "<leader>ot", "<cmd>:Obsidian today<cr>", { desc = "Today Note" })
|
|
map("n", "<leader>on", "<cmd>:Obsidian new<cr>", { desc = "New Note" })
|
|
map("n", "<leader>oN", "<cmd>:Obsidian new_from_template<cr>", { desc = "New From Template" })
|
|
map("n", "<leader>ow", "<cmd>:Obsidian workspace<cr>", { desc = "Change Workspace" })
|
|
map("n", "<leader>oo", "<cmd>::Obsidian quick_switch<cr>", { desc = "Find Note" })
|
|
map("n", "<leader>os", "<cmd>!./sync.sh<cr>", { desc = "Sync" })
|