Add Obsidian

This commit is contained in:
ViViDboarder 2023-10-20 16:59:19 -07:00
parent e783fde179
commit 20af7a9374
2 changed files with 34 additions and 6 deletions

View File

@ -500,6 +500,28 @@ use({
end,
})
-- Obsidian notes
use({
"epwalsh/obsidian.nvim",
requires = {
"nvim-lua/plenary.nvim",
},
tag = "v1.14.2",
config = function()
-- vim.cmd(":Git pull")
require("obsidian").setup({
workspaces = {
name = "personal",
path = "~/Documents/Obsidian",
},
})
end,
event = {
"BufRead " .. vim.fn.expand("~") .. "/Documents/Obsidian/**.md",
"BufNewFile " .. vim.fn.expand("~") .. "/Documents/Obsidian/**.md",
},
})
-- Auto sync after bootstrapping on a fresh box
if packer_bootstrap ~= "" then
packer.sync()

View File

@ -18,6 +18,8 @@ function M.config_cmp()
{ name = "luasnip" },
{ name = "buffer" },
{ name = "spell" },
{ name = "obsidian" },
{ name = "obsidian_new" },
},
mapping = cmp.mapping.preset.insert({
-- Scroll docs with readline back - forward
@ -45,12 +47,16 @@ function M.config_cmp()
})
-- Add a plug mapping to use in C-Space binding
require("utils").keymap_set(
"i",
"<Plug>(cmp_complete)",
"<cmd>lua require('cmp').complete()<CR>",
{ desc = "Autocomplete" }
)
local utils = require("utils")
utils.keymap_set("i", "<Plug>(cmp_complete)", "<cmd>lua require('cmp').complete()<CR>", { desc = "Autocomplete" })
-- Maybe add obsidian and obsidian new. This is done here in case obsidian.nvim is loaded before cmp
utils.try_require("cmp_obsidian", function(cmp_obsidian)
cmp.register_source("obsidian", cmp_obsidian.new())
end)
utils.try_require("cmp_obsidian_new", function(cmp_obsidian_new)
cmp.register_source("obsidian_new", cmp_obsidian_new.new())
end)
end
return M