From 6da70dfbb36179c3933184a7b9324f00ba8d6798 Mon Sep 17 00:00:00 2001 From: Nicholai Date: Wed, 4 Feb 2026 23:49:16 -0700 Subject: [PATCH] add plugin for obsidian, markdown rendering & scrolloff settings --- lazy-lock.json | 2 + lua/core/options.lua | 2 + lua/plugins/notes.lua | 97 +++++++++++++++++++++++++++++++++++++++++++ lua/plugins/ui.lua | 1 + 4 files changed, 102 insertions(+) create mode 100644 lua/plugins/notes.lua diff --git a/lazy-lock.json b/lazy-lock.json index a30a67b..d1ef149 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,8 +27,10 @@ "nvim-tree.lua": { "branch": "master", "commit": "037d89e60fb01a6c11a48a19540253b8c72a3c32" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, + "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "pywal": { "branch": "main", "commit": "d11b673c0e3d6eb8cbee7ea8cf4a8911f6ee24b9" }, + "render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" }, "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, diff --git a/lua/core/options.lua b/lua/core/options.lua index 4075f48..583de74 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -13,6 +13,8 @@ vim.opt.termguicolors = true vim.opt.cursorline = true vim.opt.signcolumn = 'yes' vim.opt.clipboard = "unnamedplus" +vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 8 -- Leader key vim.g.mapleader = ' ' diff --git a/lua/plugins/notes.lua b/lua/plugins/notes.lua new file mode 100644 index 0000000..686512d --- /dev/null +++ b/lua/plugins/notes.lua @@ -0,0 +1,97 @@ +return { + -- Obsidian integration + { + "epwalsh/obsidian.nvim", + version = "*", + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + "hrsh7th/nvim-cmp", + }, + opts = { + workspaces = { + { + name = "vault", + path = "/mnt/work/obsidian-vault/", + }, + }, + completion = { + nvim_cmp = true, + min_chars = 2, + }, + mappings = { + ["gf"] = { + action = function() + return require("obsidian").util.gf_passthrough() + end, + opts = { noremap = false, expr = true, buffer = true }, + }, + ["oc"] = { + action = function() + return require("obsidian").util.toggle_checkbox() + end, + opts = { buffer = true, desc = "Toggle checkbox" }, + }, + }, + new_notes_location = "current_dir", + wiki_link_func = function(opts) + return string.format("[[%s]]", opts.path) + end, + note_id_func = function(title) + -- use title as-is for note IDs (no date prefix) + if title ~= nil then + return title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + return tostring(os.time()) + end + end, + ui = { + enable = false, -- using render-markdown instead + }, + }, + keys = { + { "oo", "ObsidianQuickSwitch", desc = "Obsidian: Quick switch" }, + { "on", "ObsidianNew", desc = "Obsidian: New note" }, + { "os", "ObsidianSearch", desc = "Obsidian: Search" }, + { "ob", "ObsidianBacklinks", desc = "Obsidian: Backlinks" }, + { "ot", "ObsidianTags", desc = "Obsidian: Tags" }, + { "od", "ObsidianToday", desc = "Obsidian: Daily note" }, + { "ol", "ObsidianLink", mode = "v", desc = "Obsidian: Link selection" }, + }, + }, + + -- Render markdown in buffer + { + "MeanderingProgrammer/render-markdown.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + ft = { "markdown", "Avante" }, + opts = { + heading = { + enabled = true, + icons = { "󰲡 ", "󰲣 ", "󰲥 ", "󰲧 ", "󰲩 ", "󰲫 " }, + }, + code = { + enabled = true, + style = "full", + border = "thin", + }, + bullet = { + enabled = true, + icons = { "●", "○", "◆", "◇" }, + }, + checkbox = { + enabled = true, + unchecked = { icon = "󰄱 " }, + checked = { icon = "󰄵 " }, + }, + quote = { enabled = true }, + pipe_table = { enabled = true }, + link = { enabled = true }, + }, + }, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 9110bee..7d9ca80 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -78,6 +78,7 @@ return { { "9f", desc = "Fill Function" }, { "9v", desc = "Visual AI" }, { "9s", desc = "Stop requests" }, + { "o", group = "Obsidian" }, }) end, },