Add obsidian support

This commit is contained in:
2025-02-05 21:01:20 +02:00
parent 0110e31a7d
commit 464e342e58
10 changed files with 170 additions and 51 deletions

View File

@@ -79,12 +79,32 @@ vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
end,
}) ]]
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
group = vim.api.nvim_create_augroup("AutoReloadConfig", { clear = true }),
pattern = { "**/eww.yuck", "**/eww.scss" },
callback = function()
vim.fn.system("eww reload")
end,
})
vim.filetype.add({
pattern = {
[".*/hypr/.*%.conf"] = "hyprlang",
},
})
-- Hyprlang LSP
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.hl", "hypr*.conf" },
callback = function(_)
vim.lsp.start({
name = "hyprlang",
cmd = { "hyprls" },
root_dir = vim.fn.getcwd(),
})
end,
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
if vim.env.TMUX_PLUGIN_MANAGER_PATH then

View File

@@ -5,8 +5,10 @@ return {
"folke/lazydev.nvim",
"echasnovski/mini.icons",
{ "L3MON4D3/LuaSnip", version = "v2.*" },
"Saecki/crates.nvim",
"davidsierradz/cmp-conventionalcommits",
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
},
{
"Kaiser-Yang/blink-cmp-git",
dependencies = { "nvim-lua/plenary.nvim" },
@@ -21,6 +23,14 @@ return {
ft = { "sql", "mysql", "plsql" },
opts = {},
},
{
"epwalsh/obsidian.nvim",
event = "BufReadPre " .. vim.fn.expand("~") .. "/Obsidian/**/*.md",
},
{
"kiyoon/jupynium.nvim",
event = "BufReadPre *.ju.py",
},
},
version = "*",
opts = {
@@ -64,6 +74,9 @@ return {
"dbee",
"snippets",
"ripgrep",
"obsidian",
"markdown",
"jupynium",
},
providers = {
lazydev = {
@@ -81,6 +94,17 @@ return {
module = "blink.compat.source",
score_offset = 50,
},
obsidian = {
name = "obsidian",
module = "blink.compat.source",
score_offset = 10,
},
markdown = {
name = "RenderMarkdown",
module = "render-markdown.integ.blink",
score_offset = 10,
fallbacks = { "lsp" },
},
ripgrep = {
module = "blink-ripgrep",
name = "Ripgrep",
@@ -103,7 +127,7 @@ return {
jupynium = {
name = "jupynium",
module = "blink.compat.source",
score_offset = 100,
score_offset = 1000,
},
git = {
score_offset = 100,
@@ -113,7 +137,7 @@ return {
should_show_items = function()
return vim.o.filetype == "gitcommit" or vim.o.filetype == "markdown"
end,
-- opts = {},
opts = {},
},
},
},

View File

@@ -1,8 +1,7 @@
return {
"3rd/image.nvim",
enabled = false,
opts = {
backend = "ueberzug",
backend = "kitty",
processor = "magick_rock", -- or "magick_cli"
integrations = {
markdown = {

23
lua/plugins/jupynium.lua Normal file
View File

@@ -0,0 +1,23 @@
return {
{
"kiyoon/jupynium.nvim",
dependencies = {
"rcarriga/nvim-notify", -- optional
-- "stevearc/dressing.nvim", -- optional, UI for :JupyniumKernelSelect
},
build = "uv tool install .",
event = "BufReadPre *.ju.py",
opts = {
python_host = { "uvx", "jupynium", "python" },
},
config = function(_, opts)
require("jupynium").setup(opts)
require("jupynium").get_folds()
end,
},
{
"goerz/jupytext.nvim",
version = "*",
opts = {},
},
}

View File

@@ -26,12 +26,6 @@ return {
})
end
for server, config in pairs(opts.servers) do
local capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
config.capabilities = extend_capabilities(capabilities)
lspconfig[server].setup(config)
end
local default_setup = function(server)
local capabilities = require("blink.cmp").get_lsp_capabilities()
lspconfig[server].setup({
@@ -136,7 +130,7 @@ return {
"clangd",
"cmake",
"cssls",
"emmet_ls",
"emmet_language_server",
"html",
-- "jedi_language_server",
"lua_ls",
@@ -150,6 +144,12 @@ return {
ts_ls = function() end,
},
})
for server, config in pairs(opts.servers) do
local capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
config.capabilities = extend_capabilities(capabilities)
lspconfig[server].setup(config)
end
end,
opts = {
@@ -228,19 +228,6 @@ return {
"zsh",
},
},
emmet_ls = {
filetypes = {
"html",
"htmldjango",
"typescriptreact",
"javascriptreact",
"css",
"sass",
"scss",
"less",
"eruby",
},
},
texlab = {
texlab = {
auxDirectory = ".",
@@ -266,9 +253,9 @@ return {
},
},
},
htmx = {
filetypes = { "html", "htmldjango", "templ" },
},
-- htmx = {
-- filetypes = { "html", "htmldjango", "templ" },
-- },
--[[ pylyzer = {
settings = {
python = {

View File

@@ -93,4 +93,9 @@ return {
},
},
},
{
"MeanderingProgrammer/render-markdown.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" },
opts = {},
},
}

View File

@@ -10,7 +10,6 @@ return {
typescriptreact = js,
python = { "mypy" },
htmldjango = { "djlint" },
html = { "djlint" },
lua = { "selene" },
cmake = { "cmakelint" },
["*"] = { "codespell", "typos" },

56
lua/plugins/obsidian.lua Normal file
View File

@@ -0,0 +1,56 @@
return {
"epwalsh/obsidian.nvim",
version = "*",
lazy = true,
event = "BufReadPre " .. vim.fn.expand("~") .. "/Obsidian/**/*.md",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
opts = {
workspaces = {
{
name = "university",
path = "~/Obsidian/university",
},
{
name = "personal",
path = "~/Obsidian/personal",
},
{
name = "work",
path = "~/Obsidian/work",
},
},
templates = {
folder = "templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M:%S",
},
attachments = {
-- The default folder to place images in via `:ObsidianPasteImg`.
-- If this is a relative path it will be interpreted as relative to the vault root.
-- You can always override this per image by passing a full path to the command instead of just a filename.
img_folder = "assets/img",
-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
---@return string
img_name_func = function()
print(os.time())
return string.format("%s-", os.time())
end,
-- A function that determines the text to insert in the note when pasting an image.
-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
-- This is the default implementation.
---@param client obsidian.Client
---@param path obsidian.Path the absolute path to the image file
---@return string
img_text_func = function(client, path)
path = client:vault_relative_path(path) or path
return string.format("![%s](../%s)", path.name, path)
end,
},
},
}

View File

@@ -13,7 +13,7 @@ return {
end,
settings = {
-- spawn additional tsserver instance to calculate diagnostics on it
separate_diagnostic_server = false,
separate_diagnostic_server = true,
-- "change"|"insert_leave" determine when the client asks the server about diagnostic
publish_diagnostic_on = "insert_leave",
-- array of strings("fix_all"|"add_missing_imports"|"remove_unused"|
@@ -23,7 +23,7 @@ return {
expose_as_code_action = "all",
-- string|nil - specify a custom path to `tsserver.js` file, if this is nil or file under path
-- not exists then standard path resolution strategy is applied
tsserver_path = nil,
tsserver_path = "tsserver",
-- specify a list of plugins to load by tsserver, e.g., for support `styled-components`
-- (see 💅 `styled-components` support section)
tsserver_plugins = {
@@ -79,5 +79,6 @@ return {
opts = {},
event = "VeryLazy",
enabled = vim.fn.has("nvim-0.10.0") == 1,
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
},
}