diff --git a/docs/languages.adoc b/docs/languages.adoc index a14e35f..4db7ddb 100644 --- a/docs/languages.adoc +++ b/docs/languages.adoc @@ -1,71 +1,17 @@ [[ch-languages]] == Language Support -Language specific support combines some combination of language specific plugins, `treesitter` support, `nvim-lspconfig` langauge servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have support beyond just `treesitter` highlighting. +Language specific support means there is a combination of language specific plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the `vim.languages` attribute. See the configuration docs for details. -[[sec-languages-rust]] -=== Rust +* Rust: <> +* Nix: <> +* SQL: <> +* C/C++: <> +* Typescript/Javascript: <> +* Python: <>: +* Zig: <> +* Markdown: <> +* HTML: <> -*LSP Server*: https://github.com/rust-analyzer/rust-analyzer[rust-analyzer] +Adding support for more languages, and improving support for existing ones are great places where you can contribute with a PR. -*Formatting*: Built into LSP, uses https://github.com/rust-lang/rustfmt[rustfmt] - -*Plugins*: See <> - -[[sec-languages-nix]] -=== Nix - -*LSP Server*: Choice between https://github.com/oxalica/nil[nil] and https://github.com/nix-community/rnix-lsp[rnix-lsp] - -*Formatting*: Choice between https://github.com/kamadorueda/alejandra[alejandra] and https://github.com/nix-community/nixpkgs-fmt[nixpkgs-fmt] - -[[sec-languages-sql]] -=== SQL - -*LSP Server*: https://github.com/lighttiger2505/sqls[sqls] - -*Formatting*: Disabled LSP formatting, instead using https://github.com/sqlfluff/sqlfluff[sqlfluff] - -*Linting*: https://github.com/sqlfluff/sqlfluff[sqlfluff] - -*Plugins*: See <> - -[[sec-languages-clang]] -=== C/C++ - -*LSP Server*: https://github.com/MaskRay/ccls[ccls] - -*Formatting*: Built into language server - -[[sec-languages-typescript]] -=== Typescript - -*LSP Server*: https://github.com/typescript-language-server/typescript-language-server[typescript-language-server] - -*Formatting*: Disabled LSP formatting, instead using https://github.com/prettier/prettier[prettier] - -*Linting*: https://github.com/prettier/prettier[eslint] - -[[sec-languages-python]] -=== Python - -*LSP Server*: https://github.com/microsoft/pyright[pyright] - -*Formatting*: https://github.com/psf/black[black] - -[[sec-languages-zig]] -=== Zig - -*LSP Server*: https://github.com/zigtools/zls[zls] - -*Formatting*: Built into LSP, uses `zig fmt`. - -[[sec-languages-markdown]] -=== Markdown - -*Plugins*: See <> - -[[sec-languages-html]] -=== HTML - -*Plugins*: See <> diff --git a/docs/manual.xml b/docs/manual.xml index a03698f..3f01228 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -21,7 +21,6 @@ - Configuration Options diff --git a/docs/plugins.adoc b/docs/plugins.adoc deleted file mode 100644 index 12e6f50..0000000 --- a/docs/plugins.adoc +++ /dev/null @@ -1,184 +0,0 @@ -[[ch-plugins]] -== Plugins - -The following are the neovim plugins used within neovim-flake. Some plugins are explicitly enabled by the user, while others are enabled implicitly. - -[[sec-plugins-autopairs]] -=== Autopairs - -* https://github.com/windwp/nvim-autopairs[nvim-autopairs] an autopair plugin for neovim - - -[[sec-plugins-assistant]] -=== Coding Assistants - -* https://github.com/zbirenbaum/copilot.lua[copilot.lua] a lua replacement for github.vim, the license nightmare AI assistant -* https://github.com/codota/tabnine-nvim[tabnine-nvim] neovim plugin for the more ethically acceptable AI assistant TabNine - -[[sec-plugins-buffer]] -=== Buffers - -* https://github.com/akinsho/bufferline.nvim[nvim-bufferline-lua] a buffer line with tab integration -* https://github.com/famiu/bufdelete.nvim[bufdelete-nvim] delete buffers without losing window layout - -[[sec-plugins-commenting]] -=== Commenting - -* https://github.com/b3nj5m1n/kommentary[kommentary] neovim plugin to comment text in and out, written in lua. Supports commenting out the current line, a visual selection and a motion -* https://github.com/folke/todo-comments.nvim[todo-comments.nvim] plugin to highlight and search for todo comments like TODO, HACK, BUG in your codebase - -[[sec-plugins-completions]] -=== Completions - -* https://github.com/hrsh7th/nvim-cmp[nvim-cmp] a completion engine that utilizes sources -** https://github.com/hrsh7th/cmp-buffer[cmp-buffer] a source for buffer words -** https://github.com/hrsh7th/cmp-nvim-lsp[cmp-nvim-lsp] a source for builtin LSP client -** https://github.com/hrsh7th/cmp-vsnip[cmp-vsnip] a source for vim-vsnip autocomplete -** https://github.com/hrsh7th/cmp-path[cmp-path] a source for path autocomplete -** https://github.com/ray-x/cmp-treesitter[cmp-treesitter] treesitter nodes autcomplete - -[[sec-plugins-dashboard]] -=== Dashboard - -* https://github.com/glepnir/dashboard-nvim[dashboard.nvim] fancy and blazing fast start screen plugin for Neovim -* https://github.com/goolord/alpha-nvim[alpha.nvim] a fast and fully programmable greeter for neovim -* https://github.com/mhinz/vim-startify[vim-startify] a fancy start screen for {neo,}vim - -[[sec-plugins-server]] -=== Language Server - -* https://github.com/neovim/nvim-lspconfig[nvim-lspconfig] common configurations for built-in language server -* https://github.com/jose-elias-alvarez/null-ls.nvim[null-ls.nvim] neovim as a language server to inject LSP diagnostics, code actions, etc. -* https://github.com/glepnir/lspsaga.nvim[lspsaga.nvim] useful UI and tools for lsp -* https://github.com/folke/trouble.nvim[trouble.nvim] pretty list of lsp data -* https://github.com/weilbith/nvim-code-action-menu[nvim-code-action-menu] a better code action menu with diff support -* https://github.com/ray-x/lsp_signature.nvim[lsp-signature] show function signatures as you type -* https://github.com/onsails/lspkind-nvim[lspkind-nvim] for pictograms in lsp (with support for nvim-cmp) - - -[[sec-plugins-statuslines]] -=== Statuslines - -* https://github.com/hoob3rt/lualine.nvim[lualine.nvim] statusline written in lua. - -[[sec-plugins-filetrees]] -=== Filetrees - -* https://github.com/kyazdani42/nvim-tree.lua[nvim-tree-lua] a file explorer tree written in lua. Using - -[[sec-plugins-git]] -=== Git - -* https://github.com/lewis6991/gitsigns.nvim[gitsigns.nvim] a variety of git decorations - -[[sec-plugins-treesitter]] -=== Treesitter - -* https://github.com/romgrk/nvim-treesitter-context[nvim-treesitter-context] a context bar using tree-sitter - -[[sec-plugins-visuals]] -=== Visuals - -* https://github.com/lukas-reineke/indent-blankline.nvim[indent-blankline] for indentation guides -* https://github.com/kyazdani42/nvim-web-devicons[nvim-web-devicons] plugins and colors for icons. Requires patched font -* https://github.com/declancm/cinnamon.nvim[cinnamon.nvim] smooth scrolling for ANY movement command -* https://github.com/nvim-cursorline[nvim-cursorline] a plugin for neovim that highlights cursor words and lines -* https://github.com/petertriho/nvim-scrollbar[nvim-scrollbar] a scrollbar plugin for neovim -* https://github.com/Eandrju/cellular-automaton.nvim[cellular-automaton] a vanity to plugin to help you procrastinate more efficiently - -[[sec-plugins-minimap]] -=== Minimap - -* https://github.com/wfxr/minimap.vim[minimap.vim] a blazing fast minimap plugin for neovim. Depends on code-minimap -* https://github.com/gorbit99/codewindow.nvim[codewindow.nvim] a simple, configurable minimap plugin for neovim with no external dependencies - -[[sec-plugins-notifications]] -=== Notifications - -* https://github.com/rcarriga/nvim-notify[nvim-notify] simple notification plugin that also integrates with noice.nvim - -[[sec-plugins-notes]] -=== Note-taking - -* https://github.com/obsidian.nvim[obsidian.nvim] a neovim plugin that deeply integrates with the obsidian markdown editor. Also works standalone -* https://github.com/nvim-orgmode/orgmode[orgmode] a neovim replacement for emac orgmode - -[[sec-plugins-session-management]] -=== Session Management - -* https://github.com/Shatur/neovim-session-manager[neovim-session-manager] a simple wrapper around :mksession - -[[sec-plugins-snippets]] -=== Snippets - -* https://github.com/hrsh7th/vim-vsnip[vim-vsnip] a snippet plugin that supports LSP/VSCode's snippet format - - -[[sec-plugins-terminal]] -=== Terminal - -* https://github.com/akinsho/toggleterm.nvim[toggleterm.nvim] a simple terminal plugin that opens a terminal buffer on demand - -[[sec-plugins-themes]] -=== Themes - -* https://github.com/navarasu/onedark.nvim[onedark] a dark colorscheme with multiple options -* https://github.com/folke/tokyonight.nvim[tokyonight-nvim] a neovim theme with multiple color options -* https://github.com/catppuccin/nvim[catppuccin] a pastel theme with 4 color options - - -[[sec-plugins-utilities]] -=== Utilities - -* https://github.com/nvim-telescope/telescope.nvim[telescope] an extendable fuzzy finder of lists. Working ripgrep and fd -* https://github.com/folke/which-key.nvim[which-key] a popup that displays possible keybindings of command being typed -* https://github.com/sudormrfbin/cheatsheet.nvim[cheatsheet.nvim] a searchable cheatsheet for neovim from within the editor using Telescope -* https://github.com/ga-rosa/ccc.nvim[ccc.nvim] super powerful color picker and colorizer plugin. -* https://github.com/ziontee113/icon-picker.nvim[icon-picker.nvim] an icon picker plugin that provides access to thousands of icons -* https://github.com/jbyuki/venn.nvim[venn.nvim] draw venn diagrams inside neovim - -[[sec-plugins-ui]] -=== UI Elements - -* https://github.com/folke/noice.nvim[noice.nvim] an experimental neovim plugin that replaces some UI components of neovim - - -[[sec-plugins-presence]] -=== Rich Presence - -* https://github.com/andweeb/presence.nvim[presence.nvim] light and powerful discord rich presence plugin - -[[sec-plugins-markdown]] -=== Markdown - -* https://github.com/ellisonleao/glow.nvim[glow.nvim] a markdown preview directly in neovim using glow - -[[sec-plugins-rust]] -=== Rust - -* https://github.com/simrat39/rust-tools.nvim[rust-tools] provides tools for rust -* https://github.com/Saecki/crates.nvim[crates.nvim] provides tools for working with `cargo.toml` - -[[sec-plugins-tidalcycles]] -=== Tidal Cycles - -* https://github.com/tidalcycles/vim-tidal[vim-tidal] for tidal cycles integration into vim - -[[sec-plugins-sql]] -=== SQL - -* https://github.com/nanotee/sqls.nvim[sqls.nvim] for useful actions that leverage `sqls` LSP - -[[sec-plugins-html]] -=== HTML - -* https://github.com/windwp/nvim-ts-autotag[nvim-ts-autotag] uses treesitter to autoclose/rename html tags - -[[sec-plugins-dependencies]] -=== Dependencies - -* https://github.com/nvim-lua/plenary.nvim[plenary] which is a dependency of some plugins, installed automatically if needed -* https://github.comstevearc/dressing.nvim[dressing.nvim] which is a dependency for icon-picker.nvim -* https://github.com/preservim/vim-markdown[vim-markdown] which is a dependency for obsidian.nvim -* https://github.comgodlygeek/tabular[tabular] which is a dependency for vim-markdown -* https://github.com/MunifTanjim/nui.nvim[nui.nvim] which is a dependency for nui-nvim diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc new file mode 100644 index 0000000..26b52c2 --- /dev/null +++ b/docs/release-notes/rl-0.3.adoc @@ -0,0 +1,17 @@ +* Treesitter grammars are now configurable with <>. Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions. See https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees[discourse] for more information. Packages can be found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute. Treesitter grammars for supported languages should be enabled within the module. By default no grammars are installed, thus the following grammars which do not have a language section are not included anymore: comment, toml, make, html, css, graphql, json. + +* A new section has been added for language support: `vim.languages.`. The options <>, <>, etc. will enable the respective section for all languages that have been enabled. +** All LSP languages have been moved here +** `plantuml` and `markdown` have been moved here +** A new section has been added for `html`. The old `vim.treesitter.autotagHtml` can be found at <>. + +* <> has been added allowing you to turn on gitsigns codeactions. + +* Removed the plugins document in the docs. Was too unwieldy to keep updated. + + +* `vim.visual.lspkind` has been moved to <> + +* Improved handling of completion formatting. When setting <>, can also include optional menu mapping. And can provide your own function with <>. + +* For <> and <> turning them off should use `null` rather than `""` now. diff --git a/extra.nix b/extra.nix index e80abaa..afa2df1 100644 --- a/extra.nix +++ b/extra.nix @@ -13,6 +13,10 @@ inputs: let configuration.imports = modules; }; + tidalConfig = { + config.vim.languages.tidal.enable = true; + }; + mainConfig = isMaximal: { config = { vim = { @@ -26,25 +30,35 @@ inputs: let }; vim.lsp = { - enable = true; formatOnSave = true; + lspkind.enable = false; lightbulb.enable = true; lspsaga.enable = false; nvimCodeActionMenu.enable = true; trouble.enable = true; lspSignature.enable = true; - elixir.enable = isMaximal; - rust.enable = isMaximal; - python = isMaximal; + }; + + vim.languages = { + enableLSP = true; + enableFormat = true; + enableTreesitter = true; + enableExtraDiagnostics = true; + + nix.enable = true; + html.enable = isMaximal; clang.enable = isMaximal; - sql = isMaximal; - ts = isMaximal; - go = isMaximal; - zig.enable = isMaximal; - nix = { - enable = true; - formatter = "alejandra"; + sql.enable = isMaximal; + rust = { + enable = isMaximal; + crates.enable = true; }; + ts.enable = isMaximal; + go.enable = isMaximal; + zig.enable = isMaximal; + python.enable = isMaximal; + dart.enable = isMaximal; + elixir.enable = isMaximal; }; vim.visuals = { @@ -54,11 +68,10 @@ inputs: let smoothScroll.enable = true; cellularAutomaton.enable = true; fidget-nvim.enable = true; - lspkind.enable = true; indentBlankline = { enable = true; - fillChar = ""; - eolChar = ""; + fillChar = null; + eolChar = null; showCurrContext = true; }; cursorWordline = { @@ -89,6 +102,9 @@ inputs: let vim.filetree = { nvimTreeLua = { enable = true; + renderer = { + rootFolderLabel = null; + }; view = { width = 25; }; @@ -99,28 +115,19 @@ inputs: let nvimBufferline.enable = true; }; - vim.treesitter = { - enable = true; - context.enable = true; - }; + vim.treesitter.context.enable = true; vim.binds = { whichKey.enable = true; cheatsheet.enable = true; }; - vim.telescope = { - enable = true; - }; - - vim.markdown = { - enable = true; - glow.enable = true; - }; + vim.telescope.enable = true; vim.git = { enable = true; gitsigns.enable = true; + gitsigns.codeActions = true; }; vim.minimap = { @@ -201,5 +208,5 @@ inputs: let }; }; in { - inherit neovimConfiguration mainConfig; + inherit neovimConfiguration mainConfig tidalConfig; } diff --git a/flake.lock b/flake.lock index 3680042..3013939 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "alpha-nvim": { "flake": false, "locked": { - "lastModified": 1679422215, - "narHash": "sha256-jNJ/0ueUXgArpWHypIkNA4hKrwYjthva7gK9JuE4VWM=", + "lastModified": 1681755353, + "narHash": "sha256-yiwFWoz7C+VYL0hrDobTINE4K1v4sbB8koZuURAKlzw=", "owner": "goolord", "repo": "alpha-nvim", - "rev": "dafa11a6218c2296df044e00f88d9187222ba6b0", + "rev": "87c204040e3f5d4c1c95067b35905d8f8a2f2545", "type": "github" }, "original": { @@ -35,11 +35,11 @@ "catppuccin": { "flake": false, "locked": { - "lastModified": 1679888068, - "narHash": "sha256-UrHoESRYwALPo6LFFocEIM0CZa740tjxjvmYES7O5Rw=", + "lastModified": 1681530540, + "narHash": "sha256-RPwRyuGTbVMAApdRsVUyHlcHYWRQ9bHlumJTov81Z0c=", "owner": "catppuccin", "repo": "nvim", - "rev": "73587f9c454da81679202f1668c30fea6cdafd5e", + "rev": "fa9a4465672fa81c06b23634c0f04f6a5d622211", "type": "github" }, "original": { @@ -147,11 +147,11 @@ "cmp-treesitter": { "flake": false, "locked": { - "lastModified": 1679830722, - "narHash": "sha256-t1xEQn6NXcNG215ldm0ivKZdgaoGFwDiZUb8ROBeZHU=", + "lastModified": 1680745848, + "narHash": "sha256-WOcg6w4M20gpMCZjZ3DpPIA55SGLjV75fhckefiVfU0=", "owner": "ray-x", "repo": "cmp-treesitter", - "rev": "c8e3a74b51597d69d240085a258636972ce98e15", + "rev": "389eadd48c27aa6dc0e6b992644704f026802a2e", "type": "github" }, "original": { @@ -179,11 +179,11 @@ "codewindow-nvim": { "flake": false, "locked": { - "lastModified": 1676695329, - "narHash": "sha256-q9mLpMLp3pLn+7D+JSod0ST3ke7EodRh3SoHfPzVic0=", + "lastModified": 1681491118, + "narHash": "sha256-AwGNTrfa/oro22yBKkzJNlVavnboFdEpMM4qXOZhQ/4=", "owner": "gorbit99", "repo": "codewindow.nvim", - "rev": "46b005fc5c40d512a2ec8e55e21b64afa6aaed00", + "rev": "985046dfb2b35cd3b214b70a9a056ec89b0c5498", "type": "github" }, "original": { @@ -195,11 +195,11 @@ "colorizer": { "flake": false, "locked": { - "lastModified": 1680271664, - "narHash": "sha256-UQwIf96eG79iEBDhQvfjByrAc+LXyKiT4EVrPe1+YmY=", + "lastModified": 1681750992, + "narHash": "sha256-TXKYJY4+ozr54jBa3rUuJuO1Y4nrHfsX0yrQs3wtMDQ=", "owner": "uga-rosa", "repo": "ccc.nvim", - "rev": "3e07b8ffc9dab162cd2940e75601da75ed0cebbe", + "rev": "a4a79302c2389f6852b1a655b47ea2edecccb081", "type": "github" }, "original": { @@ -211,11 +211,11 @@ "comment-nvim": { "flake": false, "locked": { - "lastModified": 1678452935, - "narHash": "sha256-mVJJJ9fUJYgVyGZnW8e6P5QWB0K8nuhTwSWzlBvxv2M=", + "lastModified": 1681289112, + "narHash": "sha256-Zrxf50YlAaCERZFAbg4Ece+wI4buHl+K2IIw0qpASGA=", "owner": "numToStr", "repo": "Comment.nvim", - "rev": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20", + "rev": "a89339ffbee677ab0521a483b6dac7e2e67c907e", "type": "github" }, "original": { @@ -227,11 +227,11 @@ "copilot-lua": { "flake": false, "locked": { - "lastModified": 1680027228, - "narHash": "sha256-3u+2azMRm24mp5iOrxwYg9QrM2xJHnSjGsldIDRS6HQ=", + "lastModified": 1681223911, + "narHash": "sha256-ttF9LW6PNKk/BBWET2BUqtq5f7OIZ7ohtQevAaP8srg=", "owner": "zbirenbaum", "repo": "copilot.lua", - "rev": "f0b41fb89ef2ed7ab4e8cd5208a30755aa638fc4", + "rev": "a4a37dda9e48986e5d2a90d6a3cbc88fca241dbb", "type": "github" }, "original": { @@ -243,11 +243,11 @@ "crates-nvim": { "flake": false, "locked": { - "lastModified": 1680384424, - "narHash": "sha256-0fgC3wEMc2fmxHPLHyt0UTdpvuAOkdhdfEDWJ6qA9Q0=", + "lastModified": 1680387248, + "narHash": "sha256-Qt3x9I1RzFtknxy3qJaaZczSLvO10OQ6N1+RLhfuQ7I=", "owner": "Saecki", "repo": "crates.nvim", - "rev": "097da7b79246247b8e660815c12908706031e09a", + "rev": "1d4bb1e7a0fe8bae3f97061be5fbf6f9081a27e2", "type": "github" }, "original": { @@ -259,11 +259,11 @@ "dashboard-nvim": { "flake": false, "locked": { - "lastModified": 1680074354, - "narHash": "sha256-V16XxNlFBGFtKsquqPy44+IFWiBZcs3OY/6SF+7bdrA=", + "lastModified": 1681720765, + "narHash": "sha256-7RBjr3svkEYgmWeB3GwksoHS8Ps74YcqNYBfynUaXvM=", "owner": "glepnir", "repo": "dashboard-nvim", - "rev": "4c2b038c5cfa70f90506f1551e5fd2d040174e08", + "rev": "275e7c8579858c3ee06f32c16bdc687153ca7204", "type": "github" }, "original": { @@ -275,11 +275,11 @@ "diffview-nvim": { "flake": false, "locked": { - "lastModified": 1680290718, - "narHash": "sha256-t4YC8xAjRA+6p7IPM71lL5wWY0pAwTqL7vom3cDSV44=", + "lastModified": 1681231146, + "narHash": "sha256-rtJafQUurQP4sVoKZlC8nrl8OwfY7jKI/RyfNfY8Fik=", "owner": "sindrets", "repo": "diffview.nvim", - "rev": "932d10de327bccdedee439d9d55f4d857caa334e", + "rev": "63720aa5a70ce4aa386be407d0e612cd9e63861a", "type": "github" }, "original": { @@ -305,14 +305,30 @@ "type": "github" } }, + "dracula": { + "flake": false, + "locked": { + "lastModified": 1681364507, + "narHash": "sha256-RJT+fYJyTD+8krT/+M6644ycJ2rzenPBd9NQpGjAMGw=", + "owner": "Mofiqul", + "repo": "dracula.nvim", + "rev": "b5bd9c7e4c6c8f4712610bda92140c735fe90521", + "type": "github" + }, + "original": { + "owner": "Mofiqul", + "repo": "dracula.nvim", + "type": "github" + } + }, "dressing-nvim": { "flake": false, "locked": { - "lastModified": 1677218794, - "narHash": "sha256-89HwP+zxMN5CPPN3dd3yMfCB07mtBhv6lcWuEWnedfw=", + "lastModified": 1681303966, + "narHash": "sha256-8HSxDkHxrjNCT9OpI3Fxt4bwLM49UmdH2TtQWGzyzXo=", "owner": "stevearc", "repo": "dressing.nvim", - "rev": "5f44f829481640be0f96759c965ae22a3bcaf7ce", + "rev": "0e3e1eba147fee6e638ac1ac28f0495bcde17319", "type": "github" }, "original": { @@ -324,11 +340,11 @@ "elixir-ls": { "flake": false, "locked": { - "lastModified": 1681462421, - "narHash": "sha256-pIwZFiCLJ0f7OXi1iTza04KSn7rpFpvUsNYrFh0FoEM=", + "lastModified": 1681745218, + "narHash": "sha256-b3mlcwV4eHR90e9BExhb51T5A7dQVMwXRRIGqKEFBzg=", "owner": "elixir-lsp", "repo": "elixir-ls", - "rev": "85cfc5604edeadb0a6a683c41abff60a0c959de7", + "rev": "bf9db5a29efb2331da6cfbc526ecbfc10d372abc", "type": "github" }, "original": { @@ -340,11 +356,11 @@ "elixir-tools": { "flake": false, "locked": { - "lastModified": 1681453321, - "narHash": "sha256-7QgWrdq4p5t8WVnFhL5P948JFPR0i2C06kisxl30D2U=", + "lastModified": 1681746276, + "narHash": "sha256-1ZCFU79xZW52Dtx864hxeANzn+L15fnfso2NBnzBvOU=", "owner": "elixir-tools", "repo": "elixir-tools.nvim", - "rev": "8ccb696c048eca667486ee005f4386c0db8c5e14", + "rev": "7b42d9131521a11cfd504b450bb445757cf2ef63", "type": "github" }, "original": { @@ -385,32 +401,16 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1679737941, - "narHash": "sha256-srSD9CwsVPnUMsIZ7Kt/UegkKUEBcTyU1Rev7mO45S0=", + "lastModified": 1680392223, + "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3502ee99d6dade045bdeaf7b0cd8ec703484c25c", + "rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5", "type": "github" }, "original": { @@ -420,12 +420,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -435,21 +438,6 @@ } }, "flake-utils_2": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -467,11 +455,11 @@ "flutter-tools": { "flake": false, "locked": { - "lastModified": 1680456818, - "narHash": "sha256-VNSrYJZKcQ92+2ko5ZkOOiAM/sXqbJtpkYvxFr1qtWk=", + "lastModified": 1681573333, + "narHash": "sha256-WKvHoSv8OaVGtrGMq8YUGnnvuuEXLNigT4NQwtx5HC4=", "owner": "akinsho", "repo": "flutter-tools.nvim", - "rev": "0a7e6b40aebd874e957ed630420a267e6cac0967", + "rev": "dedb571b15e6639792fea528b8c3040558f4ef0d", "type": "github" }, "original": { @@ -483,11 +471,11 @@ "gesture-nvim": { "flake": false, "locked": { - "lastModified": 1680321931, - "narHash": "sha256-WXH71e+9MLbylq1StuwWQX61brYtS4Kx10OGWlfi/FY=", + "lastModified": 1680956101, + "narHash": "sha256-oeP8PRBZ8c1iyT1pL95NYgYaWB/6sB0TVxNoS5Jiug4=", "owner": "notomo", "repo": "gesture.nvim", - "rev": "5fa0d76b890717081786c74b4824546052e14671", + "rev": "c302def60859f62deda34b06f00848b49d05b3ac", "type": "github" }, "original": { @@ -499,11 +487,11 @@ "gitsigns-nvim": { "flake": false, "locked": { - "lastModified": 1680209380, - "narHash": "sha256-IoWMURofYoLSy9QVE3m1gAcj2s7iRA30gOts47J3rcU=", + "lastModified": 1680593514, + "narHash": "sha256-nUVVEO06giiJURxT7qNHbX9C1ljZtchUeOdEoCQBk3E=", "owner": "lewis6991", "repo": "gitsigns.nvim", - "rev": "f412f51d0eaf0905a2759c8087090071689bb8fb", + "rev": "372d5cb485f2062ac74abc5b33054abac21d8b58", "type": "github" }, "original": { @@ -595,11 +583,11 @@ "leap-nvim": { "flake": false, "locked": { - "lastModified": 1678823512, - "narHash": "sha256-bzmsib8Qr2Whu1FqHzvrsIfSKf/CFutsaM3Sz8gaTLo=", + "lastModified": 1681071698, + "narHash": "sha256-CDNaQCbEQZQGklIQ8zvX+kL8AgFz4/otuRf9U5qZYP0=", "owner": "ggandor", "repo": "leap.nvim", - "rev": "f74473d23ebf60957e0db3ff8172349a82e5a442", + "rev": "98a72ad93c629c49bd7127d342960cc1b159b620", "type": "github" }, "original": { @@ -611,11 +599,11 @@ "lsp-signature": { "flake": false, "locked": { - "lastModified": 1679524823, - "narHash": "sha256-krQ0ihqbrsG4u8HdYlgaq0fOyIIDX4KDdffMRaJKQ78=", + "lastModified": 1681633928, + "narHash": "sha256-z/jGs2syMW8dp12bUwYkd+k/AFxyid/lJHGww10XukU=", "owner": "ray-x", "repo": "lsp_signature.nvim", - "rev": "1882019270be445a8cad4353f1530574f2b2d02d", + "rev": "72b0d4ece23338fe2d03fc7b6fd8c8bace6bb441", "type": "github" }, "original": { @@ -659,11 +647,11 @@ "lualine": { "flake": false, "locked": { - "lastModified": 1680275227, - "narHash": "sha256-bZSt9rBaeO5CjExu9Si3Ch/k0H/mzBE89KeeTCg4AbU=", + "lastModified": 1681033736, + "narHash": "sha256-u79S3wFJ72vcLp7F0f/s21Kvl/pMRI8CkB+8usPQob4=", "owner": "hoob3rt", "repo": "lualine.nvim", - "rev": "9170434aa100f3967b43d5d34bb9adc56fae1986", + "rev": "84ffb80e452d95e2c46fa29a98ea11a240f7843e", "type": "github" }, "original": { @@ -691,11 +679,11 @@ "minimap-vim": { "flake": false, "locked": { - "lastModified": 1680280122, - "narHash": "sha256-xrKkVTVVna9wc38K/CGCnQmWrofUAYJ0f92NR/ycfZ4=", + "lastModified": 1681226039, + "narHash": "sha256-vOFbYUd+manGcJqgk7QuArsDuAukmIS77YCZFtsY98g=", "owner": "wfxr", "repo": "minimap.vim", - "rev": "15dce1b667d4df0eec715798ab94c0850316e8a3", + "rev": "868a809302f9f5d4c408ef8aef7eb9bd5893f801", "type": "github" }, "original": { @@ -741,52 +729,6 @@ "type": "github" } }, - "neovim-flake": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "neovim-nightly-overlay", - "nixpkgs" - ] - }, - "locked": { - "dir": "contrib", - "lastModified": 1680310604, - "narHash": "sha256-2jop/z79HYhmV/hrdGvhjfTMouvzQvNRgFTkPhwWVcg=", - "owner": "neovim", - "repo": "neovim", - "rev": "75e1b1d5c934aa3a12693a7df58795563fb7877e", - "type": "github" - }, - "original": { - "dir": "contrib", - "owner": "neovim", - "repo": "neovim", - "type": "github" - } - }, - "neovim-nightly-overlay": { - "inputs": { - "flake-compat": "flake-compat", - "neovim-flake": "neovim-flake", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1680336751, - "narHash": "sha256-otSdFRXsNyPYOsbo+49vN4UGwZrVoLDrEp0EkyVJ/rY=", - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "rev": "d56f32281f4d6d74ce925a99946713dc6b5a0e30", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "type": "github" - } - }, "nil": { "inputs": { "flake-utils": [ @@ -798,11 +740,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1680185050, - "narHash": "sha256-MtyaP3j1yxwrqPFUsLD0qFyyH7d/h0D/whfErxS2UFM=", + "lastModified": 1681412802, + "narHash": "sha256-IcEala6vFQ7SFNOPCeXBh9Jbl8nL2QOtLmO7RbDsBbo=", "owner": "oxalica", "repo": "nil", - "rev": "0718fca59b82e53aef07699db7e1bbd86ba8dacf", + "rev": "1d5bc81023c21b22cfbea06a8b4b82963c01b941", "type": "github" }, "original": { @@ -813,11 +755,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1680273054, - "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", + "lastModified": 1681753173, + "narHash": "sha256-MrGmzZWLUqh2VstoikKLFFIELXm/lsf/G9U9zR96VD4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", + "rev": "0a4206a51b386e5cda731e8ac78d76ad924c7125", "type": "github" }, "original": { @@ -830,11 +772,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1678375444, - "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", + "lastModified": 1680213900, + "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", + "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", "type": "github" }, "original": { @@ -912,11 +854,11 @@ "noice-nvim": { "flake": false, "locked": { - "lastModified": 1679827108, - "narHash": "sha256-05/yAwaoz7mAAKXP1CsRXUoqsTW/z1wAT0OodiYJw6M=", + "lastModified": 1681713054, + "narHash": "sha256-do/L2UpxyuKlTBBicMJHp0du71MzbuVM+P1dOAURAuY=", "owner": "folke", "repo": "noice.nvim", - "rev": "1da4edfba3e9278e98fc9723d7235d9ab3889744", + "rev": "5c63a32fde4e87631ddd768f5d7674ec5988c1a2", "type": "github" }, "original": { @@ -928,11 +870,11 @@ "nui-nvim": { "flake": false, "locked": { - "lastModified": 1680113440, - "narHash": "sha256-pDroyXtkrBGbEZs0mcf+96ba72c0leNMW0AlM50RDJ8=", + "lastModified": 1681244240, + "narHash": "sha256-IlbOt9fCBklx3i8OY2DZwa/8OV+yGOLBm8HUeVLseIw=", "owner": "MunifTanjim", "repo": "nui.nvim", - "rev": "4eaec2ac66af2ca6ddddd3f665ad0909b90ae36a", + "rev": "ecd9def93891b9260b15b5fcef542eaabf4145c9", "type": "github" }, "original": { @@ -944,11 +886,11 @@ "null-ls": { "flake": false, "locked": { - "lastModified": 1680311856, - "narHash": "sha256-JViLNL2LLzm+ZQYnR4HF3e2mBa7AbDK7jWn4ZhjKYbY=", + "lastModified": 1681223720, + "narHash": "sha256-L3inC3YpiNdFdArqHdqR0n7g//moTvLYybQafFgkbDE=", "owner": "jose-elias-alvarez", "repo": "null-ls.nvim", - "rev": "defa0518762abb32279d601443344fb9773f9330", + "rev": "f8ffcd7cb8fb3325c711d459152ef132b5b65aed", "type": "github" }, "original": { @@ -960,11 +902,11 @@ "nvim-autopairs": { "flake": false, "locked": { - "lastModified": 1679861399, - "narHash": "sha256-G5D07KozNj48CxzcMevf1+ZqJEMXQql7VfWUseg6Rzc=", + "lastModified": 1681692125, + "narHash": "sha256-QBzyI0Jfo4nj6Nqkm8qzICgyDhg7CiT+2gMTsuZ8rIQ=", "owner": "windwp", "repo": "nvim-autopairs", - "rev": "0fd6519d44eac3a6736aafdb3fe9da916c3701d4", + "rev": "58985de5eeab159462bc262de5cc1b9c9b375595", "type": "github" }, "original": { @@ -993,15 +935,15 @@ "nvim-cmp": { "flake": false, "locked": { - "lastModified": 1679026924, - "narHash": "sha256-CoHGIiZrhRAHZ/Er0JSQMapI7jwllNF5OysLlx2QEik=", - "owner": "hrsh7th", + "lastModified": 1681258533, + "narHash": "sha256-vMQZzbvLGkBNtds8Ak6LgJBPCqXCxnJQ3m/eaTF2k+4=", + "owner": "ShIRannx", "repo": "nvim-cmp", - "rev": "777450fd0ae289463a14481673e26246b5e38bf2", + "rev": "3dbd99fd3eab9974cda7751e43383f7869f70aa1", "type": "github" }, "original": { - "owner": "hrsh7th", + "owner": "ShIRannx", "repo": "nvim-cmp", "type": "github" } @@ -1057,11 +999,11 @@ "nvim-lightbulb": { "flake": false, "locked": { - "lastModified": 1661474119, - "narHash": "sha256-nw6H/dS4dHdrobnrfJVa8urWrMnbTWrA5bQJy9xbKXY=", + "lastModified": 1681594259, + "narHash": "sha256-vMFl6Nzc0ZxTa4lQ5FEnE9GkxbPuu5/skufgsR34BSE=", "owner": "kosayoda", "repo": "nvim-lightbulb", - "rev": "56b9ce31ec9d09d560fe8787c0920f76bc208297", + "rev": "ca5b44a8efffb5fec1963ccd21f25ec04cc778b7", "type": "github" }, "original": { @@ -1073,11 +1015,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1680376121, - "narHash": "sha256-iEBGdENh3qXKHpRCqApG2JfJwXOsInivO0dUGton+I4=", + "lastModified": 1681647398, + "narHash": "sha256-jrVzwC9nO2gLmIKQ9gTRW/fsXc4ad7/rR917Krmv874=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "8cbfc30c4b238cc2465ff256803f7747376f046a", + "rev": "eddaef928c1e1dd79a96f5db45f2fd7f2efe7ea0", "type": "github" }, "original": { @@ -1137,11 +1079,11 @@ "nvim-tree-lua": { "flake": false, "locked": { - "lastModified": 1679961168, - "narHash": "sha256-9e5kBw9cZX08uQAfFb/YP17a1biDR8PNg617PhkKJhk=", + "lastModified": 1681624690, + "narHash": "sha256-kLvRB1w4wHGOOWj4fQ6pyhvKJ4+mqOkhYe04uicfHmA=", "owner": "nvim-tree", "repo": "nvim-tree.lua", - "rev": "45400cd7e02027937cd5e49845545e606ecf5a1f", + "rev": "8f392fa763b7ee80a48c714b630acaf6d1fe1854", "type": "github" }, "original": { @@ -1153,15 +1095,15 @@ "nvim-treesitter-context": { "flake": false, "locked": { - "lastModified": 1652175020, - "narHash": "sha256-dYw/Y6+Eni7gTSjvCCl7E6ho8xSTxDYAwH3xGEhf54Q=", - "owner": "lewis6991", + "lastModified": 1681297663, + "narHash": "sha256-INYJBQDHgq+2V469JLIq54LolGb6T7nlgmmVDQcxwkk=", + "owner": "nvim-treesitter", "repo": "nvim-treesitter-context", - "rev": "c931a3136a696c1827eda78ac678aea542115bd0", + "rev": "0d730df898f3dc27fd88f03cfa6d26d2405554b4", "type": "github" }, "original": { - "owner": "lewis6991", + "owner": "nvim-treesitter", "repo": "nvim-treesitter-context", "type": "github" } @@ -1169,11 +1111,11 @@ "nvim-ts-autotag": { "flake": false, "locked": { - "lastModified": 1679019585, - "narHash": "sha256-XNR09azYMviWt8aU8XuhS7q+AT5xRBK+FkeejlAAshg=", + "lastModified": 1681387572, + "narHash": "sha256-qi1PF75HeaAkHAvsinyXtfvggE12agUNnx7mrSsBiDo=", "owner": "windwp", "repo": "nvim-ts-autotag", - "rev": "25698e4033cd6cd3745454bfc837dd670eba0480", + "rev": "cac97f3b47bcb927db6d1d784c0c323056506ef3", "type": "github" }, "original": { @@ -1185,11 +1127,11 @@ "nvim-web-devicons": { "flake": false, "locked": { - "lastModified": 1680259444, - "narHash": "sha256-KY0L9j7zKSXgVLUqoda3btiQ6r1h/gckJGpma4CXqUM=", + "lastModified": 1681235235, + "narHash": "sha256-lAjk2Kpyxabe21ut7xCvhE2+we8hsEZWpcJrYLbhWqM=", "owner": "kyazdani42", "repo": "nvim-web-devicons", - "rev": "d92b3f4275f4774c0cb23b8b094a41d1dbb3e78c", + "rev": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e", "type": "github" }, "original": { @@ -1201,11 +1143,11 @@ "obsidian-nvim": { "flake": false, "locked": { - "lastModified": 1680287173, - "narHash": "sha256-OV3s/0qZi29GH1tWqjQjbBWMHkOJfmTujjMO18/rKg8=", + "lastModified": 1681757981, + "narHash": "sha256-7L/C/BKDCaYFJspEnOesrsCfOFe4XxxEiTlVh4ntT+Q=", "owner": "epwalsh", "repo": "obsidian.nvim", - "rev": "e1c4658cc6530a8d2f393451f68bd9e6366173b9", + "rev": "9dd19303aea80ff10b53de6879d973256125e395", "type": "github" }, "original": { @@ -1233,11 +1175,11 @@ "orgmode-nvim": { "flake": false, "locked": { - "lastModified": 1680214315, - "narHash": "sha256-jveJ1ffvv4pkfog1t98yPvTiltTv8Li89gEDbBnz8K0=", + "lastModified": 1681591080, + "narHash": "sha256-1JzE296ARUhsy55qjA3n5XAQLnySf+FM+mwJWa07+CM=", "owner": "nvim-orgmode", "repo": "orgmode", - "rev": "070f7588629b956bba17d9892e6fa15bf19a2260", + "rev": "d8020e95f531369962d74d037f603d038d70de1e", "type": "github" }, "original": { @@ -1249,11 +1191,11 @@ "plenary-nvim": { "flake": false, "locked": { - "lastModified": 1676797549, - "narHash": "sha256-z5JHuQcF1EvySnRBywl6EOrp8aRO0nd2dnkXJg2ge58=", + "lastModified": 1681122243, + "narHash": "sha256-tG+BrCgE1L7QMbchSzjLfQfpI09uTQXbx7OeFuVEcDQ=", "owner": "nvim-lua", "repo": "plenary.nvim", - "rev": "253d34830709d690f013daf2853a9d21ad7accab", + "rev": "9ac3e9541bbabd9d73663d757e4fe48a675bb054", "type": "github" }, "original": { @@ -1297,11 +1239,11 @@ "registers": { "flake": false, "locked": { - "lastModified": 1678110851, - "narHash": "sha256-JxOtdChh4V/SfBQNVDoHdWvH49nfDhlokS/7vWQWryI=", + "lastModified": 1680595111, + "narHash": "sha256-MeBlcF5LLk6bhIofYuG+0Z2xwc0BVqP85yNCvjH66fw=", "owner": "tversteeg", "repo": "registers.nvim", - "rev": "0a461e635403065b3f9a525bd77eff30759cfba0", + "rev": "2ab8372bb837f05fae6b43091f10a0b725d113ca", "type": "github" }, "original": { @@ -1350,6 +1292,7 @@ "crates-nvim": "crates-nvim", "dashboard-nvim": "dashboard-nvim", "diffview-nvim": "diffview-nvim", + "dracula": "dracula", "dressing-nvim": "dressing-nvim", "elixir-ls": "elixir-ls", "elixir-tools": "elixir-tools", @@ -1372,7 +1315,6 @@ "mind-nvim": "mind-nvim", "minimap-vim": "minimap-vim", "modes-nvim": "modes-nvim", - "neovim-nightly-overlay": "neovim-nightly-overlay", "nil": "nil", "nixpkgs": "nixpkgs", "nmd": "nmd", @@ -1434,11 +1376,11 @@ ] }, "locked": { - "lastModified": 1678415622, - "narHash": "sha256-tems1jHETCYEen8QrW61yVVX0F4zOGy4ImB43iDc7bY=", + "lastModified": 1680488274, + "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9f687941160108f89dd8bd2c650d32c15a35c7c7", + "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8", "type": "github" }, "original": { @@ -1528,6 +1470,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tabular": { "flake": false, "locked": { @@ -1547,11 +1504,11 @@ "telescope": { "flake": false, "locked": { - "lastModified": 1679492995, - "narHash": "sha256-Kyw9ryb8YgAKFWLac9yl/fD3nNcu7mv7xzuNU6pDMkU=", + "lastModified": 1681122231, + "narHash": "sha256-UMidzUf2nhG577Minzm3QYu0ZNPoK/rXEyUdvZ/5nFw=", "owner": "nvim-telescope", "repo": "telescope.nvim", - "rev": "942fe5faef47b21241e970551eba407bc10d9547", + "rev": "6258d50b09f9ae087317e392efe7c05a7323492d", "type": "github" }, "original": { @@ -1620,11 +1577,11 @@ "toggleterm-nvim": { "flake": false, "locked": { - "lastModified": 1680290314, - "narHash": "sha256-862KtB9oqktx/mPI0wSauF7eJIJogqgG6wTTYlCSo9U=", + "lastModified": 1681296186, + "narHash": "sha256-y8CvzzW4ezqdnSzeon39KVN1JEU+9SSJ78n51A5XHVQ=", "owner": "akinsho", "repo": "toggleterm.nvim", - "rev": "b86982429325112d2b20c6d0cc7a5c4b182ab705", + "rev": "1c5996ee3c30b54751093fe68d40676859e7778f", "type": "github" }, "original": { @@ -1636,11 +1593,11 @@ "tokyonight": { "flake": false, "locked": { - "lastModified": 1679554571, - "narHash": "sha256-M1fX5o8w6MbDX46HiN1Nw9xjG4Z79zraPKi0VUpyyVU=", + "lastModified": 1681713069, + "narHash": "sha256-2+lDMcKZZqt8gf4bzi/I5FitO+DSlxrmtTgrO+tXkvU=", "owner": "folke", "repo": "tokyonight.nvim", - "rev": "1b0c88094548a62641ece1e668fa9a234e1c539e", + "rev": "ef8f5917f1a3972e6dd083c1ea74dafcb54f9917", "type": "github" }, "original": { @@ -1652,11 +1609,11 @@ "trouble": { "flake": false, "locked": { - "lastModified": 1679827111, - "narHash": "sha256-uw/wfMKoFN2sHw/99ZcqGKJ3jQVP9pkDHqDaXaYn3CA=", + "lastModified": 1681764706, + "narHash": "sha256-znQA0i8gVzThGBBgkvBISFgSE47C5VZcMZ45dnJmewM=", "owner": "folke", "repo": "trouble.nvim", - "rev": "2ae7237c2917d661f458443c9a88680f8ca2d7b2", + "rev": "c25fab9a76e5559b0da4ee012c734f16e72bdf85", "type": "github" }, "original": { @@ -1714,11 +1671,11 @@ "vim-markdown": { "flake": false, "locked": { - "lastModified": 1677235033, - "narHash": "sha256-q4OE2tUoA0i6m3CbyzCYfjGsPNaTbU9/deM4DBu36GY=", + "lastModified": 1680951012, + "narHash": "sha256-B00rad/Bbp+kJBN/fYliOaGiUe0AfBng6gs/fVBve9A=", "owner": "preservim", "repo": "vim-markdown", - "rev": "5d3d1b6cbdc4be0b4c6105c1ab1f769d76d3c68f", + "rev": "cc82d88e2a791f54d2b6e2b26e41f743351ac947", "type": "github" }, "original": { @@ -1812,11 +1769,11 @@ "which-key": { "flake": false, "locked": { - "lastModified": 1679827118, - "narHash": "sha256-R52U1Aa30KgNyyTxN3ZiWaoh86/Vsj5kmUmCCos5DjE=", + "lastModified": 1681746771, + "narHash": "sha256-YRkwLCcJJE9QXOPhCdWIWfMBEgse0Me66JLGzm8Jz9c=", "owner": "folke", "repo": "which-key.nvim", - "rev": "4b73390eec680b4c061ea175eb32c0ff3412271d", + "rev": "f82ca7fbaf4718303dbaf83dc28303fee16cf4d2", "type": "github" }, "original": { @@ -1827,16 +1784,16 @@ }, "zig": { "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_3", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1680308637, - "narHash": "sha256-gas/Oo1hYbYOHzr1TBoHGH1mEzMMlPIdosb3yt573c0=", + "lastModified": 1681690952, + "narHash": "sha256-x8KEUCSorKtsWWlJWXi6atcWkcREAV1o081knXZCQfc=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "0d01cdde8c66b2b49cb30f8b52f11237b1ae5f6f", + "rev": "0cd7fee7dae8eaaf77ed0d420f69be0a481acc9d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index da89f51..18f712b 100644 --- a/flake.nix +++ b/flake.nix @@ -32,18 +32,6 @@ inherit (import ./extra.nix inputs) neovimConfiguration; }; - /* - nixosModules.default = { - home-manager.sharedModules = [ - ./lib/module - ]; - nixpkgs.overlays = [ - inputs.tidalcycles.overlays.default - inputs.self.overlays.default - ]; - }; - */ - homeManagerModules = { neovim-flake = { imports = [ @@ -70,12 +58,6 @@ flake-parts.url = "github:hercules-ci/flake-parts"; flake-utils.url = "github:numtide/flake-utils"; - # TODO: neovim nightly - neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # For generating documentation website nmd = { url = "gitlab:rycee/nmd"; @@ -109,7 +91,7 @@ }; nvim-treesitter-context = { - url = "github:lewis6991/nvim-treesitter-context"; + url = "github:nvim-treesitter/nvim-treesitter-context"; flake = false; }; @@ -206,7 +188,7 @@ flake = false; }; nvim-cmp = { - url = "github:hrsh7th/nvim-cmp"; + url = "github:ShIRannx/nvim-cmp"; flake = false; }; cmp-buffer = { @@ -305,6 +287,11 @@ flake = false; }; + dracula = { + url = "github:Mofiqul/dracula.nvim"; + flake = false; + }; + # Rust crates crates-nvim = { url = "github:Saecki/crates.nvim"; diff --git a/flake/legacyPackages.nix b/flake/legacyPackages.nix index bd284be..c98d626 100644 --- a/flake/legacyPackages.nix +++ b/flake/legacyPackages.nix @@ -9,7 +9,6 @@ overlays = [ inputs.tidalcycles.overlays.default inputs.self.overlays.default - inputs.neovim-nightly-overlay.overlay inputs.zig.overlays.default (_: _: { rnix-lsp = inputs'.rnix-lsp.defaultPackage; diff --git a/flake/overlays.nix b/flake/overlays.nix index 1850a91..8a2dfb8 100644 --- a/flake/overlays.nix +++ b/flake/overlays.nix @@ -1,4 +1,8 @@ -{inputs, ...}: let +{ + inputs, + pkgs, + ... +}: let inherit (import ../extra.nix inputs) neovimConfiguration mainConfig; buildPkg = pkgs: modules: @@ -14,5 +18,6 @@ in { neovim-nix = buildPkg prev [nixConfig]; neovim-maximal = buildPkg prev [maximalConfig]; neovim-tidal = buildPkg prev [tidalConfig]; + devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}]; }; } diff --git a/lib/booleans.nix b/lib/booleans.nix deleted file mode 100644 index 277dd18..0000000 --- a/lib/booleans.nix +++ /dev/null @@ -1,9 +0,0 @@ -# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix -{lib}: { - # Converts a boolean to a yes/no string. This is used in lots of - # configuration formats. - yesNo = value: - if value - then "yes" - else "no"; -} diff --git a/lib/default.nix b/lib/default.nix index 873f31b..ad6771a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -2,4 +2,7 @@ dag = import ./dag.nix {inherit lib;}; booleans = import ./booleans.nix {inherit lib;}; types = import ./types {inherit lib;}; + languages = import ./languages.nix {inherit lib;}; + nmd = import ./nmd.nix; + lua = import ./lua.nix {inherit lib;}; } diff --git a/lib/languages.nix b/lib/languages.nix new file mode 100644 index 0000000..18d678d --- /dev/null +++ b/lib/languages.nix @@ -0,0 +1,25 @@ +# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix +{lib}: { + # Converts a boolean to a yes/no string. This is used in lots of + # configuration formats. + diagnosticsToLua = { + lang, + config, + diagnostics, + }: + lib.listToAttrs + (map (v: let + type = + if builtins.isString v + then v + else builtins.getAttr v.type; + package = + if builtins.isString v + then diagnostics.${type}.package + else v.package; + in { + name = "${lang}-diagnostics-${type}"; + value = diagnostics.${type}.nullConfig package; + }) + config); +} diff --git a/lib/lua.nix b/lib/lua.nix new file mode 100644 index 0000000..b21c459 --- /dev/null +++ b/lib/lua.nix @@ -0,0 +1,12 @@ +# Helpers for converting values to lua +{lib}: { + yesNo = value: + if value + then "yes" + else "no"; + + nullString = value: + if value == null + then "nil" + else "'${value}'"; +} diff --git a/lib/nmd.nix b/lib/nmd.nix new file mode 100644 index 0000000..fd945f1 --- /dev/null +++ b/lib/nmd.nix @@ -0,0 +1,17 @@ +# Copied from nmd master: https://gitlab.com/rycee/nmd/-/blob/master/default.nix?ref_type=heads +# Allows asciiDoc in options. It is easier to copy & keep updated then figure out how to pass the nmd input +# along to user modules +{ + # Indicates that the given text should be interpreted as AsciiDoc markup. + asciiDoc = text: { + _type = "asciiDoc"; + inherit text; + }; + + # Indicates that the given text should be interpreted as AsciiDoc markup and + # used in a literal context. + literalAsciiDoc = text: { + _type = "literalAsciiDoc"; + inherit text; + }; +} diff --git a/lib/types/default.nix b/lib/types/default.nix index fca45ba..6d5777d 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -1,7 +1,9 @@ {lib}: let typesDag = import ./dag.nix {inherit lib;}; typesPlugin = import ./plugins.nix {inherit lib;}; + typesLanguage = import ./languages.nix {inherit lib;}; in { inherit (typesDag) dagOf; inherit (typesPlugin) pluginsOpt; + inherit (typesLanguage) diagnostics mkGrammarOption; } diff --git a/lib/types/languages.nix b/lib/types/languages.nix new file mode 100644 index 0000000..577db50 --- /dev/null +++ b/lib/types/languages.nix @@ -0,0 +1,31 @@ +{lib}: +with lib; let + diagnosticSubmodule = {...}: { + options = { + type = mkOption { + description = "Type of diagnostic to enable"; + type = attrNames diagnostics; + }; + package = mkOption { + description = "Diagnostics package"; + type = types.package; + }; + }; + }; +in { + diagnostics = { + langDesc, + diagnostics, + defaultDiagnostics, + }: + mkOption { + description = "List of ${langDesc} diagnostics to enable"; + type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule)); + default = defaultDiagnostics; + }; + + mkGrammarOption = pkgs: grammar: + mkPackageOption pkgs ["${grammar} treesitter"] { + default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar]; + }; +} diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 2c1aaa9..0c1d0d3 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -41,6 +41,7 @@ with lib; let "rust-tools" "onedark" "catppuccin" + "dracula" "minimap-vim" "dashboard-nvim" "alpha-nvim" diff --git a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix index 2515e65..1b3f8b7 100644 --- a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix +++ b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix @@ -23,7 +23,7 @@ with builtins; { map_cr = mkOption { type = types.bool; default = true; - description = "map `CR` on insert mode"; + description = nvim.nmd.asciiDoc ''map on insert mode''; }; map_complete = mkOption { diff --git a/modules/basic/config.nix b/modules/basic/config.nix index a06cae2..1b4512a 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -103,6 +103,9 @@ in { set termguicolors set t_Co=256 ''} + ${optionalString cfg.enableEditorconfig '' + vim.g.editorconfig = false + ''} ''; }; } diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 7ac5ad7..82dd802 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -139,5 +139,10 @@ with builtins; { default = true; description = "New splits will open to the right"; }; + enableEditorconfig = mkOption { + type = types.bool; + default = false; + description = "Follow editorconfig rules in current directory"; + }; }; } diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index a502358..b9fecec 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -1,4 +1,5 @@ { + pkgs, lib, config, ... @@ -6,18 +7,58 @@ with lib; with builtins; let cfg = config.vim.autocomplete; + lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable; + builtSources = + concatMapStringsSep + "\n" + (n: "{ name = '${n}'},") + (attrNames cfg.sources); + + builtMaps = + concatStringsSep + "\n" + (mapAttrsToList + (n: v: + if v == null + then "" + else "${n} = '${v}',") + cfg.sources); + + dagPlacement = + if lspkindEnabled + then nvim.dag.entryAfter ["lspkind"] + else nvim.dag.entryAnywhere; in { config = mkIf cfg.enable { vim.startPlugins = [ - "vim-vsnip" "nvim-cmp" "cmp-buffer" "cmp-vsnip" "cmp-path" - "cmp-treesitter" ]; - vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (nvim.dag.entryAnywhere '' + vim.autocomplete.sources = { + "nvim-cmp" = null; + "vsnip" = "[VSnip]"; + "buffer" = "[Buffer]"; + "crates" = "[Crates]"; + "path" = "[Path]"; + }; + + vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (dagPlacement '' + local nvim_cmp_menu_map = function(entry, vim_item) + -- name for each source + vim_item.menu = ({ + ${builtMaps} + })[entry.source.name] + print(vim_item.menu) + return vim_item + end + + ${optionalString lspkindEnabled '' + lspkind_opts.before = ${cfg.formatting.format} + ''} + local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil @@ -35,12 +76,7 @@ in { end, }, sources = { - ${optionalString (config.vim.lsp.enable) "{ name = 'nvim_lsp' },"} - ${optionalString (config.vim.lsp.rust.enable) "{ name = 'crates' },"} - { name = 'vsnip' }, - { name = 'treesitter' }, - { name = 'path' }, - { name = 'buffer' }, + ${builtSources} }, mapping = { [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), @@ -77,23 +113,12 @@ in { completeopt = 'menu,menuone,noinsert', }, formatting = { - format = function(entry, vim_item) - -- type of kind - vim_item.kind = ${ - optionalString (config.vim.visuals.lspkind.enable) - "require('lspkind').presets.default[vim_item.kind] .. ' ' .." - } vim_item.kind - - -- name for each source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - vsnip = "[VSnip]", - crates = "[Crates]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, + format = + ${ + if lspkindEnabled + then "lspkind.cmp_format(lspkind_opts)" + else cfg.formatting.format + }, } }) ${optionalString (config.vim.autopairs.enable && config.vim.autopairs.type == "nvim-autopairs") '' diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index 5938525..bb6f7f9 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -1,4 +1,5 @@ { + pkgs, lib, config, ... @@ -10,7 +11,7 @@ with builtins; { enable = mkOption { type = types.bool; default = false; - description = "Enable autocomplete via nvim-cmp"; + description = "enable autocomplete"; }; type = mkOption { @@ -18,6 +19,46 @@ with builtins; { default = "nvim-cmp"; description = "Set the autocomplete plugin. Options: [nvim-cmp]"; }; + + sources = mkOption { + description = nvim.nmd.asciiDoc '' + Attribute set of source names for nvim-cmp. + + If an attribute set is provided, then the menu value of + `vim_item` in the format will be set to the value (if + utilizing the `nvim_cmp_menu_map` function). + + Note: only use a single attribute name per attribute set + ''; + type = with types; attrsOf (nullOr str); + default = {}; + example = '' + {nvim-cmp = null; buffer = "[Buffer]";} + ''; + }; + + formatting = { + format = mkOption { + description = nvim.nmd.asciiDoc '' + The function used to customize the appearance of the completion menu. + + If <> is true, then the function + will be called before modifications from lspkind. + + Default is to call the menu mapping function. + ''; + type = types.str; + default = "nvim_cmp_menu_map"; + example = nvim.nmd.literalAsciiDoc '' + [source,lua] + --- + function(entry, vim_item) + return vim_item + end + --- + ''; + }; + }; }; }; } diff --git a/modules/default.nix b/modules/default.nix index d8b4515..34d6212 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,7 +6,7 @@ inputs: { extraSpecialArgs ? {}, }: let inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins; - inherit (builtins) map filter isString toString getAttr; + inherit (builtins) map filter isString toString getAttr hasAttr attrNames; inherit (pkgs.vimUtils) buildVimPluginFrom2Nix; extendedLib = import ../lib/stdlib-extended.nix lib; diff --git a/modules/filetree/nvimtree-lua/config.nix b/modules/filetree/nvimtree-lua/config.nix index 6546232..042f5c7 100644 --- a/modules/filetree/nvimtree-lua/config.nix +++ b/modules/filetree/nvimtree-lua/config.nix @@ -80,7 +80,6 @@ in { width = ${toString cfg.view.width}, side = ${"'" + cfg.view.side + "'"}, adaptive_size = ${boolToString cfg.view.adaptiveSize}, - hide_root_folder = ${boolToString cfg.view.hideRootFolder}, }, git = { enable = ${boolToString cfg.git.enable}, @@ -119,6 +118,12 @@ in { -- TODO: those two add_trailing = ${boolToString cfg.renderer.trailingSlash}, group_empty = ${boolToString cfg.renderer.groupEmptyFolders}, + + root_folder_label = ${ + if cfg.renderer.rootFolderLabel == null + then "false" + else "''${toString cfg.rootFolderLabel}''" + }, }, system_open = { diff --git a/modules/filetree/nvimtree-lua/nvimtree-lua.nix b/modules/filetree/nvimtree-lua/nvimtree-lua.nix index fbd0fb6..33a5508 100644 --- a/modules/filetree/nvimtree-lua/nvimtree-lua.nix +++ b/modules/filetree/nvimtree-lua/nvimtree-lua.nix @@ -160,12 +160,6 @@ with builtins; { description = "Width of the tree in charecters"; type = types.int; }; - - hideRootFolder = mkOption { - default = true; - description = "Hide the root folder"; - type = types.bool; - }; }; git = { @@ -282,6 +276,12 @@ with builtins; { type = types.bool; }; + rootFolderLabel = mkOption { + default = null; + description = "Root folder label. Set null to disable"; + type = with types; nullOr str; + }; + icons = { show = { file = mkOption { diff --git a/modules/git/config.nix b/modules/git/config.nix index ae2c1b4..fffda35 100644 --- a/modules/git/config.nix +++ b/modules/git/config.nix @@ -1,13 +1,58 @@ { + pkgs, config, lib, ... }: -with lib; { - config = { - vim.git = { - enable = mkDefault false; - gitsigns.enable = mkDefault false; - }; - }; +with lib; +with builtins; let + cfg = config.vim.git; +in { + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.gitsigns.enable (mkMerge [ + { + vim.startPlugins = ["gitsigns-nvim"]; + + vim.luaConfigRC.gitsigns = nvim.dag.entryAnywhere '' + require('gitsigns').setup { + keymaps = { + noremap = true, + + ['n gn'] = { expr = true, "&diff ? \'\' : 'Gitsigns next_hunk'"}, + ['n gp'] = { expr = true, "&diff ? \'\' : 'Gitsigns prev_hunk'"}, + + ['n gs'] = 'Gitsigns stage_hunk', + ['v gs'] = ':Gitsigns stage_hunk', + ['n gu'] = 'Gitsigns undo_stage_hunk', + ['n gr'] = 'Gitsigns reset_hunk', + ['v gr'] = ':Gitsigns reset_hunk', + ['n gR'] = 'Gitsigns reset_buffer', + ['n gp'] = 'Gitsigns preview_hunk', + ['n gb'] = 'lua require"gitsigns".blame_line{full=true}', + ['n gS'] = 'Gitsigns stage_buffer', + ['n gU'] = 'Gitsigns reset_buffer_index', + ['n gts'] = ':Gitsigns toggle_signs', + ['n gtn'] = ':Gitsigns toggle_numhl', + ['n gtl'] = ':Gitsigns toggle_linehl', + ['n gtw'] = ':Gitsigns toggle_word_diff', + + -- Text objects + ['o ih'] = ':Gitsigns select_hunk', + ['x ih'] = ':Gitsigns select_hunk' + }, + } + ''; + } + + (mkIf cfg.gitsigns.codeActions { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.gitsigns-ca = '' + table.insert( + ls_sources, + null_ls.builtins.code_actions.gitsigns + ) + ''; + }) + ])) + ]); } diff --git a/modules/git/git.nix b/modules/git/git.nix index e9af83b..80da18c 100644 --- a/modules/git/git.nix +++ b/modules/git/git.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, ... @@ -8,54 +9,12 @@ with builtins; let cfg = config.vim.git; in { options.vim.git = { - enable = mkOption { - type = types.bool; - description = "Enable git plugins"; - }; + enable = mkEnableOption "Git support"; - gitsigns.enable = mkOption { - type = types.bool; - description = "Enable git options"; + gitsigns = { + enable = mkEnableOption "gitsigns"; + + codeActions = mkEnableOption "gitsigns codeactions through null-ls"; }; }; - - config = - mkIf cfg.enable - { - vim.startPlugins = - if (cfg.gitsigns.enable) - then ["gitsigns-nvim"] - else []; - - vim.luaConfigRC.gitsigns = mkIf (cfg.gitsigns.enable) (nvim.dag.entryAnywhere '' - -- GitSigns setup - require('gitsigns').setup { - keymaps = { - noremap = true, - - ['n gn'] = { expr = true, "&diff ? \'\' : 'Gitsigns next_hunk'"}, - ['n gp'] = { expr = true, "&diff ? \'\' : 'Gitsigns prev_hunk'"}, - - ['n gs'] = 'Gitsigns stage_hunk', - ['v gs'] = ':Gitsigns stage_hunk', - ['n gu'] = 'Gitsigns undo_stage_hunk', - ['n gr'] = 'Gitsigns reset_hunk', - ['v gr'] = ':Gitsigns reset_hunk', - ['n gR'] = 'Gitsigns reset_buffer', - ['n gp'] = 'Gitsigns preview_hunk', - ['n gb'] = 'lua require"gitsigns".blame_line{full=true}', - ['n gS'] = 'Gitsigns stage_buffer', - ['n gU'] = 'Gitsigns reset_buffer_index', - ['n gts'] = ':Gitsigns toggle_signs', - ['n gtn'] = ':Gitsigns toggle_numhl', - ['n gtl'] = ':Gitsigns toggle_linehl', - ['n gtw'] = ':Gitsigns toggle_word_diff', - - -- Text objects - ['o ih'] = ':Gitsigns select_hunk', - ['x ih'] = ':Gitsigns select_hunk' - }, - } - ''); - }; } diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix new file mode 100644 index 0000000..a9d1191 --- /dev/null +++ b/modules/languages/clang.nix @@ -0,0 +1,88 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.clang; + + defaultServer = "ccls"; + servers = { + ccls = { + package = pkgs.ccls; + lspConfig = '' + lspconfig.ccls.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${pkgs.ccls}/bin/ccls"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.cclsOpts}"} + } + ''; + }; + }; +in { + options.vim.languages.clang = { + enable = mkEnableOption "C/C++ language support"; + + cHeader = mkOption { + description = '' + C syntax for headers. Can fix treesitter errors, see: + https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/ + ''; + type = types.bool; + default = false; + }; + + treesitter = { + enable = mkOption { + description = "Enable C/C++ treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + cPackage = nvim.types.mkGrammarOption pkgs "c"; + cppPackage = nvim.types.mkGrammarOption pkgs "cpp"; + }; + + lsp = { + enable = mkOption { + description = "Enable clang LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "The clang LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "clang LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + opts = mkOption { + description = "Options to pass to clang LSP server"; + type = with types; nullOr str; + default = null; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.cHeader { + vim.configRC.c-header = nvim.dag.entryAnywhere "let g:c_syntax_for_h = 1"; + }) + + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.cPackage cfg.treesitter.cppPackage]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + + vim.lsp.lspconfig.sources.clang-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + ]); +} diff --git a/modules/languages/dart/config.nix b/modules/languages/dart/config.nix new file mode 100644 index 0000000..9866db4 --- /dev/null +++ b/modules/languages/dart/config.nix @@ -0,0 +1,60 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.dart; + ftcfg = cfg.flutter-tools; + servers = { + dart = { + package = pkgs.dart; + lspConfig = '' + lspconfig.dart.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${pkgs.dart}/bin/dart"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"} + } + ''; + }; + }; +in { + 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.lspconfig.enable = true; + + vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf (ftcfg.enable) { + vim.startPlugins = ["flutter-tools"]; + + vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere '' + require('flutter-tools').setup { + lsp = { + color = { -- show the derived colours for dart variables + enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 + background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background + foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground + virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text + virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight + }, + + capabilities = capabilities, + on_attach = default_on_attach; + flags = lsp_flags, + }, + } + + ''; + }) + ]); +} diff --git a/modules/languages/dart/dart.nix b/modules/languages/dart/dart.nix new file mode 100644 index 0000000..21bf960 --- /dev/null +++ b/modules/languages/dart/dart.nix @@ -0,0 +1,90 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.dart; + defaultServer = "dart"; + servers = { + dart = { + package = pkgs.dart; + lspConfig = '' + lspconfig.dart.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${pkgs.dart}/bin/dart"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"} + } + ''; + }; + }; +in { + options.vim.languages.dart = { + enable = mkEnableOption "Dart language support"; + + treesitter = { + enable = mkOption { + description = "Enable Dart treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "dart"; + }; + + lsp = { + enable = mkOption { + description = "Enable Dart LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "The Dart LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Dart LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + opts = mkOption { + description = "Options to pass to Dart LSP server"; + type = with types; nullOr str; + default = null; + }; + }; + + flutter-tools = { + enable = mkEnableOption "Enable flutter-tools for flutter support"; + + color = { + enable = mkEnableOption "Whether or mot to highlight color variables at all"; + + highlightBackground = mkOption { + type = types.bool; + default = false; + description = "Highlight the background"; + }; + + highlightForeground = mkOption { + type = types.bool; + default = false; + description = "Highlight the foreground"; + }; + + virtualText = { + enable = mkEnableOption "Show the highlight using virtual text"; + + character = mkOption { + type = types.str; + default = "■"; + description = "Virtual text character to highlight"; + }; + }; + }; + }; + }; +} diff --git a/modules/markdown/glow/default.nix b/modules/languages/dart/default.nix similarity index 74% rename from modules/markdown/glow/default.nix rename to modules/languages/dart/default.nix index 9b128a3..da454ec 100644 --- a/modules/markdown/glow/default.nix +++ b/modules/languages/dart/default.nix @@ -1,6 +1,6 @@ _: { imports = [ - ./glow.nix + ./dart.nix ./config.nix ]; } diff --git a/modules/languages/default.nix b/modules/languages/default.nix new file mode 100644 index 0000000..75d08ab --- /dev/null +++ b/modules/languages/default.nix @@ -0,0 +1,33 @@ +{lib, ...}: +with lib; let + mkEnable = desc: + mkOption { + description = "Turn on ${desc} for enabled languages by default"; + type = types.bool; + default = false; + }; +in { + imports = [ + ./markdown + ./tidal + ./dart + ./elixir + + ./clang.nix + ./go.nix + ./nix.nix + ./python.nix + ./rust.nix + ./sql.nix + ./ts.nix + ./zig.nix + ./html.nix + ]; + + options.vim.languages = { + enableLSP = mkEnable "LSP"; + enableTreesitter = mkEnable "treesitter"; + enableFormat = mkEnable "formatting"; + enableExtraDiagnostics = mkEnable "extra diagnostics"; + }; +} diff --git a/modules/lsp/elixir/config.nix b/modules/languages/elixir/config.nix similarity index 98% rename from modules/lsp/elixir/config.nix rename to modules/languages/elixir/config.nix index 1b1e2a5..e0ef5f9 100644 --- a/modules/lsp/elixir/config.nix +++ b/modules/languages/elixir/config.nix @@ -6,12 +6,11 @@ }: with lib; with builtins; let - cfg = config.vim.lsp.elixir; + cfg = config.vim.languages.elixir; in { config = mkIf (cfg.enable) { vim.startPlugins = [ "elixir-tools" - "plenary-nvim" ]; vim.luaConfigRC.elixir-tools = nvim.dag.entryAnywhere '' diff --git a/modules/lsp/elixir/default.nix b/modules/languages/elixir/default.nix similarity index 100% rename from modules/lsp/elixir/default.nix rename to modules/languages/elixir/default.nix diff --git a/modules/languages/elixir/elixir-tools.nix b/modules/languages/elixir/elixir-tools.nix new file mode 100644 index 0000000..83da10f --- /dev/null +++ b/modules/languages/elixir/elixir-tools.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: +with lib; +with builtins; { + options.vim.languages.elixir = { + enable = mkEnableOption "elixir support"; + }; +} diff --git a/modules/languages/go.nix b/modules/languages/go.nix new file mode 100644 index 0000000..f63a6f4 --- /dev/null +++ b/modules/languages/go.nix @@ -0,0 +1,67 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.go; + + defaultServer = "gopls"; + servers = { + gopls = { + package = pkgs.gopls; + lspConfig = '' + lspconfig.gopls.setup { + capabilities = capabilities; + on_attach = default_on_attach; + cmd = {"${cfg.lsp.package}/bin/gopls", "serve"}, + } + ''; + }; + }; +in { + options.vim.languages.go = { + enable = mkEnableOption "Go language support"; + + treesitter = { + enable = mkOption { + description = "Enable Go treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "go"; + }; + + lsp = { + enable = mkOption { + description = "Enable Go LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Go LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Go LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.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.lspconfig.enable = true; + vim.lsp.lspconfig.sources.go-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + ]); +} diff --git a/modules/languages/html.nix b/modules/languages/html.nix new file mode 100644 index 0000000..b897e1c --- /dev/null +++ b/modules/languages/html.nix @@ -0,0 +1,42 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.html; +in { + options.vim.languages.html = { + enable = mkEnableOption "HTML language support"; + + treesitter = { + enable = mkOption { + description = "Enable HTML treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "html"; + + autotagHtml = mkOption { + description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)"; + type = types.bool; + default = true; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + + vim.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag"; + + vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere '' + require('nvim-ts-autotag').setup() + ''); + }) + ]); +} diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix new file mode 100644 index 0000000..b031f47 --- /dev/null +++ b/modules/languages/markdown/config.nix @@ -0,0 +1,30 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.markdown; +in { + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + + vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage]; + }) + + (mkIf cfg.glow.enable { + vim.startPlugins = ["glow-nvim"]; + + vim.globals = { + "glow_binary_path" = "${pkgs.glow}/bin"; + }; + + vim.configRC.glow = nvim.dag.entryAnywhere '' + autocmd FileType markdown noremap p :Glow + ''; + }) + ]); +} diff --git a/modules/markdown/default.nix b/modules/languages/markdown/default.nix similarity index 62% rename from modules/markdown/default.nix rename to modules/languages/markdown/default.nix index e975149..3834589 100644 --- a/modules/markdown/default.nix +++ b/modules/languages/markdown/default.nix @@ -1,7 +1,6 @@ {...}: { imports = [ - ./glow ./config.nix - ./module.nix + ./markdown.nix ]; } diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix new file mode 100644 index 0000000..d81cb1b --- /dev/null +++ b/modules/languages/markdown/markdown.nix @@ -0,0 +1,30 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.markdown; +in { + options.vim.languages.markdown = { + enable = mkEnableOption "Markdown language support"; + + glow.enable = mkOption { + type = types.bool; + default = true; + description = "Enable markdown preview in neovim with glow"; + }; + + treesitter = { + enable = mkOption { + description = "Enable Markdown treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + mdPackage = nvim.types.mkGrammarOption pkgs "markdown"; + mdInlinePackage = nvim.types.mkGrammarOption pkgs "markdown-inline"; + }; + }; +} diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix new file mode 100644 index 0000000..c6dae73 --- /dev/null +++ b/modules/languages/nix.nix @@ -0,0 +1,157 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.nix; + + useFormat = "on_attach = default_on_attach"; + noFormat = "on_attach = attach_keymaps"; + + defaultServer = "nil"; + servers = { + rnix = { + package = pkgs.rnix-lsp; + internalFormatter = cfg.format.type == "nixpkgs-fmt"; + lspConfig = '' + lspconfig.rnix.setup{ + capabilities = capabilities, + ${ + if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt") + then useFormat + else noFormat + }, + cmd = {"${cfg.lsp.package}/bin/rnix-lsp"}, + } + ''; + }; + + nil = { + package = pkgs.nil; + internalFormatter = true; + lspConfig = '' + lspconfig.nil_ls.setup{ + capabilities = capabilities, + ${ + if cfg.format.enable + then useFormat + else noFormat + }, + cmd = {"${cfg.lsp.package}/bin/nil"}, + ${optionalString cfg.format.enable '' + settings = { + ["nil"] = { + ${optionalString (cfg.format.type == "alejandra") + '' + formatting = { + command = {"${cfg.format.package}/bin/alejandra", "--quiet"}, + }, + ''} + ${optionalString (cfg.format.type == "nixpkgs-fmt") + '' + formatting = { + command = {"${cfg.format.package}/bin/nixpkgs-fmt"}, + }, + ''} + ''} + }, + }; + } + ''; + }; + }; + + defaultFormat = "alejandra"; + formats = { + alejandra = { + package = pkgs.alejandra; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.alejandra.with({ + command = "${cfg.format.package}/bin/alejandra" + }) + ) + ''; + }; + nixpkgs-fmt = { + package = pkgs.nixpkgs-fmt; + # Never need to use null-ls for nixpkgs-fmt + }; + }; +in { + options.vim.languages.nix = { + enable = mkEnableOption "Nix language support"; + + treesitter = { + enable = mkOption { + description = "Enable Nix treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "nix"; + }; + + lsp = { + enable = mkOption { + description = "Enable Nix LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Nix LSP server to use"; + type = types.str; + default = defaultServer; + }; + package = mkOption { + description = "Nix LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable Nix formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "Nix formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "Nix formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + { + vim.configRC.nix = nvim.dag.entryAnywhere '' + autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2 + ''; + } + + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig; + }) + ]); +} diff --git a/modules/languages/python.nix b/modules/languages/python.nix new file mode 100644 index 0000000..ab80ca6 --- /dev/null +++ b/modules/languages/python.nix @@ -0,0 +1,104 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.python; + + defaultServer = "pyright"; + servers = { + pyright = { + package = pkgs.nodePackages.pyright; + lspConfig = '' + lspconfig.pyright.setup{ + capabilities = capabilities; + on_attach = default_on_attach; + cmd = {"${cfg.lsp.package}/bin/pyright-langserver", "--stdio"} + } + ''; + }; + }; + + defaultFormat = "black"; + formats = { + black = { + package = pkgs.black; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.black.with({ + command = "${cfg.format.package}/bin/black", + }) + ) + ''; + }; + }; +in { + options.vim.languages.python = { + enable = mkEnableOption "Python language support"; + + treesitter = { + enable = mkOption { + description = "Enable Python treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "Python treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable Python LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Python LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = nvim.types.mkGrammarOption pkgs "python"; + }; + + format = { + enable = mkOption { + description = "Enable Python formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "Python formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "Python formatter package"; + type = types.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.lspconfig.enable = true; + vim.lsp.lspconfig.sources.python-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig; + }) + ]); +} diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix new file mode 100644 index 0000000..25930cd --- /dev/null +++ b/modules/languages/rust.nix @@ -0,0 +1,109 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.rust; +in { + options.vim.languages.rust = { + enable = mkEnableOption "Rust language support"; + + treesitter = { + enable = mkOption { + description = "Enable Rust treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "rust"; + }; + + crates = { + enable = mkEnableOption "crates-nvim, tools for managing dependencies"; + codeActions = mkOption { + description = "Enable code actions through null-ls"; + type = types.bool; + default = true; + }; + }; + + lsp = { + enable = mkOption { + description = "Rust LSP support (rust-analyzer with extra tools)"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + package = mkOption { + description = "rust-analyzer package"; + type = types.package; + default = pkgs.rust-analyzer; + }; + opts = mkOption { + description = "Options to pass to rust analyzer"; + type = types.str; + default = ""; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.crates.enable { + vim.lsp.null-ls.enable = mkIf cfg.crates.codeActions true; + + vim.startPlugins = ["crates-nvim"]; + + vim.autocomplete.sources = {"crates" = "[Crates]";}; + vim.luaConfigRC.rust-crates = nvim.dag.entryAnywhere '' + require('crates').setup { + null_ls = { + enabled = ${boolToString cfg.crates.codeActions}, + name = "crates.nvim", + } + } + ''; + }) + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + (mkIf cfg.lsp.enable { + vim.startPlugins = ["rust-tools"]; + + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.rust-lsp = '' + local rt = require('rust-tools') + rust_on_attach = function(client, bufnr) + default_on_attach(client, bufnr) + local opts = { noremap=true, silent=true, buffer = bufnr } + vim.keymap.set("n", "ris", rt.inlay_hints.set, opts) + vim.keymap.set("n", "riu", rt.inlay_hints.unset, opts) + vim.keymap.set("n", "rr", rt.runnables.runnables, opts) + vim.keymap.set("n", "rp", rt.parent_module.parent_module, opts) + vim.keymap.set("n", "rm", rt.expand_macro.expand_macro, opts) + vim.keymap.set("n", "rc", rt.open_cargo_toml.open_cargo_toml, opts) + vim.keymap.set("n", "rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts) + end + local rustopts = { + tools = { + autoSetHints = true, + hover_with_actions = false, + inlay_hints = { + only_current_line = false, + } + }, + server = { + capabilities = capabilities, + on_attach = rust_on_attach, + cmd = {"${cfg.lsp.package}/bin/rust-analyzer"}, + settings = { + ${cfg.lsp.opts} + } + } + } + rt.setup(rustopts) + ''; + }) + ]); +} diff --git a/modules/languages/sql.nix b/modules/languages/sql.nix new file mode 100644 index 0000000..0b03cbc --- /dev/null +++ b/modules/languages/sql.nix @@ -0,0 +1,160 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.sql; + sqlfluffDefault = pkgs.sqlfluff; + + defaultServer = "sqls"; + servers = { + sqls = { + package = pkgs.sqls; + lspConfig = '' + lspconfig.sqls.setup { + on_attach = function(client) + client.server_capabilities.execute_command = true + on_attach_keymaps(client, bufnr) + require'sqls'.setup{} + end, + cmd = { "${cfg.lsp.package}/bin/sqls", "-config", string.format("%s/config.yml", vim.fn.getcwd()) } + } + ''; + }; + }; + + defaultFormat = "sqlfluff"; + formats = { + sqlfluff = { + package = sqlfluffDefault; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.sqlfluff.with({ + command = "${cfg.format.package}/bin/sqlfluff", + extra_args = {"--dialect", "${cfg.dialect}"} + }) + ) + ''; + }; + }; + + defaultDiagnostics = ["sqlfluff"]; + diagnostics = { + sqlfluff = { + package = sqlfluffDefault; + nullConfig = pkg: '' + table.insert( + ls_sources, + null_ls.builtins.diagnostics.sqlfluff.with({ + command = "${pkg}/bin/sqlfluff", + extra_args = {"--dialect", "${cfg.dialect}"} + }) + ) + ''; + }; + }; +in { + options.vim.languages.sql = { + enable = mkEnableOption "SQL language support"; + + dialect = mkOption { + description = "SQL dialect for sqlfluff (if used)"; + type = types.str; + default = "ansi"; + }; + + treesitter = { + enable = mkOption { + description = "Enable SQL treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "SQL treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable SQL LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "SQL LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "SQL LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable SQL formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "SQL formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "SQL formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + + extraDiagnostics = { + enable = mkOption { + description = "Enable extra SQL diagnostics"; + type = types.bool; + default = config.vim.languages.enableExtraDiagnostics; + }; + types = lib.nvim.types.diagnostics { + langDesc = "SQL"; + inherit diagnostics; + inherit defaultDiagnostics; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.startPlugins = ["sqls-nvim"]; + + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.sql-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources."sql-format" = formats.${cfg.format.type}.nullConfig; + }) + + (mkIf cfg.extraDiagnostics.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + lang = "sql"; + config = cfg.extraDiagnostics.types; + inherit diagnostics; + }; + }) + ]); +} diff --git a/modules/tidal/config.nix b/modules/languages/tidal/config.nix similarity index 100% rename from modules/tidal/config.nix rename to modules/languages/tidal/config.nix diff --git a/modules/tidal/default.nix b/modules/languages/tidal/default.nix similarity index 100% rename from modules/tidal/default.nix rename to modules/languages/tidal/default.nix diff --git a/modules/tidal/tidal.nix b/modules/languages/tidal/tidal.nix similarity index 100% rename from modules/tidal/tidal.nix rename to modules/languages/tidal/tidal.nix diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix new file mode 100644 index 0000000..d1c9796 --- /dev/null +++ b/modules/languages/ts.nix @@ -0,0 +1,145 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.ts; + + defaultServer = "tsserver"; + servers = { + tsserver = { + package = pkgs.nodePackages.typescript-language-server; + lspConfig = '' + lspconfig.tsserver.setup { + capabilities = capabilities; + on_attach = attach_keymaps, + cmd = { "${cfg.lsp.package}/bin/typescript-language-server", "--stdio" } + } + ''; + }; + }; + + # TODO: specify packages + defaultFormat = "prettier"; + formats = { + prettier = { + package = pkgs.nodePackages.prettier; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.prettier.with({ + command = "${cfg.format.package}/bin/prettier", + }) + ) + ''; + }; + }; + + # TODO: specify packages + defaultDiagnostics = ["eslint"]; + diagnostics = { + eslint = { + package = pkgs.nodePackages.eslint; + nullConfig = pkg: '' + table.insert( + ls_sources, + null_ls.builtins.diagnostics.eslint.with({ + command = "${pkg}/bin/eslint", + }) + ) + ''; + }; + }; +in { + options.vim.languages.ts = { + enable = mkEnableOption "SQL language support"; + + treesitter = { + enable = mkOption { + description = "Enable Typescript/Javascript treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + tsPackage = nvim.types.mkGrammarOption pkgs "tsx"; + jsPackage = nvim.types.mkGrammarOption pkgs "javascript"; + }; + + lsp = { + enable = mkOption { + description = "Enable Typescript/Javascript LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Typescript/Javascript LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Typescript/Javascript LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable Typescript/Javascript formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "Typescript/Javascript formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "Typescript/Javascript formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + + extraDiagnostics = { + enable = mkOption { + description = "Enable extra Typescript/Javascript diagnostics"; + type = types.bool; + default = config.vim.languages.enableExtraDiagnostics; + }; + types = lib.nvim.types.diagnostics { + langDesc = "Typescript/Javascript"; + inherit diagnostics; + inherit defaultDiagnostics; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.tsPackage cfg.treesitter.jsPackage]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.ts-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.ts-format = formats.${cfg.format.type}.nullConfig; + }) + + (mkIf cfg.extraDiagnostics.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + lang = "ts"; + config = cfg.extraDiagnostics.types; + inherit diagnostics; + }; + }) + ]); +} diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix new file mode 100644 index 0000000..0ce85db --- /dev/null +++ b/modules/languages/zig.nix @@ -0,0 +1,64 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.zig; +in { + options.vim.languages.zig = { + enable = mkEnableOption "SQL language support"; + + treesitter = { + enable = mkOption { + description = "Enable Zig treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "zig"; + }; + lsp = { + enable = mkOption { + description = "Zig LSP support (zls)"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + package = mkOption { + description = "ZLS package"; + type = types.package; + default = pkgs.nodePackages.pyright; + }; + zigPackage = mkOption { + description = "Zig package used by ZLS"; + type = types.package; + default = pkgs.zig; + }; + }; + }; + + 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.lspconfig.enable = true; + vim.lsp.lspconfig.sources.zig-lsp = '' + lspconfig.zls.setup { + capabilities = capabilities, + on_attach=default_on_attach, + cmd = {"${cfg.lsp.package}/bin/zls"}, + settings = { + ["zls"] = { + zig_exe_path = "${cfg.lsp.zigPackage}/bin/zig", + zig_lib_path = "${cfg.lsp.zigPackage}/lib/zig", + } + } + } + ''; + }) + ]); +} diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 6a6810c..2bf2567 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -1,354 +1,64 @@ { - pkgs, config, lib, + pkgs, ... }: with lib; with builtins; let cfg = config.vim.lsp; + usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; in { - config = mkIf cfg.enable ( - let - writeIf = cond: msg: - if cond - then msg - else ""; - in { - vim.startPlugins = - [ - "nvim-lspconfig" - "null-ls" - ] - ++ optionals (cfg.rust.enable) [ - "crates-nvim" - "rust-tools" - ] - ++ optionals (cfg.elixir.enable) [ - "elixir-ls" - ] - ++ optionals ((config.vim.autocomplete.enable) && (config.vim.autocomplete.type == "nvim-cmp")) [ - "cmp-nvim-lsp" - ] - ++ optionals (cfg.sql) [ - "sqls-nvim" - ]; + config = mkIf cfg.enable { + vim.startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; - vim.configRC.lsp = nvim.dag.entryAnywhere '' - ${ - if cfg.nix.enable - then '' - autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2 - '' - else "" - } + vim.autocomplete.sources = {"nvim_lsp" = "[LSP]";}; - ${ - if cfg.clang.c_header - then '' - " c syntax for header (otherwise breaks treesitter highlighting) - " https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/ - let g:c_syntax_for_h = 1 - '' - else "" - } - ''; - vim.luaConfigRC.lsp = nvim.dag.entryAnywhere '' + vim.luaConfigRC.lsp-setup = '' + vim.g.formatsave = ${boolToString cfg.formatOnSave}; - local attach_keymaps = function(client, bufnr) - local opts = { noremap=true, silent=true } + local attach_keymaps = function(client, bufnr) + local opts = { noremap=true, silent=true } - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgD', 'lua vim.lsp.buf.declaration()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgd', 'lua vim.lsp.buf.definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgt', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgn', 'lua vim.diagnostic.goto_next()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgp', 'lua vim.diagnostic.goto_prev()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgt', 'lua vim.lsp.buf.type_definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgn', 'lua vim.diagnostic.goto_next()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgp', 'lua vim.diagnostic.goto_prev()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lh', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ls', 'lua vim.lsp.buf.signature_help()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ln', 'lua vim.lsp.buf.rename()', opts) - end + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lh', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ls', 'lua vim.lsp.buf.signature_help()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ln', 'lua vim.lsp.buf.rename()', opts) + end - local null_ls = require("null-ls") - local null_helpers = require("null-ls.helpers") - local null_methods = require("null-ls.methods") + -- Enable formatting + format_callback = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + if vim.g.formatsave then + if client.supports_method("textDocument/formatting") then + local params = require'vim.lsp.util'.make_formatting_params({}) + client.request('textDocument/formatting', params, nil, bufnr) - local ls_sources = { - ${writeIf cfg.python - '' - null_ls.builtins.formatting.black.with({ - command = "${pkgs.black}/bin/black", - }), - ''} - - -- Commented out for now - --${writeIf (config.vim.git.enable && config.vim.git.gitsigns.enable) '' - -- null_ls.builtins.code_actions.gitsigns, - --''} - - ${writeIf cfg.sql - '' - null_helpers.make_builtin({ - method = null_methods.internal.FORMATTING, - filetypes = { "sql" }, - generator_opts = { - to_stdin = true, - ignore_stderr = true, - suppress_errors = true, - command = "${pkgs.sqlfluff}/bin/sqlfluff", - args = { - "fix", - "-", - }, - }, - factory = null_helpers.formatter_factory, - }), - - null_ls.builtins.diagnostics.sqlfluff.with({ - command = "${pkgs.sqlfluff}/bin/sqlfluff", - extra_args = {"--dialect", "postgres"} - }), - ''} - - ${writeIf - (cfg.nix.enable - && cfg.nix.server == "rnix" - && cfg.nix.formatter == "alejandra") - '' - null_ls.builtins.formatting.alejandra.with({ - command = "${pkgs.alejandra}/bin/alejandra" - }), - ''} - - ${writeIf cfg.ts - '' - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.formatting.prettier, - ''} - } - - vim.g.formatsave = ${ - if cfg.formatOnSave - then "true" - else "false" - }; - - -- Enable formatting - format_callback = function(client, bufnr) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - if vim.g.formatsave then - if client.supports_method("textDocument/formatting") then - local params = require'vim.lsp.util'.make_formatting_params({}) - client.request('textDocument/formatting', params, nil, bufnr) - end end end - }) - end - - default_on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - format_callback(client, bufnr) - end - - -- Enable null-ls - require('null-ls').setup({ - diagnostics_format = "[#{m}] #{s} (#{c})", - debounce = 250, - default_timeout = 5000, - sources = ls_sources, - on_attach=default_on_attach - }) - - -- Enable lspconfig - local lspconfig = require('lspconfig') - - local capabilities = vim.lsp.protocol.make_client_capabilities() - ${ - let - cfg = config.vim.autocomplete; - in - writeIf cfg.enable ( - if cfg.type == "nvim-cmp" - then '' - capabilities = require('cmp_nvim_lsp').default_capabilities() - '' - else "" - ) - } - - ${writeIf cfg.rust.enable '' - -- Rust config - local rt = require('rust-tools') - - rust_on_attach = function(client, bufnr) - default_on_attach(client, bufnr) - local opts = { noremap=true, silent=true, buffer = bufnr } - vim.keymap.set("n", "ris", rt.inlay_hints.set, opts) - vim.keymap.set("n", "riu", rt.inlay_hints.unset, opts) - vim.keymap.set("n", "rr", rt.runnables.runnables, opts) - vim.keymap.set("n", "rp", rt.parent_module.parent_module, opts) - vim.keymap.set("n", "rm", rt.expand_macro.expand_macro, opts) - vim.keymap.set("n", "rc", rt.open_cargo_toml.open_cargo_toml, opts) - vim.keymap.set("n", "rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts) end + }) + end - local rustopts = { - tools = { - autoSetHints = true, - hover_with_actions = false, - inlay_hints = { - only_current_line = false, - } - }, - server = { - capabilities = capabilities, - on_attach = rust_on_attach, - cmd = {"${pkgs.rust-analyzer}/bin/rust-analyzer"}, - settings = { - ${cfg.rust.rustAnalyzerOpts} - } - } - } + default_on_attach = function(client, bufnr) + attach_keymaps(client, bufnr) + format_callback(client, bufnr) + end - require('crates').setup { - null_ls = { - enabled = true, - name = "crates.nvim", - } - } - rt.setup(rustopts) - ''} - - ${optionalString cfg.zig.enable '' - -- Zig config - lspconfig.zls.setup { - capabilities = capabilities, - on_attach=default_on_attach, - cmd = {"${pkgs.zls}/bin/zls"}, - settings = { - ["zls"] = { - zig_exe_path = "${pkgs.zig}/bin/zig", - zig_lib_path = "${pkgs.zig}/lib/zig", - } - } - } - ''} - - ${writeIf cfg.python '' - -- Python config - lspconfig.pyright.setup{ - capabilities = capabilities; - on_attach=default_on_attach; - cmd = {"${pkgs.nodePackages.pyright}/bin/pyright-langserver", "--stdio"} - } - ''} - - ${writeIf cfg.nix.enable ( - (writeIf (cfg.nix.server == "rnix") '' - -- Nix (rnix) config - lspconfig.rnix.setup{ - capabilities = capabilities, - ${writeIf (cfg.nix.formatter == "alejandra") - '' - on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - end, - ''} - ${writeIf (cfg.nix.formatter == "nixpkgs-fmt") - '' - on_attach = default_on_attach, - ''} - cmd = {"${cfg.nix.pkg}/bin/rnix-lsp"}, - } - '') - + (writeIf (cfg.nix.server == "nil") '' - -- Nix (nil) config - lspconfig.nil_ls.setup{ - capabilities = capabilities, - on_attach=default_on_attach, - cmd = {"${cfg.nix.pkg}/bin/nil"}, - settings = { - ["nil"] = { - ${writeIf (cfg.nix.formatter == "alejandra") - '' - formatting = { - command = {"${pkgs.alejandra}/bin/alejandra", "--quiet"}, - }, - ''} - ${writeIf (cfg.nix.formatter == "nixpkgs-fmt") - '' - formatting = { - command = {"${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"}, - }, - ''} - }, - }; - } - '') - )} - - - ${writeIf cfg.clang.enable '' - -- CCLS (clang) config - lspconfig.ccls.setup{ - capabilities = capabilities; - on_attach=default_on_attach; - cmd = {"${pkgs.ccls}/bin/ccls"}; - ${ - if cfg.clang.cclsOpts == "" - then "" - else "init_options = ${cfg.clang.cclsOpts}" - } - } - ''} - - ${writeIf cfg.sql '' - -- SQLS config - lspconfig.sqls.setup { - on_attach = function(client) - client.server_capabilities.execute_command = true - on_attach_keymaps(client, bufnr) - require'sqls'.setup{} - end, - cmd = {"${pkgs.sqls}/bin/sqls", "-config", string.format("%s/config.yml", vim.fn.getcwd()) } - } - ''} - - ${writeIf cfg.go '' - -- Go config - lspconfig.gopls.setup { - capabilities = capabilities; - on_attach = default_on_attach; - cmd = {"${pkgs.gopls}/bin/gopls", "serve"}, - } - ''} - - ${writeIf cfg.ts '' - -- TS config - lspconfig.tsserver.setup { - capabilities = capabilities; - on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - end, - cmd = { "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server", "--stdio" } - } - ''} - - ${writeIf cfg.elixir.enable '' - lspconfig.elixirls.setup { - cmd = { "${lib.getExe pkgs.elixir-ls}" }, - on_attach = on_attach - } - ''} - ''; - } - ); + local capabilities = vim.lsp.protocol.make_client_capabilities() + ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} + ''; + }; } diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index cb88e3d..7f13e40 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -1,18 +1,19 @@ -{...}: { +_: { imports = [ # nvim lsp support ./config.nix ./module.nix + ./lspconfig + ./lspsaga + ./null-ls + # lsp plugins ./lspsaga ./nvim-code-action-menu ./trouble ./lsp-signature ./lightbulb - - # language specific modules - ./flutter-tools-nvim # dart & flutter - ./elixir # elixir + ./lspkind ]; } diff --git a/modules/lsp/elixir/elixir-tools.nix b/modules/lsp/elixir/elixir-tools.nix deleted file mode 100644 index d3fe1ec..0000000 --- a/modules/lsp/elixir/elixir-tools.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.lsp.elixir = { - }; -} diff --git a/modules/lsp/flutter-tools-nvim/config.nix b/modules/lsp/flutter-tools-nvim/config.nix deleted file mode 100644 index 2c97e90..0000000 --- a/modules/lsp/flutter-tools-nvim/config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.lsp; - ftcfg = cfg.dart.flutter-tools; -in { - config = mkIf (cfg.enable && ftcfg.enable) { - vim.startPlugins = ["flutter-tools"]; - - vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere '' - require('flutter-tools').setup { - lsp = { - color = { -- show the derived colours for dart variables - enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 - background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background - foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground - virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text - virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight - }, - - capabilities = capabilities, - on_attach = default_on_attach; - flags = lsp_flags, - }, - } - - ''; - }; -} diff --git a/modules/lsp/flutter-tools-nvim/flutter-tools.nix b/modules/lsp/flutter-tools-nvim/flutter-tools.nix deleted file mode 100644 index 2f87c31..0000000 --- a/modules/lsp/flutter-tools-nvim/flutter-tools.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.lsp.dart.flutter-tools = { - color = { - enable = mkEnableOption "Whether or mot to highlight color variables at all"; - - highlightBackground = mkOption { - type = types.bool; - default = false; - description = "Highlight the background"; - }; - - highlightForeground = mkOption { - type = types.bool; - default = false; - description = "Highlight the foreground"; - }; - - virtualText = { - enable = mkEnableOption "Show the highlight using virtual text"; - - character = mkOption { - type = types.str; - default = "■"; - description = "Virtual text character to highlight"; - }; - }; - }; - }; -} diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix new file mode 100644 index 0000000..70485be --- /dev/null +++ b/modules/lsp/lspconfig/config.nix @@ -0,0 +1,25 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + config = mkIf cfg.lspconfig.enable (mkMerge [ + { + vim.lsp.enable = true; + + vim.startPlugins = ["nvim-lspconfig"]; + + vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' + local lspconfig = require('lspconfig') + ''; + } + { + vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryAfter ["lspconfig"] v)) cfg.lspconfig.sources; + } + ]); +} diff --git a/modules/lsp/flutter-tools-nvim/default.nix b/modules/lsp/lspconfig/default.nix similarity index 64% rename from modules/lsp/flutter-tools-nvim/default.nix rename to modules/lsp/lspconfig/default.nix index 4cbe9c0..117e4d4 100644 --- a/modules/lsp/flutter-tools-nvim/default.nix +++ b/modules/lsp/lspconfig/default.nix @@ -1,6 +1,6 @@ _: { imports = [ - ./flutter-tools.nix ./config.nix + ./lspconfig.nix ]; } diff --git a/modules/lsp/lspconfig/lspconfig.nix b/modules/lsp/lspconfig/lspconfig.nix new file mode 100644 index 0000000..7bc3dab --- /dev/null +++ b/modules/lsp/lspconfig/lspconfig.nix @@ -0,0 +1,18 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; { + options.vim.lsp.lspconfig = { + enable = mkEnableOption "nvim-lspconfig, also enabled automatically"; + + sources = mkOption { + description = "nvim-lspconfig sources"; + type = with types; attrsOf str; + default = {}; + }; + }; +} diff --git a/modules/lsp/lspkind/config.nix b/modules/lsp/lspkind/config.nix new file mode 100644 index 0000000..a243d62 --- /dev/null +++ b/modules/lsp/lspkind/config.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + config = mkIf (cfg.enable && cfg.lspkind.enable) { + vim.startPlugins = ["lspkind"]; + vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere '' + local lspkind = require'lspkind' + local lspkind_opts = { + mode = '${cfg.lspkind.mode}' + } + ''; + }; +} diff --git a/modules/lsp/lspkind/default.nix b/modules/lsp/lspkind/default.nix new file mode 100644 index 0000000..81f7418 --- /dev/null +++ b/modules/lsp/lspkind/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./lspkind.nix + ]; +} diff --git a/modules/lsp/lspkind/lspkind.nix b/modules/lsp/lspkind/lspkind.nix new file mode 100644 index 0000000..82d721b --- /dev/null +++ b/modules/lsp/lspkind/lspkind.nix @@ -0,0 +1,22 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + options.vim.lsp = { + lspkind = { + enable = mkEnableOption "vscode-like pictograms for lsp [lspkind]"; + + mode = mkOption { + description = "Defines how annotations are shown"; + type = with types; enum ["text" "text_symbol" "symbol_text" "symbol"]; + default = "symbol_text"; + }; + }; + }; +} diff --git a/modules/lsp/module.nix b/modules/lsp/module.nix index 87df9db..88a2811 100644 --- a/modules/lsp/module.nix +++ b/modules/lsp/module.nix @@ -1,77 +1,13 @@ { - pkgs, config, lib, + pkgs, ... }: with lib; -with builtins; let - cfg = config.vim.lsp; -in { +with builtins; { options.vim.lsp = { - enable = mkEnableOption "Enable neovim LSP support. Requires language specific LSPs to be anabled to take effect"; - formatOnSave = mkEnableOption "Format on save"; - nix = { - enable = mkEnableOption "Nix LSP"; - server = mkOption { - type = with types; enum ["rnix" "nil"]; - default = "nil"; - description = "Which LSP to use"; - }; - - pkg = mkOption { - type = types.package; - default = - if (cfg.nix.server == "rnix") - then pkgs.rnix-lsp - else pkgs.nil; - description = "The LSP package to use"; - }; - - formatter = mkOption { - type = with types; enum ["nixpkgs-fmt" "alejandra"]; - default = "alejandra"; - description = "Which nix formatter to use"; - }; - }; - rust = { - enable = mkEnableOption "Rust LSP"; - rustAnalyzerOpts = mkOption { - type = types.str; - default = '' - ["rust-analyzer"] = { - experimental = { - procAttrMacros = true, - }, - }, - ''; - description = "Options to pass to rust analyzer"; - }; - }; - python = mkEnableOption "Python LSP"; - clang = { - enable = mkEnableOption "C language LSP"; - c_header = mkEnableOption "C syntax header files"; - cclsOpts = mkOption { - type = types.str; - default = ""; - }; - }; - - dart = { - enable = mkEnableOption "Dart Language LSP"; - flutter-tools = { - enable = mkEnableOption ""; - }; - }; - - elixir = { - enable = mkEnableOption "Elixir LSP"; - }; - - sql = mkEnableOption "SQL Language LSP"; - go = mkEnableOption "Go language LSP"; - ts = mkEnableOption "TS language LSP"; - zig.enable = mkEnableOption "Zig language LSP"; + enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; + formatOnSave = mkEnableOption "format on save"; }; } diff --git a/modules/lsp/null-ls/config.nix b/modules/lsp/null-ls/config.nix new file mode 100644 index 0000000..7f1289a --- /dev/null +++ b/modules/lsp/null-ls/config.nix @@ -0,0 +1,36 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + config = mkIf cfg.null-ls.enable (mkMerge [ + { + vim.lsp.enable = true; + vim.startPlugins = ["null-ls"]; + + vim.luaConfigRC.null_ls-setup = nvim.dag.entryAnywhere '' + local null_ls = require("null-ls") + local null_helpers = require("null-ls.helpers") + local null_methods = require("null-ls.methods") + local ls_sources = {} + ''; + vim.luaConfigRC.null_ls = nvim.dag.entryAfter ["null_ls-setup" "lsp-setup"] '' + require('null-ls').setup({ + diagnostics_format = "[#{m}] #{s} (#{c})", + debounce = 250, + default_timeout = 5000, + sources = ls_sources, + on_attach=default_on_attach + }) + ''; + } + { + vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources; + } + ]); +} diff --git a/modules/lsp/null-ls/default.nix b/modules/lsp/null-ls/default.nix new file mode 100644 index 0000000..01e6e59 --- /dev/null +++ b/modules/lsp/null-ls/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./null-ls.nix + ]; +} diff --git a/modules/lsp/null-ls/null-ls.nix b/modules/lsp/null-ls/null-ls.nix new file mode 100644 index 0000000..b8b661c --- /dev/null +++ b/modules/lsp/null-ls/null-ls.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + options.vim.lsp.null-ls = { + enable = mkEnableOption "null-ls, also enabled automatically"; + + sources = mkOption { + description = "null-ls sources"; + type = with types; attrsOf str; + default = {}; + }; + }; +} diff --git a/modules/markdown/config.nix b/modules/markdown/config.nix deleted file mode 100644 index c8929ce..0000000 --- a/modules/markdown/config.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; { - config = { - vim.markdown = { - enable = mkDefault false; - }; - }; -} diff --git a/modules/markdown/glow/config.nix b/modules/markdown/glow/config.nix deleted file mode 100644 index f0019f2..0000000 --- a/modules/markdown/glow/config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.vim.markdown.glow; -in { - config = (mkIf cfg.enable) { - vim.startPlugins = [ - "glow-nvim" - ]; - - vim.globals = { - "glow_binary_path" = "${pkgs.glow}/bin"; - }; - - vim.configRC.glow-nvim = nvim.dag.entryAnywhere '' - autocmd FileType markdown noremap pm :Glow - ''; - - vim.luaConfigRC.glow-nvim = nvim.dag.entryAnywhere '' - require('glow').setup({ - -- use glow path from vim.globals - path = vim.g.glow_binary_path, - border = "${toString cfg.border}", - pager = ${boolToString cfg.pager}, - width = 120, - }) - ''; - }; -} diff --git a/modules/markdown/glow/glow.nix b/modules/markdown/glow/glow.nix deleted file mode 100644 index ad20b65..0000000 --- a/modules/markdown/glow/glow.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.markdown.glow = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable markdown preview in neovim with glow"; - }; - border = mkOption { - type = types.enum ["shadow" "rounded" "single" "double" "none"]; - default = "double"; - description = "Border style for glow preview"; - }; - - # style should be either light or dark - style = mkOption { - type = types.enum ["light" "dark"]; - default = "dark"; - description = "Style for glow preview"; - }; - - pager = mkOption { - type = types.bool; - default = false; - description = "Enable pager for glow preview"; - }; - }; -} diff --git a/modules/markdown/module.nix b/modules/markdown/module.nix deleted file mode 100644 index 761f58c..0000000 --- a/modules/markdown/module.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.markdown; -in { - options.vim.markdown = { - enable = mkEnableOption "Enable markdown tools and plugins"; - }; - - config = mkIf (cfg.enable) { - /* - ... - */ - }; -} diff --git a/modules/modules.nix b/modules/modules.nix index 47e9eb8..a23241c 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -14,10 +14,8 @@ ./visuals ./lsp ./treesitter - ./tidal ./autopairs ./snippets - ./markdown ./git ./minimap ./dashboard @@ -30,6 +28,7 @@ ./session ./comments ./projects + ./languages ]; pkgsModule = {config, ...}: { diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index deb78fb..7d4d879 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -22,6 +22,7 @@ in { always_divide_middle = true, globalstatus = ${boolToString cfg.globalStatus}, ignore_focus = {'NvimTree'}, + extensions = {${optionalString config.vim.filetree.nvimTreeLua.enable "'nvim-tree'"}}, refresh = { statusline = ${toString cfg.refresh.statusline}, tabline = ${toString cfg.refresh.tabline}, diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index f95850a..f1bd31c 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -8,11 +8,7 @@ with builtins; let supported_themes = import ./supported_themes.nix; in { options.vim.statusline.lualine = { - enable = mkOption { - type = types.bool; - description = "Enable lualine statusline"; - default = true; - }; + enable = mkEnableOption "lualine"; icons = { enable = mkOption { @@ -46,50 +42,50 @@ in { default = true; }; - theme = mkOption { - default = "auto"; - type = types.enum ( - [ - "auto" - "16color" - "gruvbox" - "ayu_dark" - "ayu_light" - "ayu_mirage" - "codedark" - "dracula" - "everforest" - "gruvbox" - "gruvbox_light" - "gruvbox_material" - "horizon" - "iceberg_dark" - "iceberg_light" - "jellybeans" - "material" - "modus_vivendi" - "molokai" - "nightfly" - "nord" - "oceanicnext" - "onelight" - "palenight" - "papercolor_dark" - "papercolor_light" - "powerline" - "seoul256" - "solarized_dark" - "tomorrow" - "wombat" - ] - ++ ( - if elem config.vim.theme.name supported_themes - then [config.vim.theme.name] - else [] - ) - ); - description = "Theme for lualine"; - }; + theme = let + themeSupported = elem config.vim.theme.name supported_themes; + in + mkOption { + description = "Theme for lualine"; + type = types.enum ([ + "auto" + "16color" + "gruvbox" + "ayu_dark" + "ayu_light" + "ayu_mirage" + "codedark" + "dracula" + "everforest" + "gruvbox" + "gruvbox_light" + "gruvbox_material" + "horizon" + "iceberg_dark" + "iceberg_light" + "jellybeans" + "material" + "modus_vivendi" + "molokai" + "nightfly" + "nord" + "oceanicnext" + "onelight" + "palenight" + "papercolor_dark" + "papercolor_light" + "powerline" + "seoul256" + "solarized_dark" + "tomorrow" + "wombat" + ] + ++ optional themeSupported config.vim.theme.name); + default = "auto"; + # TODO: xml generation error if the closing '' is on a new line. + # issue: https://gitlab.com/rycee/nmd/-/issues/10 + defaultText = nvim.nmd.literalAsciiDoc ''`config.vim.theme.name` if theme supports lualine else "auto"''; + }; sectionSeparator = { left = mkOption { diff --git a/modules/theme/supported_themes.nix b/modules/theme/supported_themes.nix index c0ebfcf..814b412 100644 --- a/modules/theme/supported_themes.nix +++ b/modules/theme/supported_themes.nix @@ -19,6 +19,13 @@ styles = ["day" "night" "storm"]; }; + dracula = { + setup = '' + require('dracula').setup({}); + require('dracula').load(); + ''; + }; + catppuccin = { setup = { style ? "mocha", diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix index 08acaa0..b75121b 100644 --- a/modules/treesitter/config.nix +++ b/modules/treesitter/config.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, ... @@ -6,59 +7,42 @@ with lib; with builtins; let cfg = config.vim.treesitter; + usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; in { - config = mkIf cfg.enable ( - let - writeIf = cond: msg: - if cond - then msg - else ""; - in { - vim.startPlugins = [ - "nvim-treesitter" - ( - if cfg.autotagHtml - then "nvim-ts-autotag" - else null - ) - ]; + config = mkIf cfg.enable { + vim.startPlugins = + ["nvim-treesitter"] + ++ optional usingNvimCmp "cmp-treesitter"; - # For some reason treesitter highlighting does not work on start if this is set before syntax on - vim.configRC.treesitter = writeIf cfg.fold (nvim.dag.entryBefore ["basic"] '' - " Tree-sitter based folding - set foldmethod=expr - set foldexpr=nvim_treesitter#foldexpr() - set nofoldenable - ''); + vim.autocomplete.sources = {"treesitter" = "[Treesitter]";}; - vim.luaConfigRC.treesitter = nvim.dag.entryAnywhere '' - -- Treesitter config - require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - disable = {}, + # For some reason treesitter highlighting does not work on start if this is set before syntax on + vim.configRC.treesitter-fold = mkIf cfg.fold (nvim.dag.entryBefore ["basic"] '' + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() + set nofoldenable + ''); + + vim.luaConfigRC.treesitter = nvim.dag.entryAnywhere '' + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + disable = {}, + }, + + auto_install = false, + ensure_installed = {}, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", }, - - auto_install = false, - ensure_installed = {}, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, - - ${writeIf cfg.autotagHtml '' - autotag = { - enable = true, - }, - ''} - } - ''; - } - ); + }, + } + ''; + }; } diff --git a/modules/treesitter/context.nix b/modules/treesitter/context.nix index 30472ae..08039bb 100644 --- a/modules/treesitter/context.nix +++ b/modules/treesitter/context.nix @@ -1,29 +1,84 @@ { + pkgs, config, lib, ... }: with lib; with builtins; let - cfg = config.vim.treesitter; + treesitter = config.vim.treesitter; + cfg = treesitter.context; in { - options.vim.treesitter.context.enable = mkOption { - type = types.bool; - default = false; - description = "enable function context [nvim-treesitter-context]"; + options.vim.treesitter.context = { + enable = mkEnableOption "context of current buffer contents [nvim-treesitter-context] "; + + maxLines = mkOption { + description = "How many lines the window should span. Values <=0 mean no limit."; + type = types.int; + default = 0; + }; + + minWindowHeight = mkOption { + description = "Minimum editor window height to enable context. Values <= 0 mean no limit."; + type = types.int; + default = 0; + }; + + lineNumbers = mkOption { + description = ""; + type = types.bool; + default = true; + }; + + multilineThreshold = mkOption { + description = "Maximum number of lines to collapse for a single context line."; + type = types.int; + default = 20; + }; + + trimScope = mkOption { + description = nvim.nmd.asciiDoc "Which context lines to discard if <> is exceeded."; + type = types.enum ["inner" "outer"]; + default = "outer"; + }; + + mode = mkOption { + description = "Line used to calculate context."; + type = types.enum ["cursor" "topline"]; + default = "cursor"; + }; + + separator = mkOption { + description = nvim.nmd.asciiDoc '' + Separator between context and content. Should be a single character string, like '-'. + + When separator is set, the context will only show up when there are at least 2 lines above cursorline. + ''; + type = with types; nullOr str; + default = null; + }; + + zindex = mkOption { + description = "The Z-index of the context window."; + type = types.int; + default = 20; + }; }; - config = mkIf (cfg.enable && cfg.context.enable) { - vim.startPlugins = [ - "nvim-treesitter-context" - ]; + config = mkIf (treesitter.enable && cfg.enable) { + vim.startPlugins = ["nvim-treesitter-context"]; vim.luaConfigRC.treesitter-context = nvim.dag.entryAnywhere '' - -- Treesitter Context config require'treesitter-context'.setup { enable = true, - throttle = true, - max_lines = 0 + max_lines = ${toString cfg.maxLines}, + min_window_height = ${toString cfg.minWindowHeight}, + line_numbers = ${boolToString cfg.lineNumbers}, + multiline_threshold = ${toString cfg.multilineThreshold}, + trim_scope = '${cfg.trimScope}', + mode = '${cfg.mode}', + separator = ${nvim.lua.nullString cfg.separator}, + max_lines = ${toString cfg.zindex}, } ''; }; diff --git a/modules/treesitter/treesitter.nix b/modules/treesitter/treesitter.nix index 550e7fe..cd4476d 100644 --- a/modules/treesitter/treesitter.nix +++ b/modules/treesitter/treesitter.nix @@ -5,53 +5,24 @@ ... }: with lib; -with builtins; { +with builtins; let + cfg = config.vim.treesitter; + usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; +in { options.vim.treesitter = { - enable = mkOption { - default = false; - type = types.bool; - description = "Enable tree-sitter [nvim-treesitter]"; - }; + enable = mkEnableOption "treesitter, also enabled automatically through language options"; - fold = mkOption { - default = false; - type = types.bool; - description = "Enable fold with tree-sitter"; - }; + fold = mkEnableOption "fold with treesitter"; - autotagHtml = mkOption { - default = false; - type = types.bool; - description = "Enable autoclose and rename html tag [nvim-ts-autotag]"; - }; + autotagHtml = mkEnableOption "autoclose and rename html tag"; grammars = mkOption { type = with types; listOf package; - default = with (pkgs.vimPlugins.nvim-treesitter.builtGrammars); - [ - c - cpp - nix - python - rust - markdown - comment - toml - make - tsx - html - javascript - css - graphql - json - zig - elixir - heex - ] - ++ (optional config.vim.notes.orgmode.enable org); # add orgmode grammar if enabled - description = '' - List of treesitter grammars to install. - When enabling a language, its treesitter grammar is added for you. + default = []; + description = nvim.nmd.asciiDoc '' + List of treesitter grammars to install. For supported languages + use the `vim.language..treesitter` option + ''; }; }; diff --git a/modules/utility/binds/which-key/config.nix b/modules/utility/binds/which-key/config.nix index e2f5ae1..2a7b4b8 100644 --- a/modules/utility/binds/which-key/config.nix +++ b/modules/utility/binds/which-key/config.nix @@ -106,7 +106,7 @@ in { } ${ - if config.vim.markdown.glow.enable + if config.vim.languages.markdown.glow.enable then '' -- Markdown ["pm"] = { name = "+Preview Markdown" }, diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index ff87b50..676fb82 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -6,151 +6,105 @@ with lib; let cfg = config.vim.visuals; in { - config = mkIf cfg.enable { - vim.startPlugins = [ - ( - if cfg.nvimWebDevicons.enable - then "nvim-web-devicons" - else null - ) - ( - if cfg.lspkind.enable - then "lspkind" - else null - ) - ( - if cfg.cursorWordline.enable - then "nvim-cursorline" - else null - ) - ( - if cfg.indentBlankline.enable - then "indent-blankline" - else null - ) - ( - if cfg.scrollBar.enable - then "scrollbar-nvim" - else null - ) - ( - if cfg.smoothScroll.enable - then "cinnamon-nvim" - else null - ) - ( - if cfg.cellularAutomaton.enable - then "cellular-automaton" - else null - ) - ( - if cfg.fidget-nvim.enable - then "fidget-nvim" - else null - ) - ]; + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.indentBlankline.enable { + vim.startPlugins = ["indent-blankline"]; + vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere '' + -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 + vim.wo.colorcolumn = "99999" + vim.opt.list = true - vim.luaConfigRC.visuals = nvim.dag.entryAnywhere '' - ${ - if cfg.lspkind.enable - then "require'lspkind'.init()" - else "" - } - ${ - if cfg.indentBlankline.enable - then '' - -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 - vim.wo.colorcolumn = "99999" - vim.opt.list = true + ${optionalString (cfg.indentBlankline.eolChar != null) '' + vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" }) + ''} + ${optionalString (cfg.indentBlankline.fillChar != null) '' + vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}" }) + ''} + require("indent_blankline").setup { + enabled = true, + char = "${cfg.indentBlankline.listChar}", + show_current_context = ${boolToString cfg.indentBlankline.showCurrContext}, + show_end_of_line = ${boolToString cfg.indentBlankline.showEndOfLine}, + use_treesitter = ${boolToString cfg.indentBlankline.useTreesitter}, + } + ''; + }) - ${ - if cfg.indentBlankline.eolChar == "" - then "" - else ''vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" })'' - } + (mkIf cfg.cursorWordline.enable { + vim.startPlugins = ["nvim-cursorline"]; + vim.luaConfigRC.cursorline = nvim.dag.entryAnywhere '' + vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout} + ''; + }) - ${ - if cfg.indentBlankline.fillChar == "" - then "" - else ''vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}"})'' - } + (mkIf cfg.nvimWebDevicons.enable { + vim.startPlugins = ["nvim-web-devicons"]; + }) - require("indent_blankline").setup { - char = "${cfg.indentBlankline.listChar}", - show_current_context = ${boolToString cfg.indentBlankline.showCurrContext}, - show_end_of_line = true, - } - '' - else "" - } - - ${ - if cfg.cursorWordline.enable - then "vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout}" - else "" - } - - ${ - if cfg.scrollBar.enable - then "require('scrollbar').setup{ + (mkIf cfg.scrollBar.enable { + vim.startPlugins = ["scrollbar-nvim"]; + vim.luaConfigRC.scrollBar = nvim.dag.entryAnywhere '' + require('scrollbar').setup{ excluded_filetypes = { 'prompt', 'TelescopePrompt', 'noice', 'NvimTree', - 'alpha' + 'alpha', + 'code-action-menu-menu' }, - }" - else "" - } - ${ - if cfg.smoothScroll.enable - then "require('cinnamon').setup()" - else "" - } - ${ - if cfg.cellularAutomaton.enable - then '' - local config = { - fps = 50, - name = 'slide', } + ''; + }) - -- init function is invoked only once at the start - -- config.init = function (grid) - -- - -- end + (mkIf cfg.smoothScroll.enable { + vim.startPlugins = ["cinnamon-nvim"]; + vim.luaConfigRC.smoothScroll = nvim.dag.entryAnywhere '' + require('cinnamon').setup() + ''; + }) - -- update function - config.update = function (grid) - for i = 1, #grid do - local prev = grid[i][#(grid[i])] - for j = 1, #(grid[i]) do - grid[i][j], prev = prev, grid[i][j] - end - end - return true - end - - require("cellular-automaton").register_animation(config) - - vim.keymap.set("n", "fml", "CellularAutomaton make_it_rain") - '' - else "" - } - ${ - if cfg.fidget-nvim.enable - then '' - require"fidget".setup{ - align = { - bottom = ${boolToString cfg.fidget-nvim.align.bottom}, - right = ${boolToString cfg.fidget-nvim.align.right}, + (mkIf cfg.cellularAutomaton.enable { + vim.startPlugins = ["cellular-automaton"]; + vim.luaConfigRC.cellularAUtomaton = nvim.dag.entryAnywhere '' + local config = { + fps = 50, + name = 'slide', } + + -- init function is invoked only once at the start + -- config.init = function (grid) + -- + -- end + + -- update function + config.update = function (grid) + for i = 1, #grid do + local prev = grid[i][#(grid[i])] + for j = 1, #(grid[i]) do + grid[i][j], prev = prev, grid[i][j] + end + end + return true + end + + require("cellular-automaton").register_animation(config) + + vim.keymap.set("n", "fml", "CellularAutomaton make_it_rain") + ''; + }) + + (mkIf cfg.fidget-nvim.enable { + vim.startPlugins = ["fidget-nvim"]; + vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere '' + require"fidget".setup{ + align = { + bottom = ${boolToString cfg.fidget-nvim.align.bottom}, + right = ${boolToString cfg.fidget-nvim.align.right}, } - '' - else "" - } - ''; - }; + } + ''; + }) + ]); } diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 7fe03ad..4981961 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -4,25 +4,13 @@ ... }: with lib; -with builtins; { +with builtins; let + cfg = config.vim.visuals; +in { options.vim.visuals = { - enable = mkOption { - type = types.bool; - description = "Enable visual enhancements"; - default = false; - }; + enable = mkEnableOption "Visual enhancements."; - nvimWebDevicons.enable = mkOption { - type = types.bool; - description = "Enable dev icons. required for certain plugins [nvim-web-devicons]"; - default = false; - }; - - lspkind.enable = mkOption { - type = types.bool; - description = "Enable vscode-like pictograms for lsp [lspkind]"; - default = false; - }; + nvimWebDevicons.enable = mkEnableOption "dev icons. Required for certain plugins [nvim-web-devicons]."; scrollBar.enable = mkOption { type = types.bool; @@ -64,15 +52,12 @@ with builtins; { }; cursorWordline = { - enable = mkOption { - type = types.bool; - description = "Enable word and delayed line highlight [nvim-cursorline]"; - default = false; - }; + enable = mkEnableOption "word and delayed line highlight [nvim-cursorline]."; lineTimeout = mkOption { type = types.int; description = "Time in milliseconds for cursorline to appear"; + default = 500; }; }; @@ -90,21 +75,39 @@ with builtins; { }; fillChar = mkOption { - type = types.str; description = "Character to fill indents"; + type = with types; nullOr types.str; default = "⋅"; }; eolChar = mkOption { - type = types.str; description = "Character at end of line"; + type = with types; nullOr types.str; default = "↴"; }; - showCurrContext = mkOption { + showEndOfLine = mkOption { + description = nvim.nmd.asciiDoc '' + Displays the end of line character set by <> instead of the + indent guide on line returns. + ''; type = types.bool; + default = cfg.indentBlankline.eolChar != null; + defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null"; + }; + + showCurrContext = mkOption { description = "Highlight current context from treesitter"; - default = true; + type = types.bool; + default = config.vim.treesitter.enable; + defaultText = literalExpression "config.vim.treesitter.enable"; + }; + + useTreesitter = mkOption { + description = "Use treesitter to calculate indentation when possible."; + type = types.bool; + default = config.vim.treesitter.enable; + defaultText = literalExpression "config.vim.treesitter.enable"; }; }; };