From 5add5d4eb693c0bfacb3887ef6c41c3b4fe8bfef Mon Sep 17 00:00:00 2001 From: 409 Date: Sat, 17 Aug 2024 18:56:23 +0200 Subject: [PATCH] feat(obsidian): obsidian telescope keys and gd to follow links --- lua/409/plugins/lsp.lua | 5 ++++ lua/409/plugins/obsidian.lua | 46 +++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/lua/409/plugins/lsp.lua b/lua/409/plugins/lsp.lua index 16d5fdb..bf95e8c 100644 --- a/lua/409/plugins/lsp.lua +++ b/lua/409/plugins/lsp.lua @@ -16,6 +16,11 @@ return { local lsp = require("lsp-zero") lsp.on_attach(function(client, bufnr) + if vim.bo[bufnr].filetype == "markdown" then + print('markdown') + return + end + local lsp_opts = { buffer = bufnr, remap = false } vim.keymap.set("n", "gd", function() diff --git a/lua/409/plugins/obsidian.lua b/lua/409/plugins/obsidian.lua index 99f4a79..5d5dbbd 100644 --- a/lua/409/plugins/obsidian.lua +++ b/lua/409/plugins/obsidian.lua @@ -1,23 +1,43 @@ return { "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit + version = "*", lazy = true, 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 👇 + }, + keys = { + { + "of", + ":ObsidianQuickSwitch", + "Find files (Obsidian)", + }, + { + "ot", + ":ObsidianTags", + "Find tags (Obsidian)", + }, + { + "ol", + ":ObsidianLinks", + "Find links (Obsidian)", + }, + { + "ow", + ":ObsidianWorkspace", + "Find workspaces (Obsidian)", + }, + { + "gd", + ":ObsidianFollowLink", + "Follow link (Obsidian)", + }, }, opts = { + preferred_link_style = "markdown", + follow_url_func = function(url) + vim.fn.jobstart({ "xdg-open", url }) + end, ui = { enable = false, }, @@ -27,7 +47,5 @@ return { path = "~/obsidian/409", }, }, - - -- see below for full list of options 👇 }, }