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, 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 -- Auto sync after bootstrapping on a fresh box
if packer_bootstrap ~= "" then if packer_bootstrap ~= "" then
packer.sync() packer.sync()

View File

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