This commit is contained in:
Alfarel 2025-11-05 22:24:27 +00:00 committed by GitHub
commit 421e04c130
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 129 additions and 57 deletions

View file

@ -214,7 +214,6 @@ isMaximal: {
};
notes = {
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
neorg.enable = false;
orgmode.enable = false;
mind-nvim.enable = isMaximal;

View file

@ -19,10 +19,6 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
# flake.nix
{
inputs = {
# Optional, if you intend to follow nvf's obsidian-nvim input
# you must also add it as a flake input.
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
# Required, nvf works best and only directly supports flakes
nvf = {
url = "github:NotAShelf/nvf";
@ -30,9 +26,6 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
# instance of nixpkgs. This is safe to do as nvf does not depend
# on a binary cache.
inputs.nixpkgs.follows = "nixpkgs";
# Optionally, you can also override individual plugins
# for example:
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
};
# ...

View file

@ -19,10 +19,6 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
# flake.nix
{
inputs = {
# Optional, if you intend to follow nvf's obsidian-nvim input
# you must also add it as a flake input.
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
# Required, nvf works best and only directly supports flakes
nvf = {
url = "github:NotAShelf/nvf";
@ -30,9 +26,6 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`.
# instance of nixpkgs. This is safe to do as nvf does not depend
# on a binary cache.
inputs.nixpkgs.follows = "nixpkgs";
# Optionally, you can also override individual plugins
# for example:
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
};
# ...

View file

@ -154,8 +154,6 @@
[LilleAila](https://github.com/LilleAila):
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
issue with setting the workspace directory.
- Add `vim.snippets.luasnip.setupOpts`, which was previously missing.
- Add `"prettierd"` as a formatter option in
`vim.languages.markdown.format.type`.
@ -283,6 +281,8 @@
[alfarel](https://github.com/alfarelcynthesis):
[conform.nvim]: https://github.com/stevearc/conform.nvim
[obsidian.nvim]: https://github.com/obsidian-nvim/obsidian.nvim
[markview.nvim]: https://github.com/OXY2DEV/markview.nvim
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
@ -305,6 +305,44 @@
- Fix YAML language module not activating LSP keybinds if the Helm language
module was also enabled.
- Fix `json` language module (default) language server not activating.
- Upgrade [obsidian.nvim] to use a maintained fork, instead of the unmaintained
upstream.
- Support [blink.cmp] and completion plugin autodetection.
- Support various pickers for prompts, including [snacks.nvim]'s
`snacks.picker`, [mini.nvim]'s `mini.pick`, `telescope`, and [fzf-lua]. nvf
will now pick one of these (in that order) if they are enabled.
- Merge commands like `ObsidianBacklinks` into `Obisidian backlinks`. The old
format is still supported by default.
- Add suggested integration with `snacks.image` for rendering in-workspace
assets.
- Various other improvements.
- Some `setupOpts` options have changed:
- `disable_frontmatter` -> `frontmatter.enabled` (and inverted), still
supported.
- `note_frontmatter_func` -> `frontmatter.func`, still supported.
- `statusline` module is now deprecated in favour of `footer`, still
supported.
- `dir` is no longer supported, use `workspaces`:
```nix
{
workspaces = [
{
name = "any-string";
path = "~/old/dir/path/value";
}
];
}
```
- `use_advanced_uri` -> `open.use_advanced_uri`.
- Mappings are now expected to be set using the built-in Neovim APIs,
managed by `vim.keymaps` in nvf, instead of `mappings` options.
- Some option defaults have changed.
- Supposedly detects if [render-markdown.nvim] or [markview.nvim] are enabled
and disables the `ui` module to prevent conflicts. In testing
`render-markdown.nvim` still has conflicts unless manually disabled, so nvf
will disable `ui.enable` explicitly if either is enabled.
[TheColorman](https://github.com/TheColorman):

View file

@ -3,7 +3,8 @@
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
@ -25,6 +26,48 @@ in {
pluginRC.obsidian = entryAnywhere ''
require("obsidian").setup(${toLuaObject cfg.setupOpts})
'';
# Don't set option unless we have a useful setting for it.
notes.obsidian.setupOpts = let
snacks = config.vim.utility.snacks-nvim.setupOpts.picker.enabled or false;
mini = config.vim.mini.pick.enable;
telescope = config.vim.telescope.enable;
fzf-lua = config.vim.fzf-lua.enable;
markdownExtensions = config.vim.languages.markdown.extensions;
render-markdown = markdownExtensions.render-markdown-nvim.enable;
markview = markdownExtensions.markview-nvim.enable;
in
mkMerge [
(mkIf (snacks || mini || telescope || fzf-lua) {
# plugin doesn't detect/choose this
picker.name =
if snacks
then "snacks.pick"
else if mini
then "mini.pick"
else if telescope
then "telescope.nvim"
else if fzf-lua
then "fzf-lua"
# NOTE: Shouldn't happen
else null;
})
# Should be disabled automatically, but still causes issues in checkhealth.
(mkIf (render-markdown || markview) {ui.enable = false;})
];
# Resolve markdown image paths in the vault.
# Only actually used by snacks if image.enabled is set to true
utility.snacks-nvim.setupOpts = mkIf config.vim.utility.snacks-nvim.enable {
image.resolve = mkLuaInline ''
function(path, src)
if require("obsidian.api").path_is_note(path) then
return require("obsidian.api").resolve_image_path(src)
end
end
'';
};
};
};
}

View file

@ -1,14 +1,7 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool str nullOr;
inherit (lib.modules) mkRenamedOptionModule;
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkRenamedOptionModule mkRemovedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption;
autocompleteCfg = config.vim.autocomplete;
in {
imports = let
renamedSetupOption = oldPath: newPath:
@ -16,38 +9,48 @@ in {
(["vim" "notes" "obsidian"] ++ oldPath)
(["vim" "notes" "obsidian" "setupOpts"] ++ newPath);
in [
(renamedSetupOption ["dir"] ["dir"])
(
mkRemovedOptionModule ["vim" "notes" "obsidian" "dir"]
''
`obsidian.nvim` has migrated to the `setupOpts.workspaces` option to support multiple vaults with a single interface.
To continue using a single vault, set:
```nix
{
notes.obsidian.setupOpts.workspaces = [
{
name = "any-string";
path = "~/old/dir/path/value";
}
];
}
```
''
)
(renamedSetupOption ["daily-notes" "folder"] ["daily_notes" "folder"])
(renamedSetupOption ["daily-notes" "date-format"] ["daily_notes" "date_format"])
(renamedSetupOption ["completion"] ["completion"])
];
options.vim.notes = {
obsidian = {
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
enable =
mkEnableOption ""
// {
description = ''
Whether to enable plugins to compliment the Obsidian markdown editor [obsidian.nvim].
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
daily_notes = {
folder = mkOption {
type = nullOr str;
default = null;
description = "Directory in which daily notes should be created";
};
date_format = mkOption {
type = nullOr str;
default = null;
description = "Date format used for creating daily notes";
};
This plugin depends on [vim-markdown] which by default folds headings, including outside of workspaces/vaults.
Set `vim.g['vim_markdown_folding_disable'] = 1` to disable automatic folding,
or `vim.g['vim_markdown_folding_level'] = <number>` to set the default folding level.
nvf will choose snacks.picker, mini.pick, telescope, or fzf-lua as the picker if they are enabled, in that order.
The `ui` config module is automatically disabled if `render-markdown-nvim` or `markview-nvim` are enabled.
'';
};
completion = {
nvim_cmp = mkOption {
# If using nvim-cmp, otherwise set to false
type = bool;
description = "If using nvim-cmp, otherwise set to false";
default = autocompleteCfg.nvim-cmp.enable || autocompleteCfg.blink-cmp.enable;
};
};
};
setupOpts = mkPluginSetupOption "obsidian.nvim" {};
};
};
}

View file

@ -2089,17 +2089,20 @@
"hash": "1qbyh8r2gbaw2n0mm7qwi4y8r9ywyz37q35vlxjzy879ba8dlnlm"
},
"obsidian-nvim": {
"type": "Git",
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "epwalsh",
"owner": "obsidian-nvim",
"repo": "obsidian.nvim"
},
"branch": "main",
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"revision": "14e0427bef6c55da0d63f9a313fd9941be3a2479",
"url": "https://github.com/epwalsh/obsidian.nvim/archive/14e0427bef6c55da0d63f9a313fd9941be3a2479.tar.gz",
"hash": "15ycmhn48ryaqzch6w3w6llq2qgmjx8xwkb9dn0075z60dybpflr"
"version": "v3.14.3",
"revision": "1966e6c0bd43fbb213cf2693a1167dcc544d6c3a",
"url": "https://api.github.com/repos/obsidian-nvim/obsidian.nvim/tarball/v3.14.3",
"hash": "18nikf0gafn91rys7wvr35105qaka3r86k491iqd4f9zd48gshnc"
},
"oil-git-status.nvim": {
"type": "Git",