diff --git a/.editorconfig b/.editorconfig index f316f5ab..1f39b72e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,6 @@ trim_trailing_whitespace = true indent_style = space indent_size = 2 trim_trailing_whitespace = false -max_line_length = 80 [*.{js,json,nix,yml,yaml,toml}] indent_style = space diff --git a/.github/typos.toml b/.github/typos.toml index 25d5c0e1..b6211a80 100644 --- a/.github/typos.toml +++ b/.github/typos.toml @@ -9,6 +9,7 @@ default.extend-ignore-words-re = [ "edn", "esy", "BA", # somehow "BANanaD3V" is valid, but BA is not... - "Emac" + "Emac", + "tese" # for glsl shaders ] diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index 63a0fd6f..b6eb0d41 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -25,7 +25,7 @@ jobs: name: Checkout - name: Install Nix - uses: cachix/install-nix-action@v31.9.0 + uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e3a3a7ed..bf1163df 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31.9.0 + - uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v6 - name: Install Nix - uses: cachix/install-nix-action@v31.9.0 + uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | @@ -93,13 +93,20 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31.9.0 + - uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | substituters = https://cache.nixos.org/ https://feel-co.cachix.org trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w= + - uses: cachix/cachix-action@v16 + with: + authToken: ${{ secrets.CACHIX_TOKEN }} + extraPullNames: nix-community + name: nvf + pushFilter: '(ndg-\d+\.\d+\.\d+$)' + - name: Set default git branch (to reduce log spam) run: git config --global init.defaultBranch main @@ -112,7 +119,7 @@ jobs: run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT} - name: Upload doc artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: "${{ matrix.package }}" path: result/share/doc/nvf @@ -124,7 +131,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31.9.0 + - uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | @@ -162,7 +169,7 @@ jobs: cat "$HOME/changed_files" - name: Install Nix - uses: cachix/install-nix-action@v31.9.0 + uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 984654d2..43c29afa 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31.9.0 + - uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index 4b6e2eff..6134f764 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -44,7 +44,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31.9.0 + - uses: cachix/install-nix-action@v31.9.1 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index f1c5cc4b..2cc2fadf 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v6 - name: "Install Nix" - uses: cachix/install-nix-action@v31.9.0 + uses: cachix/install-nix-action@v31.9.1 - name: Set up Git run: | diff --git a/configuration.nix b/configuration.nix index b9e3b8ec..9cce777a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -55,6 +55,7 @@ isMaximal: { # Languages that are enabled in the maximal configuration. bash.enable = isMaximal; clang.enable = isMaximal; + cmake.enable = isMaximal; css.enable = isMaximal; html.enable = isMaximal; json.enable = isMaximal; @@ -72,8 +73,10 @@ isMaximal: { extensions.crates-nvim.enable = isMaximal; }; toml.enable = isMaximal; + xml.enable = isMaximal; # Language modules that are not as common. + arduino.enable = false; assembly.enable = false; astro.enable = false; nu.enable = false; @@ -83,6 +86,7 @@ isMaximal: { scala.enable = false; r.enable = false; gleam.enable = false; + glsl.enable = false; dart.enable = false; ocaml.enable = false; elixir.enable = false; @@ -91,10 +95,12 @@ isMaximal: { ruby.enable = false; fsharp.enable = false; just.enable = false; + make.enable = false; qml.enable = false; - + jinja.enable = false; tailwind.enable = false; svelte.enable = false; + tera.enable = false; # Nim LSP is broken on Darwin and therefore # should be disabled by default. Users may still enable @@ -112,6 +118,7 @@ isMaximal: { fidget-nvim.enable = true; highlight-undo.enable = true; + blink-indent.enable = true; indent-blankline.enable = true; # Fun @@ -202,6 +209,7 @@ isMaximal: { smart-splits.enable = isMaximal; undotree.enable = isMaximal; nvim-biscuits.enable = isMaximal; + grug-far-nvim.enable = isMaximal; motion = { hop.enable = true; diff --git a/docs/manual/configuring.md b/docs/manual/configuring.md index 9a1b71cf..ce455ea7 100644 --- a/docs/manual/configuring.md +++ b/docs/manual/configuring.md @@ -17,6 +17,7 @@ configuring/custom-package.md configuring/custom-plugins.md configuring/overriding-plugins.md configuring/languages.md +configuring/keybinds.md configuring/dags.md configuring/dag-entries.md configuring/autocmds.md diff --git a/docs/manual/configuring/keybinds.md b/docs/manual/configuring/keybinds.md new file mode 100644 index 00000000..401799c1 --- /dev/null +++ b/docs/manual/configuring/keybinds.md @@ -0,0 +1,38 @@ +# Custom keymaps {#ch-keymaps} + +Some plugin modules provide keymap options for your convenience. If a keymap is +not provided by such module options, you may easily register your own custom +keymaps via {option}`vim.keymaps`. + +```nix +{ + config.vim.keymaps = [ + { + key = "m"; + mode = "n"; + silent = true; + action = ":make"; + } + { + key = "l"; + mode = ["n" "x"]; + silent = true; + action = "cnext"; + } + { + key = "k"; + mode = ["n" "x"]; + + # While `lua` is `true`, `action` is expected to be + # a valid Lua expression. + lua = true; + action = '' + function() + require('foo').do_thing() + print('did thing') + end + ''; + } + ]; +} +``` diff --git a/docs/manual/configuring/languages/lsp.md b/docs/manual/configuring/languages/lsp.md index 2ddc08b5..847924aa 100644 --- a/docs/manual/configuring/languages/lsp.md +++ b/docs/manual/configuring/languages/lsp.md @@ -21,3 +21,43 @@ vim.languages.java = { }; } ``` + +## Custom LSP Servers {#ch-custom-lsp-servers} + +Neovim 0.11, in an effort to improve the out-of-the-box experience of Neovim, +has introduced a new `vim.lsp` API that can be used to register custom LSP +servers with ease. In **nvf**, this translates to the custom `vim.lsp` API that +can be used to register servers that are not present in existing language +modules. + +The {option}`vim.lsp.servers` submodule can be used to modify existing LSP +definitions OR register your own custom LSPs respectively. For example, if you'd +like to avoid having NVF pull the LSP packages you may modify the start command +to use a string, which will cause the LSP API to discover LSP servers from +{env}`PATH`. For example: + +```nix +{lib, ...}: { + vim.lsp.servers = { + # Get `basedpyright-langserver` from PATH, e.g., a dev shell. + basedpyright.cmd = lib.mkForce ["basedpyright-langserver" "--stdio"]; + + # Define a custom LSP entry using `vim.lsp.servers`: + ty = { + cmd = lib.mkDefault [(lib.getExe pkgs.ty) "server"]; + filetypes = ["python"]; + root_markers = [ + ".git" + "pyproject.toml" + "setup.cfg" + "requirements.txt" + "Pipfile" + "pyrightconfig.json" + ]; + + # If your LSP accepts custom settings. See `:help lsp-config` for more details + # on available fields. This is a freeform field. + settings.ty = { /* ... */ }; + }; +} +``` diff --git a/docs/manual/configuring/overriding-plugins.md b/docs/manual/configuring/overriding-plugins.md index 55979ce7..ad681517 100644 --- a/docs/manual/configuring/overriding-plugins.md +++ b/docs/manual/configuring/overriding-plugins.md @@ -14,11 +14,12 @@ vim.pluginOverrides = { rev = ""; hash = ""; }; + # It's also possible to use a flake input lazydev-nvim = inputs.lazydev-nvim; # Or a local path lazydev-nvim = ./lazydev; - # Or a npins pin... etc + # Or a npins pin nvfetcher source, etc. }; ``` diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 2a83e2e2..ff701506 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -28,6 +28,29 @@ Some other settings and commands are now deprecated but are still supported. - The `setupOpts.mappings` options were also removed. Use the built-in Neovim settings (nvf's {option}`vim.keymaps`) +[Snoweuph](https://github.com/snoweuph) + +- "Correct `languages.go.treesitter` to contain all Go file types. + `languages.go.treesitter.package` is now `languages.go.treesitter.goPackage`. + New are: + + - `languages.go.treesitter.goPackage`. + + - `languages.go.treesitter.gomodPackage`. + + - `languages.go.treesitter.gosumPackage`. + + - `languages.go.treesitter.goworkPackage`. + + - `languages.go.treesitter.gotmplPackage`. + +- Fix `vim.assistant.codecompanion-nvim.setupOpts.display.diff.provider` to only + allow valid options. `default` is no longer valid. `inline` and `split` are + two new valid options. + +- Added [taplo](https://taplo.tamasfe.dev/) as the default formatter and lsp for + `languages.toml` so we don't default to AI-Slop. + ## Changelog {#sec-release-0-9-changelog} [taylrfnt](https://github.com/taylrfnt) @@ -53,6 +76,10 @@ Some other settings and commands are now deprecated but are still supported. treesitter grammars were changed to prefer `grammarPlugins` over `builtGrammars`. +[NotAShelf](https://github.com/notashelf): + +- Lazyload noice.nvim and nvim-web-devicons on `DeferredUIEnter` + [jfeo](https://github.com/jfeo): [ccc.nvim]: https://github.com/uga-rosa/ccc.nvim @@ -143,6 +170,9 @@ Some other settings and commands are now deprecated but are still supported. - Added [sqruff](https://github.com/quarylabs/sqruff) support to `languages.sql` +- Lazy-load `crates.nvim` plugin when using + `vim.languages.rust.extensions.crates-nvim.enable` + - Added [Pyrefly](https://pyrefly.org/) and [zuban](https://zubanls.com/) support to `languages.python` @@ -150,9 +180,14 @@ Some other settings and commands are now deprecated but are still supported. [Tombi](https://tombi-toml.github.io/tombi/) language server, linter, and formatter. +- Added Jinja support via `languages.jinja` + - Added [hlargs.nvim](https://github.com/m-demare/hlargs.nvim) support as `visuals.hlargs-nvim`. +- Lazy-load `nvim-autopairs` plugin when using + `vim.autopairs.nvim-autopairs.enable` + [Machshev](https://github.com/machshev): - Added `ruff` and `ty` LSP support for Python under `programs.python`. @@ -161,3 +196,90 @@ Some other settings and commands are now deprecated but are still supported. - Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in `languages.lua`. + +- Added [`mdformat`](https://mdformat.rtfd.io/) support to `languages.markdown` + with the extensions for [GFM](https://github.github.com/gfm/), + [front matter](https://www.markdownlang.com/advanced/frontmatter.html) and + [footnotes](https://www.markdownguide.org/extended-syntax/#footnotes). + +- Added XML syntax highlighting, LSP support and formatting + +- Added [mypy](https://www.mypy-lang.org/) to `languages.python` for extra + diagnostics. + +- Added [tera](https://keats.github.io/tera/) language support (syntax + highlighting only). + +- Added Debugging support to `languages.odin` with + [nvim-dap-odin](https://github.com/NANDquark/nvim-dap-odin). + +- Disabled notifications for + [nvim-dap-odin](https://github.com/NANDquark/nvim-dap-odin), because it + contain no use full information, only spam, and it can't be made lazy. + +- Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics. + +- updated default filetypes for + [harper-ls](https://github.com/Automattic/harper) to match what they are + supposed to be. + +- Added Makefile support via `languages.make`. + +- Fix `languages.hcl` init, depending on `comment-nvim` by checking if it is + enabled. Fixes a crash (#1350). + +- Added Debugging support to `languages.php`. + +- Added Formatting support to `languages.php` via + [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer). + +- Didn't Add + [`syntax-gaslighting`](https://github.com/NotAShelf/syntax-gaslighting.nvim), + you're crazy. + +[vagahbond](https://github.com/vagahbond): [codewindow.nvim]: +https://github.com/gorbit99/codewindow.nvim + +- Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and + `setupOpts` + +[irobot](https://github.com/irobot): + +- Fix non-functional `vim.keymaps.*.noremap`. Now, setting it to false is + equivalent to `:lua vim.keymap.set(..., { remap = true })` + +[kazimazi](https://github.com/kazimazi): + +- Added [`grug-far.nvim`](https://github.com/MagicDuck/grug-far.nvim) the find + and replace tool for neovim. +- Fix lsp `client.supports_method` deprecation warning in nvim v0.12. +- Add [`blink.indent`](https://github.com/saghen/blink.indent) indent guideline + plugin. + +[Ladas552](https://github.com/Ladas552) + +- Changed `withRuby` to not be enabled by default +- Fix virtualtext mode in colorizer + +[horriblename](https://github.com/horriblename): + +- Ignore terminals by default in spell-checking + +[poz](https://poz.pet): + +[neocmakelsp]: https://github.com/neocmakelsp/neocmakelsp +[arduino-language-server]: https://github.com/arduino/arduino-language-server +[glsl_analyzer]: https://github.com/nolanderc/glsl_analyzer + +- Add CMake support with [neocmakelsp]. +- Add Arduino support with [arduino-language-server]. +- Add GLSL support with [glsl_analyzer]. + +[itscrystalline](https://github.com/itscrystalline): + +[img-clip.nvim]: https://github.com/hakonharnes/img-clip.nvim + +- [img-clip.nvim]'s configuration now has it's own DAG entry, separate from + image-nvim. + + diff --git a/flake.lock b/flake.lock index 1081a12c..4ebfffc3 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ ] }, "locked": { - "lastModified": 1768135262, - "narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=", + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "mnw": { "locked": { - "lastModified": 1768701608, - "narHash": "sha256-kSvWF3Xt2HW9hmV5V7i8PqeWJIBUKmuKoHhOgj3Znzs=", + "lastModified": 1770419553, + "narHash": "sha256-b1XqsH7AtVf2dXmq2iyRr2NC1yG7skY7Z6N2MpWHlK4=", "owner": "Gerg-L", "repo": "mnw", - "rev": "20d63a8a1ae400557c770052a46a9840e768926b", + "rev": "2aaffa8030d0b262176146adbb6b0e6374ce2957", "type": "github" }, "original": { @@ -74,16 +74,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1768875095, - "narHash": "sha256-dYP3DjiL7oIiiq3H65tGIXXIT1Waiadmv93JS0sS+8A=", + "lastModified": 1771008912, + "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ed142ab1b3a092c4d149245d0c4126a5d7ea00b0", + "rev": "a82ccc39b39b621151d6732718e3e250109076fa", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 4a35cf91..ba817494 100644 --- a/flake.nix +++ b/flake.nix @@ -122,7 +122,7 @@ systems.url = "github:nix-systems/default"; ## Basic Inputs - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; flake-parts = { url = "github:hercules-ci/flake-parts"; diff --git a/flake/pkgs/by-name/blink-cmp/package.nix b/flake/pkgs/by-name/blink-cmp/package.nix index 7c6371d1..7a7b01c6 100644 --- a/flake/pkgs/by-name/blink-cmp/package.nix +++ b/flake/pkgs/by-name/blink-cmp/package.nix @@ -3,17 +3,17 @@ stdenv, rustPlatform, fetchFromGitHub, - writeShellScriptBin, + rust-jemalloc-sys, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "blink-cmp"; - version = "1.8.0"; + version = "1.9.1"; src = fetchFromGitHub { owner = "Saghen"; repo = "blink.cmp"; tag = "v${finalAttrs.version}"; - hash = "sha256-JjlcPj7v9J+v1SDBYIub6jFEslLhZGHmsipV1atUAFo="; + hash = "sha256-GgodXdWpQoF2z1g1/WvnSpfuhskw0aMcOoyZM5l66q8="; }; forceShare = [ @@ -21,6 +21,11 @@ rustPlatform.buildRustPackage (finalAttrs: { "info" ]; + # Tries to call git + preBuild = '' + rm build.rs + ''; + postInstall = '' cp -r {lua,plugin} "$out" @@ -31,12 +36,18 @@ rustPlatform.buildRustPackage (finalAttrs: { mv "$out/lib" "$out/target/release" ''; - cargoHash = "sha256-Qdt8O7IGj2HySb1jxsv3m33ZxJg96Ckw26oTEEyQjfs="; + # From the blink.cmp flake + buildInputs = lib.optionals stdenv.hostPlatform.isAarch64 [rust-jemalloc-sys]; - nativeBuildInputs = [ - (writeShellScriptBin "git" "exit 1") + # NOTE: The only change in frizbee 0.7.0 was nixpkgs incompatible rust semantic changes + # Patch just reverts https://github.com/saghen/blink.cmp/commit/cc824ec85b789a54d05241389993c6ab8c040810 + # Taken from Nixpkgs' blink.cmp derivation, available under the MIT license + cargoPatches = [ + ./patches/0001-pin-frizbee.patch ]; + cargoHash = "sha256-Qdt8O7IGj2HySb1jxsv3m33ZxJg96Ckw26oTEEyQjfs="; + env = { RUSTC_BOOTSTRAP = true; diff --git a/flake/pkgs/by-name/blink-cmp/patches/0001-pin-frizbee.patch b/flake/pkgs/by-name/blink-cmp/patches/0001-pin-frizbee.patch new file mode 100644 index 00000000..cc7defc9 --- /dev/null +++ b/flake/pkgs/by-name/blink-cmp/patches/0001-pin-frizbee.patch @@ -0,0 +1,29 @@ +diff --git a/Cargo.lock b/Cargo.lock +index 35bb10e..71c79eb 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -144,9 +144,9 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + + [[package]] + name = "frizbee" +-version = "0.7.0" ++version = "0.6.0" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "4d024031f1a5bc5f19917baa0b618f1067610e35ba23e9f105653fcb27e74f5c" ++checksum = "c3365720de81dac18e889afa72f5907aa061c975548da68e2400c056ebc94aec" + dependencies = [ + "multiversion", + "rayon", +diff --git a/Cargo.toml b/Cargo.toml +index 392d1bb..c776c7d 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -9,7 +9,7 @@ crate-type = ["cdylib"] + + [dependencies] + regex = "1.11.2" +-frizbee = "0.7.0" ++frizbee = "0.6.0" + mlua = { version = "0.11.3", features = ["module", "luajit"] } + thiserror = "2.0.16" + blake3 = "1.8.2" diff --git a/flake/pkgs/by-name/prettier-plugin-astro/package.nix b/flake/pkgs/by-name/prettier-plugin-astro/package.nix index d893da7c..0c0d206f 100644 --- a/flake/pkgs/by-name/prettier-plugin-astro/package.nix +++ b/flake/pkgs/by-name/prettier-plugin-astro/package.nix @@ -3,6 +3,8 @@ fetchFromGitHub, nodejs, pnpm_9, + pnpmConfigHook, + fetchPnpmDeps, pins, }: let pin = pins.prettier-plugin-astro; @@ -17,7 +19,8 @@ in sha256 = pin.hash; }; - pnpmDeps = pnpm_9.fetchDeps { + pnpmDeps = fetchPnpmDeps { + pnpm = pnpm_9; inherit (finalAttrs) pname src; fetcherVersion = 2; hash = "sha256-K7pIWLkIIbUKDIcysfEtcf/eVMX9ZgyFHdqcuycHCNE="; @@ -25,7 +28,9 @@ in nativeBuildInputs = [ nodejs - pnpm_9.configHook + (pnpmConfigHook.overrideAttrs { + propagatedBuildInputs = [pnpm_9]; + }) ]; buildPhase = '' diff --git a/lib/lua.nix b/lib/lua.nix index bf879031..01c73612 100644 --- a/lib/lua.nix +++ b/lib/lua.nix @@ -49,4 +49,4 @@ in "expToLua" "listToLuaTable" "attrsetToLuaTable" - ] (name: lib.warn "${name} is deprecated use toLuaObject instead" toLuaObject) + ] (name: builtins.throw "${name} is deprecated use toLuaObject instead") diff --git a/modules/neovim/init/spellcheck.nix b/modules/neovim/init/spellcheck.nix index 724b432d..6fe41183 100644 --- a/modules/neovim/init/spellcheck.nix +++ b/modules/neovim/init/spellcheck.nix @@ -4,13 +4,14 @@ lib, ... }: let + inherit (builtins) length; inherit (lib.modules) mkIf mkRenamedOptionModule; inherit (lib.options) mkOption mkEnableOption literalExpression; - inherit (lib.strings) concatLines concatStringsSep optionalString; + inherit (lib.strings) concatLines concatStringsSep; inherit (lib.attrsets) mapAttrsToList; - inherit (lib.types) listOf str attrsOf; - inherit (lib.nvim.lua) toLuaObject; - inherit (lib.nvim.dag) entryAfter; + inherit (lib.types) listOf str attrsOf bool; + inherit (lib.lists) optional; + inherit (lib.generators) mkLuaInline; cfg = config.vim.spellcheck; in { @@ -86,6 +87,12 @@ in { ''; }; + ignoreTerminal = mkOption { + type = bool; + default = true; + description = "Disable spell checking in terminal."; + }; + programmingWordlist.enable = mkEnableOption '' vim-dirtytalk, a wordlist for programmers containing common programming terms. @@ -144,20 +151,25 @@ in { spelllang = concatStringsSep "," cfg.languages; }; - # Register an autocommand to disable spellchecking in buffers with given filetypes. - # If the list is empty, the autocommand does not need to be registered. - luaConfigRC.spellcheck = entryAfter ["basic"] (optionalString (cfg.ignoredFiletypes != []) '' - -- Disable spellchecking for certain filetypes - -- as configured by `vim.spellcheck.ignoredFiletypes` - vim.api.nvim_create_augroup("nvf_autocmds", {clear = false}) - vim.api.nvim_create_autocmd({ "FileType" }, { - group = "nvf_autocmds", - pattern = ${toLuaObject cfg.ignoredFiletypes}, - callback = function() - vim.opt_local.spell = false - end, + augroups = [{name = "nvf_spellcheck";}]; + autocmds = + (optional cfg.ignoreTerminal { + event = ["TermOpen"]; + group = "nvf_spellcheck"; + callback = mkLuaInline '' + function() vim.opt_local.spell = false end + ''; }) - ''); + ++ (optional (length cfg.ignoredFiletypes > 0) { + event = ["FileType"]; + group = "nvf_spellcheck"; + pattern = cfg.ignoredFiletypes; + callback = mkLuaInline '' + function() + vim.opt_local.spell = false + end + ''; + }); }; }; } diff --git a/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix b/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix index 8e5ed4cc..27603ad7 100644 --- a/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix +++ b/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix @@ -59,8 +59,8 @@ in { }; provider = mkOption { - type = enum ["default" "mini_diff"]; - default = "default"; + type = enum ["inline" "split" "mini_diff"]; + default = "inline"; description = "The preferred kind of provider."; }; }; diff --git a/modules/plugins/autopairs/nvim-autopairs/config.nix b/modules/plugins/autopairs/nvim-autopairs/config.nix index 6566ec28..1a55273a 100644 --- a/modules/plugins/autopairs/nvim-autopairs/config.nix +++ b/modules/plugins/autopairs/nvim-autopairs/config.nix @@ -4,17 +4,14 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.lua) toLuaObject; - cfg = config.vim.autopairs.nvim-autopairs; in { config = mkIf cfg.enable { - vim = { - startPlugins = ["nvim-autopairs"]; - pluginRC.autopairs = entryAnywhere '' - require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts}) - ''; + vim.lazy.plugins.nvim-autopairs = { + package = "nvim-autopairs"; + setupModule = "nvim-autopairs"; + setupOpts = cfg.setupOpts; + event = ["InsertEnter"]; }; }; } diff --git a/modules/plugins/dashboard/alpha/config.nix b/modules/plugins/dashboard/alpha/config.nix index 7a29bd0b..985e3d27 100644 --- a/modules/plugins/dashboard/alpha/config.nix +++ b/modules/plugins/dashboard/alpha/config.nix @@ -11,21 +11,21 @@ layoutDefined = cfg.layout != []; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "alpha-nvim" - "nvim-web-devicons" - ]; + vim = { + startPlugins = ["alpha-nvim"]; + visuals.nvim-web-devicons.enable = true; - vim.pluginRC.alpha = let - setupOpts = - if themeDefined - then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config" - else { - inherit (cfg) layout opts; - }; - in '' - require('alpha').setup(${toLuaObject setupOpts}) - ''; + pluginRC.alpha = let + setupOpts = + if themeDefined + then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config" + else { + inherit (cfg) layout opts; + }; + in '' + require('alpha').setup(${toLuaObject setupOpts}) + ''; + }; assertions = [ { diff --git a/modules/plugins/git/hunk-nvim/config.nix b/modules/plugins/git/hunk-nvim/config.nix index 5eb41448..06a0df9c 100644 --- a/modules/plugins/git/hunk-nvim/config.nix +++ b/modules/plugins/git/hunk-nvim/config.nix @@ -9,11 +9,8 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = [ - # dependencies - "nui-nvim" # ui library - "nvim-web-devicons" # glyphs - ]; + startPlugins = ["nui-nvim"]; + visuals.nvim-web-devicons.enable = true; lazy.plugins = { "hunk-nvim" = { diff --git a/modules/plugins/languages/arduino.nix b/modules/plugins/languages/arduino.nix new file mode 100644 index 00000000..b22c6d9d --- /dev/null +++ b/modules/plugins/languages/arduino.nix @@ -0,0 +1,95 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.generators) mkLuaInline; + inherit (lib.meta) getExe getExe'; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum listOf str; + inherit (lib.nvim.attrsets) mapListToAttrs; + inherit (lib.nvim.types) mkGrammarOption; + + cfg = config.vim.languages.arduino; + + defaultServers = ["arduino-language-server"]; + servers = { + arduino-language-server = { + enable = true; + cmd = + [ + (getExe pkgs.arduino-language-server) + "-clangd" + (getExe' pkgs.clang-tools "clangd") + "-cli" + (getExe pkgs.arduino-cli) + "-cli-config" + "$HOME/.arduino15/arduino-cli.yaml" + ] + ++ cfg.lsp.extraArgs; + filetypes = ["arduino"]; + root_dir = + mkLuaInline + /* + lua + */ + '' + function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern("*.ino")(fname)) + end + ''; + capabilities = { + textDocument = { + semanticTokens = mkLuaInline "vim.NIL"; + }; + workspace = { + semanticTokens = mkLuaInline "vim.NIL"; + }; + }; + }; + }; +in { + options.vim.languages.arduino = { + enable = mkEnableOption "Arduino support"; + + treesitter = { + enable = mkEnableOption "Arduino treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "arduino"; + }; + + lsp = { + enable = mkEnableOption "Arduino LSP support" // {default = config.vim.lsp.enable;}; + servers = mkOption { + type = listOf (enum (attrNames servers)); + default = defaultServers; + description = "Arduino LSP servers to use"; + }; + + extraArgs = mkOption { + type = listOf str; + default = []; + description = "Extra arguments passed to the Arduino LSP"; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.servers = + mapListToAttrs (n: { + name = n; + value = servers.${n}; + }) + cfg.lsp.servers; + }) + ]); +} diff --git a/modules/plugins/languages/clang.nix b/modules/plugins/languages/clang.nix index cfc86131..6948ff50 100644 --- a/modules/plugins/languages/clang.nix +++ b/modules/plugins/languages/clang.nix @@ -97,7 +97,7 @@ local function symbol_info() local bufnr = vim.api.nvim_get_current_buf() local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1] - if not clangd_client or not clangd_client.supports_method 'textDocument/symbolInfo' then + if not clangd_client or not clangd_client:supports_method 'textDocument/symbolInfo' then return vim.notify('Clangd client not found', vim.log.levels.ERROR) end local win = vim.api.nvim_get_current_win() diff --git a/modules/plugins/languages/cmake.nix b/modules/plugins/languages/cmake.nix new file mode 100644 index 00000000..6c6fa287 --- /dev/null +++ b/modules/plugins/languages/cmake.nix @@ -0,0 +1,96 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.meta) getExe; + inherit (lib.types) enum listOf package; + inherit (lib.nvim.attrsets) mapListToAttrs; + inherit (lib.nvim.types) mkGrammarOption; + + cfg = config.vim.languages.cmake; + + defaultServers = ["neocmakelsp"]; + servers = { + neocmakelsp = { + enable = true; + cmd = [(getExe pkgs.neocmakelsp) "--stdio"]; + filetypes = ["cmake"]; + root_markers = [".gersemirc" ".git" "build" "cmake"]; + capabilities = { + textDocument.completion.completionItem.snippetSupport = true; + }; + }; + }; + + defaultFormat = "gersemi"; + formats = { + gersemi = { + package = pkgs.gersemi; + }; + }; +in { + options.vim.languages.cmake = { + enable = mkEnableOption "CMake language support"; + + treesitter = { + enable = mkEnableOption "CMake treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "cmake"; + }; + + lsp = { + enable = mkEnableOption "CMake LSP support" // {default = config.vim.lsp.enable;}; + servers = mkOption { + type = listOf (enum (attrNames servers)); + default = defaultServers; + description = "CMake LSP servers to use"; + }; + }; + + format = { + enable = mkEnableOption "CMake formatting" // {default = config.vim.languages.enableFormat;}; + + type = mkOption { + description = "CMake formatter to use"; + type = enum (attrNames formats); + default = defaultFormat; + }; + + package = mkOption { + description = "CMake formatter package"; + type = package; + default = formats.${cfg.format.type}.package; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.servers = + mapListToAttrs (n: { + name = n; + value = servers.${n}; + }) + cfg.lsp.servers; + }) + + (mkIf cfg.format.enable { + vim.formatter.conform-nvim = { + enable = true; + setupOpts.formatters_by_ft.cmake = [cfg.format.type]; + setupOpts.formatters.${cfg.format.type} = { + command = getExe cfg.format.package; + }; + }; + }) + ]); +} diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index 9b0d241b..1cdead76 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -3,6 +3,7 @@ inherit (lib.nvim.languages) mkEnable; in { imports = [ + ./arduino.nix ./asm.nix ./astro.nix ./bash.nix @@ -10,17 +11,21 @@ in { ./dart.nix ./clang.nix ./clojure.nix + ./cmake.nix ./css.nix ./elixir.nix ./fsharp.nix ./gleam.nix + ./glsl.nix ./go.nix ./hcl.nix ./helm.nix ./kotlin.nix ./html.nix + ./tera.nix ./haskell.nix ./java.nix + ./jinja.nix ./json.nix ./lua.nix ./markdown.nix @@ -50,6 +55,8 @@ in { ./yaml.nix ./ruby.nix ./just.nix + ./make.nix + ./xml.nix # This is now a hard deprecation. (mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"]) diff --git a/modules/plugins/languages/glsl.nix b/modules/plugins/languages/glsl.nix new file mode 100644 index 00000000..b555b008 --- /dev/null +++ b/modules/plugins/languages/glsl.nix @@ -0,0 +1,63 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum listOf; + inherit (lib.meta) getExe; + inherit (lib.nvim.attrsets) mapListToAttrs; + + cfg = config.vim.languages.glsl; + + defaultServers = ["glsl_analyzer"]; + servers = { + glsl_analyzer = { + enable = true; + cmd = [(getExe pkgs.glsl_analyzer)]; + filetypes = ["glsl" "vert" "tesc" "tese" "frag" "geom" "comp"]; + root_markers = [".git"]; + }; + }; +in { + options.vim.languages.glsl = { + enable = mkEnableOption "GLSL language support"; + + treesitter = { + enable = mkEnableOption "GLSL treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "glsl"; + }; + + lsp = { + enable = mkEnableOption "GLSL LSP support" // {default = config.vim.lsp.enable;}; + + servers = mkOption { + type = listOf (enum (attrNames servers)); + default = defaultServers; + description = "GLSL LSP server to use"; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter = { + enable = true; + grammars = [cfg.treesitter.package]; + }; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.servers = + mapListToAttrs (n: { + name = n; + value = servers.${n}; + }) + cfg.lsp.servers; + }) + ]); +} diff --git a/modules/plugins/languages/go.nix b/modules/plugins/languages/go.nix index c51077f9..da3700a7 100644 --- a/modules/plugins/languages/go.nix +++ b/modules/plugins/languages/go.nix @@ -10,7 +10,7 @@ inherit (lib.meta) getExe; inherit (lib.generators) mkLuaInline; inherit (lib.types) bool enum package; - inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf; + inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf; inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.attrsets) mapListToAttrs; @@ -20,7 +20,7 @@ servers = { gopls = { cmd = [(getExe pkgs.gopls)]; - filetypes = ["go" "gomod" "gowork" "gotmpl"]; + filetypes = ["go" "gomod" "gosum" "gowork" "gotmpl"]; root_dir = mkLuaInline '' function(bufnr, on_dir) local fname = vim.api.nvim_buf_get_name(bufnr) @@ -78,6 +78,91 @@ package = pkgs.delve; }; }; + + defaultDiagnosticsProvider = ["golangci-lint"]; + diagnosticsProviders = { + golangci-lint = let + pkg = pkgs.golangci-lint; + in { + package = pkg; + config = { + cmd = getExe pkg; + args = [ + "run" + "--output.json.path=stdout" + "--issues-exit-code=0" + "--show-stats=false" + "--fix=false" + "--path-mode=abs" + # Overwrite values that could be configured and result in unwanted writes + "--output.text.path=" + "--output.tab.path=" + "--output.html.path=" + "--output.checkstyle.path=" + "--output.code-climate.path=" + "--output.junit-xml.path=" + "--output.teamcity.path=" + "--output.sarif.path=" + ]; + parser = mkLuaInline '' + function(output, bufnr) + local SOURCE = "golangci-lint"; + + local function display_tool_error(msg) + return{ + { + bufnr = bufnr, + lnum = 0, + col = 0, + message = string.format("[%s] %s", SOURCE, msg), + severity = vim.diagnostic.severity.ERROR, + source = SOURCE, + }, + } + end + + if output == "" then + return display_tool_error("no output provided") + end + + local ok, decoded = pcall(vim.json.decode, output) + if not ok then + return display_tool_error("failed to parse JSON output") + end + + if not decoded or not decoded.Issues then + return display_tool_error("unexpected output format") + end + + local severity_map = { + error = vim.diagnostic.severity.ERROR, + warning = vim.diagnostic.severity.WARN, + info = vim.diagnostic.severity.INFO, + hint = vim.diagnostic.severity.HINT, + } + local diagnostics = {} + for _, issue in ipairs(decoded.Issues) do + local sev = vim.diagnostic.severity.ERROR + if issue.Severity and issue.Severity ~= "" then + local normalized = issue.Severity:lower() + sev = severity_map[normalized] or vim.diagnostic.severity.ERROR + end + table.insert(diagnostics, { + bufnr = bufnr, + lnum = issue.Pos.Line - 1, + col = issue.Pos.Column - 1, + message = issue.Text, + code = issue.FromLinter, + severity = sev, + source = SOURCE, + }) + end + return diagnostics + end + ''; + }; + }; + }; in { options.vim.languages.go = { enable = mkEnableOption "Go language support"; @@ -85,7 +170,11 @@ in { treesitter = { enable = mkEnableOption "Go treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = mkGrammarOption pkgs "go"; + goPackage = mkGrammarOption pkgs "go"; + gomodPackage = mkGrammarOption pkgs "gomod"; + gosumPackage = mkGrammarOption pkgs "gosum"; + goworkPackage = mkGrammarOption pkgs "gowork"; + gotmplPackage = mkGrammarOption pkgs "gotmpl"; }; lsp = { @@ -134,12 +223,26 @@ in { default = debuggers.${cfg.dap.debugger}.package; }; }; + extraDiagnostics = { + enable = mkEnableOption "extra Go diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; + types = diagnostics { + langDesc = "Go"; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; + }; + }; }; config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { vim.treesitter.enable = true; - vim.treesitter.grammars = [cfg.treesitter.package]; + vim.treesitter.grammars = [ + cfg.treesitter.goPackage + cfg.treesitter.gomodPackage + cfg.treesitter.gosumPackage + cfg.treesitter.goworkPackage + cfg.treesitter.gotmplPackage + ]; }) (mkIf cfg.lsp.enable { @@ -179,5 +282,15 @@ in { debugger.nvim-dap.enable = true; }; }) + + (mkIf cfg.extraDiagnostics.enable { + vim.diagnostics.nvim-lint = { + enable = true; + linters_by_ft.go = cfg.extraDiagnostics.types; + linters = + mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;}) + cfg.extraDiagnostics.types); + }; + }) ]); } diff --git a/modules/plugins/languages/hcl.nix b/modules/plugins/languages/hcl.nix index 9e672396..5f8a4f0b 100644 --- a/modules/plugins/languages/hcl.nix +++ b/modules/plugins/languages/hcl.nix @@ -84,9 +84,14 @@ in { end }) - local ft = require('Comment.ft') - ft - .set('hcl', '#%s') + ${ + if config.vim.comments.comment-nvim.enable + then '' + local ft = require('Comment.ft') + ft.set('hcl', '#%s') + '' + else "" + } ''; } diff --git a/modules/plugins/languages/jinja.nix b/modules/plugins/languages/jinja.nix new file mode 100644 index 00000000..a4635f58 --- /dev/null +++ b/modules/plugins/languages/jinja.nix @@ -0,0 +1,65 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum listOf; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.attrsets) mapListToAttrs; + + cfg = config.vim.languages.jinja; + defaultServers = ["jinja-lsp"]; + servers = { + jinja-lsp = { + enable = true; + cmd = [(getExe pkgs.jinja-lsp)]; + filetypes = ["jinja"]; + root_markers = [ + ".git" + ]; + }; + }; +in { + options.vim.languages.jinja = { + enable = mkEnableOption "Jinja template language support"; + + treesitter = { + enable = mkEnableOption "Jinja treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "jinja"; + inlinePackage = mkGrammarOption pkgs "jinja_inline"; + }; + + lsp = { + enable = mkEnableOption "Jinja LSP support" // {default = config.vim.lsp.enable;}; + servers = mkOption { + description = "Jinja LSP server to use"; + type = listOf (enum (attrNames servers)); + default = defaultServers; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [ + cfg.treesitter.package + cfg.treesitter.inlinePackage + ]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.servers = + mapListToAttrs (n: { + name = n; + value = servers.${n}; + }) + cfg.lsp.servers; + }) + ]); +} diff --git a/modules/plugins/languages/make.nix b/modules/plugins/languages/make.nix new file mode 100644 index 00000000..f7780cd9 --- /dev/null +++ b/modules/plugins/languages/make.nix @@ -0,0 +1,93 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.meta) getExe; + inherit (lib.types) listOf enum; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.types) mkGrammarOption diagnostics; + inherit (lib.nvim.attrsets) mapListToAttrs; + + cfg = config.vim.languages.make; + + defaultFormat = ["bake"]; + formats = { + bake = { + command = "${pkgs.mbake}/bin/mbake"; + }; + }; + + defaultDiagnosticsProvider = ["checkmake"]; + diagnosticsProviders = { + checkmake = { + config = { + cmd = getExe pkgs.checkmake; + }; + }; + }; +in { + options.vim.languages.make = { + enable = mkEnableOption "Make support"; + + treesitter = { + enable = mkEnableOption "Make treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "make"; + }; + + format = { + enable = mkEnableOption "Make formatting" // {default = config.vim.languages.enableFormat;}; + type = mkOption { + description = "make formatter to use"; + type = listOf (enum (attrNames formats)); + default = defaultFormat; + }; + }; + + extraDiagnostics = { + enable = mkEnableOption "extra Make diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; + types = diagnostics { + langDesc = "Make"; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter = { + enable = true; + grammars = [cfg.treesitter.package]; + }; + }) + + (mkIf cfg.format.enable { + vim.formatter.conform-nvim = { + enable = true; + setupOpts = { + formatters_by_ft.make = cfg.format.type; + formatters = + mapListToAttrs (name: { + inherit name; + value = formats.${name}; + }) + cfg.format.type; + }; + }; + }) + + (mkIf cfg.extraDiagnostics.enable { + vim.diagnostics.nvim-lint = { + enable = true; + linters_by_ft.make = cfg.extraDiagnostics.types; + linters = + mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;}) + cfg.extraDiagnostics.types); + }; + }) + ]); +} diff --git a/modules/plugins/languages/markdown.nix b/modules/plugins/languages/markdown.nix index a2634e6d..76b1e92f 100644 --- a/modules/plugins/languages/markdown.nix +++ b/modules/plugins/languages/markdown.nix @@ -5,7 +5,7 @@ ... }: let inherit (builtins) attrNames; - inherit (lib.meta) getExe; + inherit (lib.meta) getExe getExe'; inherit (lib.modules) mkIf mkMerge; inherit (lib.options) mkEnableOption mkOption; inherit (lib.types) bool enum listOf str nullOr; @@ -55,6 +55,15 @@ prettierd = { command = getExe pkgs.prettierd; }; + mdformat = { + command = getExe' (pkgs.python313Packages.python.withPackages (p: + with p; [ + mdformat + mdformat-gfm + mdformat-frontmatter + mdformat-footnote + ])) "mdformat"; + }; }; defaultDiagnosticsProvider = ["markdownlint-cli2"]; diagnosticsProviders = { diff --git a/modules/plugins/languages/odin.nix b/modules/plugins/languages/odin.nix index fa2254c5..cee9b330 100644 --- a/modules/plugins/languages/odin.nix +++ b/modules/plugins/languages/odin.nix @@ -7,12 +7,15 @@ inherit (builtins) attrNames; inherit (lib.options) mkEnableOption mkOption; inherit (lib.modules) mkIf mkMerge; - inherit (lib.types) enum; + inherit (lib.types) enum package; + inherit (lib.nvim.dag) entryAfter; inherit (lib.meta) getExe; inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.attrsets) mapListToAttrs; + cfg = config.vim.languages.odin; + defaultServers = ["ols"]; servers = { ols = { @@ -32,7 +35,19 @@ }; }; - cfg = config.vim.languages.odin; + defaultDebugger = "codelldb"; + debuggers = { + codelldb = { + package = pkgs.lldb; + dapConfig = '' + dap.adapters.codelldb = { + type = 'executable', + command = '${cfg.dap.package}/bin/lldb-dap', + name = 'codelldb' + } + ''; + }; + }; in { options.vim.languages.odin = { enable = mkEnableOption "Odin language support"; @@ -51,6 +66,22 @@ in { description = "Odin LSP server to use"; }; }; + + dap = { + enable = mkEnableOption "Enable Odin Debug Adapter" // {default = config.vim.languages.enableDAP;}; + + debugger = mkOption { + description = "Odin debugger to use"; + type = enum (attrNames debuggers); + default = defaultDebugger; + }; + + package = mkOption { + description = "Odin debugger package."; + type = package; + default = debuggers.${cfg.dap.debugger}.package; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -67,5 +98,18 @@ in { }) cfg.lsp.servers; }) + + (mkIf cfg.dap.enable { + vim = { + startPlugins = ["nvim-dap-odin"]; + debugger.nvim-dap.sources.odin-debugger = debuggers.${cfg.dap.debugger}.dapConfig; + pluginRC.nvim-dap-odin = entryAfter ["nvim-dap"] '' + require('nvim-dap-odin').setup({ + notifications = false -- contains no useful information + }) + ''; + debugger.nvim-dap.enable = true; + }; + }) ]); } diff --git a/modules/plugins/languages/php.nix b/modules/plugins/languages/php.nix index 193c0a1f..8d2af124 100644 --- a/modules/plugins/languages/php.nix +++ b/modules/plugins/languages/php.nix @@ -4,11 +4,12 @@ lib, ... }: let - inherit (builtins) attrNames; + inherit (builtins) attrNames toString; inherit (lib.options) mkEnableOption mkOption; inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; - inherit (lib.types) enum; + inherit (lib.types) enum int attrs listOf; + inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf; inherit (lib.nvim.attrsets) mapListToAttrs; inherit (lib.generators) mkLuaInline; @@ -64,6 +65,21 @@ root_markers = ["composer.json" ".git"]; }; }; + + defaultFormat = ["php_cs_fixer"]; + formats = { + php_cs_fixer = { + /* + Using 8.4 instead of 8.5 because of compatibility: + ```logs + 2026-02-08 00:42:23[ERROR] Formatter 'php_cs_fixer' error: PHP CS Fixer 3.87.2 + PHP runtime: 8.5.2 + PHP CS Fixer currently supports PHP syntax only up to PHP 8.4, current PHP version: 8.5.2. + ``` + */ + command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer"; + }; + }; in { options.vim.languages.php = { enable = mkEnableOption "PHP language support"; @@ -82,6 +98,38 @@ in { description = "PHP LSP server to use"; }; }; + + format = { + enable = mkEnableOption "PHP formatting" // {default = config.vim.languages.enableFormat;}; + + type = mkOption { + description = "PHP formatter to use"; + type = listOf (enum (attrNames formats)); + default = defaultFormat; + }; + }; + + dap = { + enable = mkEnableOption "Enable PHP Debug Adapter" // {default = config.vim.languages.enableDAP;}; + xdebug = { + adapter = mkOption { + type = attrs; + default = { + type = "executable"; + command = "${pkgs.nodePackages_latest.nodejs}/bin/node"; + args = [ + "${pkgs.vscode-extensions.xdebug.php-debug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js" + ]; + }; + description = "XDebug adapter to use for nvim-dap"; + }; + port = mkOption { + type = int; + default = 9003; + description = "Port to use for XDebug"; + }; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -98,5 +146,39 @@ in { }) cfg.lsp.servers; }) + + (mkIf cfg.format.enable { + vim.formatter.conform-nvim = { + enable = true; + setupOpts = { + formatters_by_ft.php = cfg.format.type; + formatters = + mapListToAttrs (name: { + inherit name; + value = formats.${name}; + }) + cfg.format.type; + }; + }; + }) + + (mkIf cfg.dap.enable { + vim = { + debugger.nvim-dap = { + enable = true; + sources.php-debugger = '' + dap.adapters.xdebug = ${toLuaObject cfg.dap.xdebug.adapter} + dap.configurations.php = { + { + type = 'xdebug', + request = 'launch', + name = 'Listen for XDebug', + port = ${toString cfg.dap.xdebug.port}, + }, + } + ''; + }; + }; + }) ]); } diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index 04d2554f..4c777e3e 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -11,7 +11,7 @@ inherit (lib.modules) mkIf mkMerge; inherit (lib.types) enum package bool; inherit (lib.nvim.attrsets) mapListToAttrs; - inherit (lib.nvim.types) deprecatedSingleOrListOf; + inherit (lib.nvim.types) deprecatedSingleOrListOf diagnostics; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryBefore; inherit (lib.trivial) warn; @@ -278,6 +278,14 @@ ''; }; }; + defaultDiagnosticsProvider = ["mypy"]; + diagnosticsProviders = { + mypy = { + config = { + cmd = getExe' pkgs.mypy "mypy"; + }; + }; + }; in { options.vim.languages.python = { enable = mkEnableOption "Python language support"; @@ -335,6 +343,15 @@ in { ''; }; }; + + extraDiagnostics = { + enable = mkEnableOption "extra Python diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; + types = diagnostics { + langDesc = "Python"; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -404,5 +421,15 @@ in { vim.debugger.nvim-dap.enable = true; vim.debugger.nvim-dap.sources.python-debugger = debuggers.${cfg.dap.debugger}.dapConfig; }) + + (mkIf cfg.extraDiagnostics.enable { + vim.diagnostics.nvim-lint = { + enable = true; + linters_by_ft.python = cfg.extraDiagnostics.types; + linters = + mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;}) + cfg.extraDiagnostics.types); + }; + }) ]); } diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix index 3c49d271..ec5a3d81 100644 --- a/modules/plugins/languages/rust.nix +++ b/modules/plugins/languages/rust.nix @@ -11,7 +11,7 @@ inherit (lib.lists) isList; inherit (lib.attrsets) attrNames; inherit (lib.types) bool package str listOf either enum int; - inherit (lib.nvim.lua) expToLua toLuaObject; + inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.attrsets) mapListToAttrs; inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf; inherit (lib.nvim.dag) entryAfter entryAnywhere; @@ -169,7 +169,7 @@ in { server = { cmd = ${ if isList cfg.lsp.package - then expToLua cfg.lsp.package + then toLuaObject cfg.lsp.package else ''{"${cfg.lsp.package}/bin/rust-analyzer"}'' }, default_settings = { @@ -228,10 +228,17 @@ in { (mkIf cfg.extensions.crates-nvim.enable { vim = mkMerge [ { - startPlugins = ["crates-nvim"]; - pluginRC.rust-crates = entryAnywhere '' - require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts}) - ''; + lazy.plugins.crates-nvim = { + package = "crates-nvim"; + setupModule = "crates"; + setupOpts = cfg.extensions.crates-nvim.setupOpts; + event = [ + { + event = "BufRead"; + pattern = "Cargo.toml"; + } + ]; + }; } ]; }) diff --git a/modules/plugins/languages/tera.nix b/modules/plugins/languages/tera.nix new file mode 100644 index 00000000..7e1d5573 --- /dev/null +++ b/modules/plugins/languages/tera.nix @@ -0,0 +1,28 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (lib.options) mkEnableOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.types) mkGrammarOption; + + cfg = config.vim.languages.tera; +in { + options.vim.languages.tera = { + enable = mkEnableOption "Tera templating language support"; + + treesitter = { + enable = mkEnableOption "Tera treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "tera"; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + ]); +} diff --git a/modules/plugins/languages/toml.nix b/modules/plugins/languages/toml.nix index d771925b..9a5ec948 100644 --- a/modules/plugins/languages/toml.nix +++ b/modules/plugins/languages/toml.nix @@ -8,12 +8,12 @@ inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; inherit (lib.options) mkEnableOption mkOption; - inherit (lib.types) bool enum; + inherit (lib.types) enum; inherit (lib.nvim.types) diagnostics mkGrammarOption deprecatedSingleOrListOf; inherit (lib.nvim.attrsets) mapListToAttrs; cfg = config.vim.languages.toml; - defaultServers = ["tombi"]; + defaultServers = ["taplo"]; servers = { tombi = { enable = true; @@ -27,9 +27,21 @@ ".git" ]; }; + taplo = { + enable = true; + cmd = [ + (getExe pkgs.taplo) + "lsp" + "stdio" + ]; + filetypes = ["toml"]; + root_markers = [ + ".git" + ]; + }; }; - defaultFormat = ["tombi"]; + defaultFormat = ["taplo"]; formats = { tombi = { command = getExe pkgs.tombi; @@ -40,6 +52,15 @@ "-" ]; }; + taplo = { + command = getExe pkgs.taplo; + args = [ + "format" + "--stdin-filepath" + "$FILENAME" + "-" + ]; + }; }; defaultDiagnosticsProvider = ["tombi"]; diagnosticsProviders = { diff --git a/modules/plugins/languages/xml.nix b/modules/plugins/languages/xml.nix new file mode 100644 index 00000000..351232a9 --- /dev/null +++ b/modules/plugins/languages/xml.nix @@ -0,0 +1,62 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.types) enum listOf; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.attrsets) mapListToAttrs; + + cfg = config.vim.languages.xml; + + defaultServers = ["lemminx"]; + servers = { + lemminx = { + enable = true; + cmd = [ + (getExe pkgs.lemminx) + ]; + filetypes = ["xml"]; + root_markers = [".git"]; + }; + }; +in { + options.vim.languages.xml = { + enable = mkEnableOption "XML language support"; + + treesitter = { + enable = mkEnableOption "XML treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "xml"; + }; + + lsp = { + enable = mkEnableOption "XML LSP support" // {default = config.vim.lsp.enable;}; + servers = mkOption { + type = listOf (enum (attrNames servers)); + default = defaultServers; + description = "XML LSP server to use"; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.servers = + mapListToAttrs (name: { + inherit name; + value = servers.${name}; + }) + cfg.lsp.servers; + }) + ]); +} diff --git a/modules/plugins/lsp/config.nix b/modules/plugins/lsp/config.nix index 791b72b7..a75a5c9e 100644 --- a/modules/plugins/lsp/config.nix +++ b/modules/plugins/lsp/config.nix @@ -48,7 +48,7 @@ in { default_on_attach(client, bufnr) ${optionalString cfg.inlayHints.enable '' - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) end ''} diff --git a/modules/plugins/lsp/harper-ls/config.nix b/modules/plugins/lsp/harper-ls/config.nix index d6e27bfc..41a51c62 100644 --- a/modules/plugins/lsp/harper-ls/config.nix +++ b/modules/plugins/lsp/harper-ls/config.nix @@ -11,9 +11,47 @@ in { config = mkIf (cfg.enable && cfg.harper-ls.enable) { vim.lsp.servers.harper-ls = { - root_markers = [".git"]; + root_markers = [".git" ".harper-dictionary.txt"]; cmd = [(getExe pkgs.harper) "--stdio"]; settings = {harper-ls = cfg.harper-ls.settings;}; + filetypes = + # + [ + "asciidoc" + "c" + "clojure" + "cmake" + "cpp" + "cs" + "daml" + "dart" + "gitcommit" + "go" + "haskell" + "html" + "ink" + "java" + "javascript" + "javascriptreact" + "kotlin" + "lhaskell" + "lua" + "mail" + "markdown" + "nix" + "php" + "python" + "ruby" + "rust" + "scala" + "sh" + "swift" + "text" + "toml" + "typescript" + "typescriptreact" + "typst" + ]; }; }; } diff --git a/modules/plugins/minimap/codewindow/codewindow.nix b/modules/plugins/minimap/codewindow/codewindow.nix index 381e3102..9ad48c9f 100644 --- a/modules/plugins/minimap/codewindow/codewindow.nix +++ b/modules/plugins/minimap/codewindow/codewindow.nix @@ -1,6 +1,7 @@ {lib, ...}: let inherit (lib.options) mkEnableOption; inherit (lib.nvim.binds) mkMappingOption; + inherit (lib.nvim.types) mkPluginSetupOption; in { options.vim.minimap.codewindow = { enable = mkEnableOption "codewindow plugin for minimap view"; @@ -11,5 +12,7 @@ in { toggle = mkMappingOption "Toggle minimap [codewindow]" "mm"; toggleFocus = mkMappingOption "Toggle minimap focus [codewindow]" "mf"; }; + + setupOpts = mkPluginSetupOption "codewindow" {}; }; } diff --git a/modules/plugins/minimap/codewindow/config.nix b/modules/plugins/minimap/codewindow/config.nix index 8a62ee04..020eab7d 100644 --- a/modules/plugins/minimap/codewindow/config.nix +++ b/modules/plugins/minimap/codewindow/config.nix @@ -6,6 +6,7 @@ }: let inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault; cfg = config.vim.minimap.codewindow; @@ -32,9 +33,7 @@ in { pluginRC.codewindow = entryAnywhere '' local codewindow = require('codewindow') - codewindow.setup({ - exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, - }) + codewindow.setup(${toLuaObject cfg.setupOpts}) ''; }; }; diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index 1cee089f..ef0b1787 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -80,7 +80,7 @@ mode = mkOption { description = "Set the display mode"; - type = nullOr (enum ["foreground" "background"]); + type = nullOr (enum ["foreground" "background" "virtualtext"]); default = null; }; diff --git a/modules/plugins/ui/noice/config.nix b/modules/plugins/ui/noice/config.nix index 1f81f4a9..e4721b66 100644 --- a/modules/plugins/ui/noice/config.nix +++ b/modules/plugins/ui/noice/config.nix @@ -6,8 +6,6 @@ }: let inherit (lib.modules) mkIf; inherit (lib.lists) optionals; - inherit (lib.nvim.lua) toLuaObject; - inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.noice; tscfg = config.vim.treesitter; @@ -16,16 +14,15 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = [ - "noice-nvim" - "nui-nvim" - ]; - + startPlugins = ["nui-nvim"]; treesitter.grammars = optionals tscfg.addDefaultGrammars defaultGrammars; - pluginRC.noice-nvim = entryAnywhere '' - require("noice").setup(${toLuaObject cfg.setupOpts}) - ''; + lazy.plugins.noice-nvim = { + package = "noice-nvim"; + setupModule = "noice"; + event = ["DeferredUIEnter"]; + inherit (cfg) setupOpts; + }; }; }; } diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 2e00e270..ab116483 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -9,6 +9,7 @@ ./harpoon ./icon-picker ./images + ./grug-far-nvim ./leetcode-nvim ./mkdir ./motion diff --git a/modules/plugins/utility/grug-far-nvim/config.nix b/modules/plugins/utility/grug-far-nvim/config.nix new file mode 100644 index 00000000..9859c7db --- /dev/null +++ b/modules/plugins/utility/grug-far-nvim/config.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + + cfg = config.vim.utility.grug-far-nvim; +in { + config = { + vim.lazy.plugins.grug-far-nvim = mkIf cfg.enable { + package = "grug-far-nvim"; + cmd = [ + "GrugFar" + "GrugFarWithin" + ]; + setupModule = "grug-far"; + setupOpts = cfg.setupOpts; + }; + }; +} diff --git a/modules/plugins/utility/grug-far-nvim/default.nix b/modules/plugins/utility/grug-far-nvim/default.nix new file mode 100644 index 00000000..80a10a27 --- /dev/null +++ b/modules/plugins/utility/grug-far-nvim/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./grug-far-nvim.nix + ./config.nix + ]; +} diff --git a/modules/plugins/utility/grug-far-nvim/grug-far-nvim.nix b/modules/plugins/utility/grug-far-nvim/grug-far-nvim.nix new file mode 100644 index 00000000..4795832e --- /dev/null +++ b/modules/plugins/utility/grug-far-nvim/grug-far-nvim.nix @@ -0,0 +1,9 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.utility.grug-far-nvim = { + enable = mkEnableOption "grug-far"; + setupOpts = mkPluginSetupOption "grug-far" {}; + }; +} diff --git a/modules/plugins/utility/images/img-clip/config.nix b/modules/plugins/utility/images/img-clip/config.nix index cadd815f..9c23ce23 100644 --- a/modules/plugins/utility/images/img-clip/config.nix +++ b/modules/plugins/utility/images/img-clip/config.nix @@ -15,7 +15,7 @@ in { "img-clip" ]; - pluginRC.image-nvim = entryAnywhere '' + pluginRC.img-clip = entryAnywhere '' require("img-clip").setup(${toLuaObject cfg.setupOpts}) ''; }; diff --git a/modules/plugins/visuals/blink-indent/blink-indent.nix b/modules/plugins/visuals/blink-indent/blink-indent.nix new file mode 100644 index 00000000..edac61f8 --- /dev/null +++ b/modules/plugins/visuals/blink-indent/blink-indent.nix @@ -0,0 +1,9 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.visuals.blink-indent = { + enable = mkEnableOption "indentation guides [blink-indent]"; + setupOpts = mkPluginSetupOption "blink-indent" {}; + }; +} diff --git a/modules/plugins/visuals/blink-indent/config.nix b/modules/plugins/visuals/blink-indent/config.nix new file mode 100644 index 00000000..7a05e7fc --- /dev/null +++ b/modules/plugins/visuals/blink-indent/config.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + + cfg = config.vim.visuals.blink-indent; +in { + config = mkIf cfg.enable { + vim.lazy.plugins.blink-indent = { + package = "blink-indent"; + setupModule = "blink.indent"; + inherit (cfg) setupOpts; + + event = ["BufEnter"]; + }; + }; +} diff --git a/modules/plugins/visuals/blink-indent/default.nix b/modules/plugins/visuals/blink-indent/default.nix new file mode 100644 index 00000000..b9f9083d --- /dev/null +++ b/modules/plugins/visuals/blink-indent/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./blink-indent.nix + ]; +} diff --git a/modules/plugins/visuals/default.nix b/modules/plugins/visuals/default.nix index 3caf6e32..228d8c43 100644 --- a/modules/plugins/visuals/default.nix +++ b/modules/plugins/visuals/default.nix @@ -7,6 +7,7 @@ in { toggles under individual options. '') + ./blink-indent ./cellular-automaton ./cinnamon-nvim ./fidget-nvim @@ -18,5 +19,6 @@ in { ./nvim-web-devicons ./rainbow-delimiters ./tiny-devicons-auto-colors + ./syntax-gaslighting ]; } diff --git a/modules/plugins/visuals/nvim-web-devicons/config.nix b/modules/plugins/visuals/nvim-web-devicons/config.nix index 9c8e9418..98f54e34 100644 --- a/modules/plugins/visuals/nvim-web-devicons/config.nix +++ b/modules/plugins/visuals/nvim-web-devicons/config.nix @@ -4,18 +4,17 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib.nvim.lua) toLuaObject; - inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.visuals.nvim-web-devicons; in { config = mkIf cfg.enable { vim = { - startPlugins = ["nvim-web-devicons"]; - - pluginRC.nvim-web-devicons = entryAnywhere '' - require("nvim-web-devicons").setup(${toLuaObject cfg.setupOpts}) - ''; + lazy.plugins.nvim-web-devicons = { + package = "nvim-web-devicons"; + setupModule = "nvim-web-devicons"; + event = ["DeferredUIEnter"]; + inherit (cfg) setupOpts; + }; }; }; } diff --git a/modules/plugins/visuals/nvim-web-devicons/nvim-web-devicons.nix b/modules/plugins/visuals/nvim-web-devicons/nvim-web-devicons.nix index 6ff22614..b54ddcd5 100644 --- a/modules/plugins/visuals/nvim-web-devicons/nvim-web-devicons.nix +++ b/modules/plugins/visuals/nvim-web-devicons/nvim-web-devicons.nix @@ -1,6 +1,6 @@ {lib, ...}: let inherit (lib.modules) mkRenamedOptionModule; - inherit (lib.options) mkOption mkEnableOption literalExpression; + inherit (lib.options) mkOption mkEnableOption; inherit (lib.types) nullOr attrsOf attrs enum; inherit (lib.nvim.types) mkPluginSetupOption; in { @@ -16,27 +16,27 @@ in { variant = mkOption { type = nullOr (enum ["light" "dark"]); default = null; - description = "Set the light or dark variant manually, instead of relying on `background`"; + description = '' + Set the light or dark variant manually, instead of relying on `background` + ''; }; override = mkOption { type = attrsOf attrs; default = {}; - example = literalExpression '' - { - zsh = { - name = "Zsh"; - icon = ""; - color = "#428850"; - cterm_color = "65"; - }; - } - ''; + example = { + zsh = { + name = "Zsh"; + icon = ""; + color = "#428850"; + cterm_color = "65"; + }; + }; description = '' Your personal icon overrides. - You can specify color or cterm_color instead of specifying - both of them. DevIcon will be appended to `name` + You can specify color or `cterm_color` instead of specifying both of + them. `DevIcon` will be appended to `name` ''; }; }; diff --git a/modules/plugins/visuals/syntax-gaslighting/config.nix b/modules/plugins/visuals/syntax-gaslighting/config.nix new file mode 100644 index 00000000..68bafde4 --- /dev/null +++ b/modules/plugins/visuals/syntax-gaslighting/config.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.visuals.syntax-gaslighting; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = ["syntax-gaslighting"]; + pluginRC.colorful-menu-nvim = entryAnywhere '' + require("syntax-gaslighting").setup(${toLuaObject cfg.setupOpts}) + ''; + }; + }; +} diff --git a/modules/plugins/visuals/syntax-gaslighting/default.nix b/modules/plugins/visuals/syntax-gaslighting/default.nix new file mode 100644 index 00000000..bb0ad198 --- /dev/null +++ b/modules/plugins/visuals/syntax-gaslighting/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./syntax-gaslighting.nix + ./config.nix + ]; +} diff --git a/modules/plugins/visuals/syntax-gaslighting/syntax-gaslighting.nix b/modules/plugins/visuals/syntax-gaslighting/syntax-gaslighting.nix new file mode 100644 index 00000000..1de37411 --- /dev/null +++ b/modules/plugins/visuals/syntax-gaslighting/syntax-gaslighting.nix @@ -0,0 +1,28 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) str nullOr listOf bool; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.visuals = { + syntax-gaslighting = { + enable = mkEnableOption "Thats no even a real option, you're crazy."; + + setupOpts = mkPluginSetupOption "syntax-gaslighting" { + messages = mkOption { + type = nullOr (listOf str); + default = null; + description = "Custom messages for gaslighting."; + }; + + merge_messages = mkOption { + type = bool; + default = false; + description = '' + Merge user messages with the default ones. + If disabled, the messages table will override default messages. + ''; + }; + }; + }; + }; +} diff --git a/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix b/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix index 5b2102ce..53a52fe6 100644 --- a/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix +++ b/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix @@ -11,7 +11,8 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = ["tiny-devicons-auto-colors-nvim" "nvim-web-devicons"]; + startPlugins = ["tiny-devicons-auto-colors-nvim"]; + visuals.nvim-web-devicons.enable = true; pluginRC.tiny-devicons-auto-colors = entryAnywhere '' require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts}) diff --git a/modules/wrapper/build/config.nix b/modules/wrapper/build/config.nix index 907983ed..dc4bebe5 100644 --- a/modules/wrapper/build/config.nix +++ b/modules/wrapper/build/config.nix @@ -9,7 +9,7 @@ inherit (lib.trivial) flip; inherit (builtins) filter isString hasAttr getAttr; - getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {}); + getPin = flip getAttr (inputs.mnw.lib.npinsToPluginsAttrs pkgs ../../../npins/sources.json); # Build a Vim plugin with the given name and arguments. buildPlug = attrs: let @@ -94,7 +94,7 @@ nodeJs.enable = config.vim.withNodeJs; python3 = { enable = config.vim.withPython3; - extraPackages = ps: map (flip builtins.getAttr ps) config.vim.python3Packages; + extraPackages = ps: (map (flip builtins.getAttr ps) config.vim.python3Packages) ++ [ps.pynvim]; }; }; diff --git a/modules/wrapper/environment/options.nix b/modules/wrapper/environment/options.nix index 5b2f1f63..fdc07053 100644 --- a/modules/wrapper/environment/options.nix +++ b/modules/wrapper/environment/options.nix @@ -106,16 +106,9 @@ in { ''; }; - # This defaults to `true` in the wrapper - # and since we pass this value to the wrapper - # with an inherit, it should be `true` here as well - withRuby = - mkEnableOption '' - Ruby support in the Neovim wrapper. - '' - // { - default = true; - }; + withRuby = mkEnableOption '' + Ruby support in the Neovim wrapper + ''; withNodeJs = mkEnableOption '' NodeJS support in the Neovim wrapper diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 77a62d58..50211d2e 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -39,6 +39,7 @@ in { getOpts = keymap: { inherit (keymap) desc silent nowait script expr unique noremap; + remap = !keymap.noremap; }; toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})"; diff --git a/npins/sources.json b/npins/sources.json index 9bbcb6ff..05b662ff 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -91,6 +91,19 @@ "url": "https://github.com/moyiz/blink-emoji.nvim/archive/f22ce8cac02a6ece05368220f1e38bd34fe376f9.tar.gz", "hash": "sha256-pPHESNsByHg2liNUYkUEVR1wP1MZcil1sKTqrNI53e4=" }, + "blink-indent": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "saghen", + "repo": "blink.indent" + }, + "branch": "main", + "submodules": false, + "revision": "9c80820ca77218a8d28e70075d6f44a1609911fe", + "url": "https://github.com/saghen/blink.indent/archive/9c80820ca77218a8d28e70075d6f44a1609911fe.tar.gz", + "hash": "sha256-SS66JZFCX8viYxYaObASlwtrG5h7yHbVvRBVXBNXkng=" + }, "blink-ripgrep-nvim": { "type": "Git", "repository": { @@ -643,6 +656,19 @@ "url": "https://github.com/ellisonleao/glow.nvim/archive/5d5954b2f22e109d4a6eba8b2618c5b96e4ee7a2.tar.gz", "hash": "sha256-CvBcmVWBgI+m+PS7p7PmsiPtTEfqx2kpIzz4mImONIc=" }, + "grug-far-nvim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "MagicDuck", + "repo": "grug-far.nvim" + }, + "branch": "main", + "submodules": false, + "revision": "275dbedc96e61a6b8d1dfb28ba51586ddd233dcf", + "url": "https://github.com/MagicDuck/grug-far.nvim/archive/275dbedc96e61a6b8d1dfb28ba51586ddd233dcf.tar.gz", + "hash": "sha256-qn1BTNCX0Sm158Lv5JfHThqlJX9ualCIlc+RCjWa+t8=" + }, "gruvbox": { "type": "Git", "repository": { @@ -973,9 +999,9 @@ }, "branch": "main", "submodules": false, - "revision": "de79a7626d54d7785436105ef72f37ee8fe8fa16", - "url": "https://github.com/OXY2DEV/markview.nvim/archive/de79a7626d54d7785436105ef72f37ee8fe8fa16.tar.gz", - "hash": "sha256-kGhohG4Aw9wMceLiX+s2HCWIyWuJYHoa9D80elM1UQw=" + "revision": "c81ce9ed129387fc5fdec91abe9818a1b0e6fcac", + "url": "https://github.com/OXY2DEV/markview.nvim/archive/c81ce9ed129387fc5fdec91abe9818a1b0e6fcac.tar.gz", + "hash": "sha256-CoPfVkPWh5neyIT1rVEHMLo7532lWvbv0Gg/27D0PHw=" }, "mellow": { "type": "Git", @@ -1860,6 +1886,19 @@ "url": "https://github.com/leoluz/nvim-dap-go/archive/b4421153ead5d726603b02743ea40cf26a51ed5f.tar.gz", "hash": "sha256-wg9kiW2eAMmg4bvgqaAS9kt7qaVsIWl36BNqRbhZIgo=" }, + "nvim-dap-odin": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "NANDquark", + "repo": "nvim-dap-odin" + }, + "branch": "main", + "submodules": false, + "revision": "4df40d467f4ea5195e2f3b813d970eb15172b052", + "url": "https://github.com/NANDquark/nvim-dap-odin/archive/4df40d467f4ea5195e2f3b813d970eb15172b052.tar.gz", + "hash": "sha256-/bW22gWrPamK4jDMJYDv/3od+vIUb/eYICnHWnv8MVU=" + }, "nvim-dap-ui": { "type": "Git", "repository": { @@ -2116,9 +2155,9 @@ }, "branch": "master", "submodules": false, - "revision": "b8221e42cf7287c4dcde81f232f58d7b947c210d", - "url": "https://github.com/nvim-tree/nvim-web-devicons/archive/b8221e42cf7287c4dcde81f232f58d7b947c210d.tar.gz", - "hash": "sha256-lVrakFrpIP9lp7sMfMb33KeMPIkcn1qBFVytJzKCfuE=" + "revision": "746ffbb17975ebd6c40142362eee1b0249969c5c", + "url": "https://github.com/nvim-tree/nvim-web-devicons/archive/746ffbb17975ebd6c40142362eee1b0249969c5c.tar.gz", + "hash": "sha256-jXWBPcfLwSkWQ/eRbxVDWC7kFOODSsCRmzC3rHKQLhQ=" }, "obsidian-nvim": { "type": "GitRelease", @@ -2528,6 +2567,19 @@ "url": "https://github.com/supermaven-inc/supermaven-nvim/archive/07d20fce48a5629686aefb0a7cd4b25e33947d50.tar.gz", "hash": "sha256-1z3WKIiikQqoweReUyK5O8MWSRN5y95qcxM6qzlKMME=" }, + "syntax-gaslighting": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "NotAShelf", + "repo": "syntax-gaslighting.nvim" + }, + "branch": "main", + "submodules": false, + "revision": "4cee4c0550e82b31e07424e0c44379920d716d79", + "url": "https://github.com/NotAShelf/syntax-gaslighting.nvim/archive/4cee4c0550e82b31e07424e0c44379920d716d79.tar.gz", + "hash": "sha256-sRg6UlK4hQubxf3ycGnMLi+tNvX3zvKgnHYVuZgmvOc=" + }, "tabular": { "type": "Git", "repository": { diff --git a/npins/sources.nix b/npins/sources.nix deleted file mode 100644 index 0b09e232..00000000 --- a/npins/sources.nix +++ /dev/null @@ -1,115 +0,0 @@ -{ - lib, - fetchurl, - fetchgit, - fetchzip, -}: -builtins.mapAttrs -( - name: spec: let - mayOverride = name: path: let - envVarName = "NPINS_OVERRIDE_${saneName}"; - saneName = builtins.concatStringsSep "_" ( - builtins.concatLists ( - builtins.filter (x: builtins.isList x && x != [""]) (builtins.split "([a-zA-Z0-9]*)" name) - ) - ); - ersatz = builtins.getEnv envVarName; - in - if ersatz == "" - then path - else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( - if builtins.substring 0 1 ersatz == "/" - then /. + ersatz - else /. + builtins.getEnv "PWD" + "/${ersatz}" - ); - - path = - rec { - GitRelease = Git; - Channel = Tarball; - - Git = - if spec.url != null && !spec.submodules - then Tarball - else - fetchgit ( - let - repo = spec.repository; - url = - { - Git = repo.url; - GitHub = "https://github.com/${repo.owner}/${repo.repo}.git"; - GitLab = "${repo.server}/${repo.repo_path}.git"; - Forgejo = "${repo.server}/${repo.owner}/${repo.repo}.git"; - } - .${ - repo.type - } or (throw "Unrecognized repository type ${repo.type}"); - in { - name = let - matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; - appendShort = - if (builtins.match "[a-f0-9]*" spec.revision) != null - then "-${builtins.substring 0 7 spec.revision}" - else ""; - in "${ - if matched == null - then "source" - else builtins.head matched - }${appendShort}"; - inherit url; - - rev = spec.revision; - inherit (spec) hash; - fetchSubmodules = spec.submodules; - } - ); - - PyPi = fetchurl { - inherit (spec) url hash; - }; - - Tarball = fetchzip { - inherit (spec) url hash; - extension = "tar"; - }; - } - .${ - spec.type - } or (builtins.throw "Unknown source type ${spec.type}"); - - version = - if spec ? revision - then builtins.substring 0 8 spec.revision - else "0"; - in - spec - // { - name = "${name}-${version}"; - pname = name; - inherit version; - outPath = - ( - # Override logic won't do anything if we're in pure eval - if builtins ? currentSystem - then mayOverride name path - else path - ).overrideAttrs - { - pname = name; - name = "${name}-${version}"; - inherit version; - }; - } -) -( - let - json = lib.importJSON ./sources.json; - in - assert lib.assertMsg (json.version == 7) "Unsupported format version ${toString json.version} in sources.json. Try running `npins upgrade`"; - json.pins -)