Skip to content

Commit

Permalink
nvim: update obsidian conf
Browse files Browse the repository at this point in the history
  • Loading branch information
gwarf committed Jan 9, 2025
1 parent 091ed02 commit bc5dcd8
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 115 deletions.
230 changes: 115 additions & 115 deletions home/private_dot_config/nvim/lua/plugins/obsidian-long.lua.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,118 +3,118 @@
-- M.vault_path = { { .obsidian.vault | quote }}
-- M.notes_path = vim.fn.expand(M.vault_path .. "/Meeting_notes")
-- M.scratchpad_path = vim.fn.expand(M.vault_path .. "/scratchpad.md")
--
-- return {
-- "epwalsh/obsidian.nvim",
-- lazy = true,
-- dependencies = {
-- -- required
-- "nvim-lua/plenary.nvim",
--
-- -- optional
-- "nvim-telescope/telescope.nvim",
-- "nvim-treesitter/nvim-treesitter",
--
-- {
-- "saghen/blink.cmp",
-- dependencies = {
-- { "saghen/blink.compat", branch = "main" },
-- },
-- opts = {
-- sources = {
-- default = { "obsidian", "obsidian_new", "obsidian_tags" },
-- providers = {
-- obsidian = {
-- name = "obsidian",
-- module = "blink.compat.source",
-- },
-- obsidian_new = {
-- name = "obsidian_new",
-- module = "blink.compat.source",
-- },
-- obsidian_tags = {
-- name = "obsidian_tags",
-- module = "blink.compat.source",
-- },
-- },
-- },
-- },
-- opts_extend = {
-- "sources.default",
-- },
-- },
-- },
-- enabled = function()
-- -- only enable on macOS for now, and if vault_path exists
-- return vim.fn.has("mac") == 1 and vim.fn.isdirectory(M.vault_path) == 1
-- end,
-- version = "*",
-- -- 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"
-- -- "BufReadPre path/to/my-vault/**.md",
-- -- "BufNewFile path/to/my-vault/**.md",
-- -- },
-- opts = {
-- workspaces = {
-- {
-- name = "personal",
-- path = M.vault_path,
-- },
-- },
--
-- -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp.
-- completion = {
-- -- Set to false to disable completion.
-- nvim_cmp = false, -- NOTE: use blink.cmp instead
-- -- Trigger completion at 2 chars.
-- min_chars = 2,
-- },
--
-- -- Specify how to handle attachments.
-- attachments = {
-- -- The default folder to place images in via `:ObsidianPasteImg`.
-- -- If this is a relative path it will be interpreted as relative to the vault root.
-- -- You can always override this per image by passing a full path to the command instead of just a filename.
-- img_folder = "Files",
-- -- A function that determines the text to insert in the note when pasting an image.
-- -- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
-- -- This is the default implementation.
-- ---@param client obsidian.Client
-- ---@param path obsidian.Path the absolute path to the image file
-- ---@return string
-- img_text_func = function(client, path)
-- path = client:vault_relative_path(path) or path
-- return string.format("![%s](%s)", path.name, path)
-- end,
-- },
--
-- templates = {
-- folder = "Templates",
-- date_format = "%Y-%m-%d",
-- time_format = "%H:%M",
-- -- A map for custom variables, the key should be the variable and the value a function
-- substitutions = {},
-- },
--
-- 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'
-- 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,
-- },
-- keys = require("config.keymaps").setup_obsidian_keymaps(M),
-- cmd = { "ObsidianSearch", "ObsidianQuickSwitch", "ObsidianNew" },
-- }

return {
-- "epwalsh/obsidian.nvim",
-- lazy = true,
-- dependencies = {
-- -- required
-- "nvim-lua/plenary.nvim",
--
-- -- optional
-- "nvim-telescope/telescope.nvim",
-- "nvim-treesitter/nvim-treesitter",
--
-- {
-- "saghen/blink.cmp",
-- dependencies = {
-- { "saghen/blink.compat", branch = "main" },
-- },
-- opts = {
-- sources = {
-- default = { "obsidian", "obsidian_new", "obsidian_tags" },
-- providers = {
-- obsidian = {
-- name = "obsidian",
-- module = "blink.compat.source",
-- },
-- obsidian_new = {
-- name = "obsidian_new",
-- module = "blink.compat.source",
-- },
-- obsidian_tags = {
-- name = "obsidian_tags",
-- module = "blink.compat.source",
-- },
-- },
-- },
-- },
-- opts_extend = {
-- "sources.default",
-- },
-- },
-- },
-- enabled = function()
-- -- only enable on macOS for now, and if vault_path exists
-- return vim.fn.has("mac") == 1 and vim.fn.isdirectory(M.vault_path) == 1
-- end,
-- version = "*",
-- -- 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"
-- -- "BufReadPre path/to/my-vault/**.md",
-- -- "BufNewFile path/to/my-vault/**.md",
-- -- },
-- opts = {
-- workspaces = {
-- {
-- name = "personal",
-- path = M.vault_path,
-- },
-- },
--
-- -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp.
-- completion = {
-- -- Set to false to disable completion.
-- nvim_cmp = false, -- NOTE: use blink.cmp instead
-- -- Trigger completion at 2 chars.
-- min_chars = 2,
-- },
--
-- -- Specify how to handle attachments.
-- attachments = {
-- -- The default folder to place images in via `:ObsidianPasteImg`.
-- -- If this is a relative path it will be interpreted as relative to the vault root.
-- -- You can always override this per image by passing a full path to the command instead of just a filename.
-- img_folder = "Files",
-- -- A function that determines the text to insert in the note when pasting an image.
-- -- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
-- -- This is the default implementation.
-- ---@param client obsidian.Client
-- ---@param path obsidian.Path the absolute path to the image file
-- ---@return string
-- img_text_func = function(client, path)
-- path = client:vault_relative_path(path) or path
-- return string.format("![%s](%s)", path.name, path)
-- end,
-- },
--
-- templates = {
-- folder = "Templates",
-- date_format = "%Y-%m-%d",
-- time_format = "%H:%M",
-- -- A map for custom variables, the key should be the variable and the value a function
-- substitutions = {},
-- },
--
-- 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'
-- 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,
-- },
-- keys = require("config.keymaps").setup_obsidian_keymaps(M),
-- cmd = { "ObsidianSearch", "ObsidianQuickSwitch", "ObsidianNew" },
}
4 changes: 4 additions & 0 deletions home/private_dot_config/nvim/lua/plugins/obsidian.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
-- https://github.com/mmai/dotfiles/blob/master/.config/LazyVim/lua/plugins/markdown.lua
-- TODO: check and merge useful bits from other configurations
-- https://github.com/Gentleman-Programming/Gentleman.Dots/blob/main/GentlemanNvim/nvim/lua/plugins/obsidian.lua
-- https://github.com/epwalsh/obsidian.nvim/issues/770
-- https://github.com/maxclax/dotfiles/blob/main/private_dot_config/nvim-custom/lua/plugins/obsidian.lua.tmpl
return {
-- Blink Auto-completion for Obsidian (replace nvim_cmp)
{
Expand Down

0 comments on commit bc5dcd8

Please sign in to comment.