From 58cde2e721f34a79f6ad5b4033ff6ad5a8384f21 Mon Sep 17 00:00:00 2001 From: Shaun Setlock Date: Tue, 1 Jul 2025 20:07:49 -0400 Subject: [PATCH] Add plugin for obsidian integration. --- nvim/lua/plugins/obsidian.lua | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 nvim/lua/plugins/obsidian.lua diff --git a/nvim/lua/plugins/obsidian.lua b/nvim/lua/plugins/obsidian.lua new file mode 100644 index 0000000..7f55c82 --- /dev/null +++ b/nvim/lua/plugins/obsidian.lua @@ -0,0 +1,69 @@ +return { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + -- Below will load the plugin for all markdown files. + -- ft = "markdown", + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + event = { + "BufReadPre /home/shaun/Obsidian/*.md", + "BufNewFile /home/shaun/Obsidian/*.md", + }, + dependencies = { + -- Required. + "nvim-lua/plenary.nvim", + -- Recommended. + "hrsh7th/nvim-cmp", + "nvim-telescope/telescope.nvim", + "nvim-treesitter/nvim-treesitter", + }, + + opts = { + workspaces = { + { + name = "Obsidian", + path = "~/Obsidian", + }, + }, + + -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp. + completion = { + -- Set to false to disable completion. + nvim_cmp = true, + -- Trigger completion at 4 chars. + min_chars = 4, + }, + + -- Optional, configure key mappings. These are the defaults. If you don't want to set any keymappings this + -- way then set 'mappings = {}'. + mappings = { + -- Overrides the 'gf' mapping to work on markdown/wiki links within your vault. + ["gf"] = { + action = function() + return require("obsidian").util.gf_passthrough() + end, + opts = { noremap = false, expr = true, buffer = true }, + }, + -- Toggle check-boxes. + ["ch"] = { + action = function() + return require("obsidian").util.toggle_checkbox() + end, + opts = { buffer = true }, + }, + -- Smart action depending on context, either follow link or toggle checkbox. + [""] = { + action = function() + return require("obsidian").util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, + + -- Optional, configure additional syntax highlighting / extmarks. + -- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details. + ui = { + enable = false, -- set to false to disable all additional syntax features + }, + }, +}