diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 436a68ec..d85c28da 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -16,7 +16,7 @@ If you have any questions regarding those files, feel free to open an issue or [ ## Contributing -The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask. +The contribution process is mostly documented in the [pull request template](pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask. ### Guidelines diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index ca65c8b2..00000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,39 +0,0 @@ -# Description - -A clear and concise description of the aim of your Pull Request. - -**If your pull request aims to fix an open issue or a present bug, please link the relevant issue below. If not, please remove this section** -Fixes #(issue) - -## Type of change - -Please delete any options that are not relevant. - -- Bug fix (non-breaking change which fixes an issue) -- New feature (non-breaking change which adds functionality) -- Breaking change (fix or feature that would cause existing functionality to not work as expected) -- Translation/Language update -- Docs -- Other - -## Checklist - -Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis. - -- [ ] My code follows the style and contributing guidelines of this project. -- [ ] I ran Alejandra to format my code (`nix fmt`). -- [ ] I have performed a self-review of my own code and tested it. -- [ ] I have commented my code, particularly in hard-to-understand areas. -- [ ] My changes generate no new warnings. -- [ ] This change requires a documentation update. -- [ ] I have updated the documentation accordingly. - -## Screenshots & Logs - -You are kindly requested to attach screenshots of your changes in actions and preferably your build/run logs for all available packages. If you are not sure how to do this, you can refer to the [documentation](https://notashelf.github.io/neovim-flake/). - -**Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.** - -```console -# Paste your logs here -``` diff --git a/.github/README.md b/.github/README.md index 06c9eb7d..531d062b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -33,10 +33,9 @@
- A highly modular, configurable, extensible and easy to use Neovim configuration - framework in Nix. Designed for flexibility and ease of use, this flake - allows you to easily configure your Neovim instance with a few lines of - Nix code. + nvf is a highly modular, configurable, extensible and easy to use Neovim configuration + in Nix. Designed for flexibility and ease of use, nvf allows you to easily configure + your fully featured Neovim instance with a few lines of Nix.
@@ -44,6 +43,7 @@

+[Features]: #features [Get Started]: #get-started [Documentation]: #documentation [Help]: #help @@ -51,119 +51,156 @@ [FAQ]: #faq [Credits]: #credits -**[
 Get Started 
][Get Started]** -**[
 Documentation 
][Documentation]** -**[
 Help 
][Help]** -**[
 Contribute 
][Contribute]** -**[
 FAQ 
][Faq]** -**[
 Credits 
][Credits]** +**[
 Features
][Features]** +**[
 Get Started 
][Get Started]** +**[
 Documentation 
][Documentation]** +**[
 Help 
][Help]** +**[
 Contribute 
][Contribute]** +**[
 FAQ 
][Faq]** **[
 Credits 
][Credits]**

--- +## Features + +- **Reproducible**: Your configuration will behave the same _anywhere_. No + surprises, promise! +- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No + more global binaries! Works on all platforms, without hassle. +- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully + customizable through the Nix module system. +- **Well-documented**: Documentation is priority. You will _never_ face + undocumented, obscure behaviour. +- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and + will, remain maintainable for myself and any contributors. + ## Get Started -### Using `nix` CLI +[nvf manual]: https://notashelf.github.io/nvf/ +[issue tracker]: https://github.com/NotAShelf/nvf/issues -If you would like to try out the configuration before even thinking about -installing it, you can run the following command +If you are not sold on the concepts of **nvf**, and would like to try out the +default configuration before even _thinking about_ installing it, you may run +the following in order to take **nvf** out for a spin. -```console +```bash +# Run the default package nix run github:notashelf/nvf ``` -This will get you a feel for the base configuration and UI design. -The flake exposes `#nix` as the default package, providing minimal -language support and various utilities.You may also use `#nix`, -`#tidal` or `#maximal` to get try out different configurations. +This will get you a feel for the base configuration and UI design. Though, none +of the configuration options are final as **nvf** is designed to be modular and +configurable. -It is as simple as changing the target output to get a different -configuration. For example, to get a configuration with `tidal` support, run: +> [!TIP] +> The flake exposes `#nix` as the default package, providing minimal language +> support and various utilities. You may also use the `#nix` or `#maximal` +> packages provided by the this flake to get try out different configurations. -```console -nix run github:notashelf/nvf#tidal +It is as simple as changing the target output to get a different configuration. +For example, to get a configuration with large language coverage, run: + +```bash +# Run the maximal package +nix run github:notashelf/nvf#maximal ``` Similar instructions will apply for `nix profile install`. However, you are recommended to instead use the module system as described in the manual. -> [!NOTE] -> The `maximal` configuration is _massive_ and will take a while to build. -> To get a feel for the configuration, use the default `nix` or `tidal` -> configurations. Should you choose to try out the `maximal` configuration, -> using the binary cache as described in the manual is _strongly_ recommended. +> [!NOTE] +> The `maximal` configuration is quite large, and might take a while to build. +> To get a feel for the configuration, use the default `nix` configuration. +> Should you choose to try out the `maximal` configuration, using the binary +> cache as described in the manual is _strongly_ recommended. + +If you are convinced, proceed to the next section to view the installation +instructions. ## Documentation -See the [**nvf** Manual](https://notashelf.github.io/nvf/) for -detailed installation guides, configurations, available options, release notes -and more. Tips for installing userspace plugins is also contained in the -documentation. +The _recommended_ way of installing **nvf** is using either the NixOS or the +Home-Manager module, though it is completely possible and no less supported to +install **nvf** as a standalone package, or a flake output. -If you want to dive right into trying **nvf** you can get a fully -featured configuration with `nix` language support by running: +See the rendered [nvf manual] for detailed and up-to-date installation guides, +configurations, available options, release notes and more. Tips for installing +userspace plugins is also contained in the documentation. -```console -nix run github:notashelf/nvf#nix -``` +> [!TIP] +> While using NixOS or Home-Manager modules, +> `programs.nvf.enableManpages = true;` will allow you to view option +> documentation from the comfort of your terminal via `man 5 nvf`. The more you +> know. -[Issues]: https://github.com/NotAShelf/nvf/issues - -Please create an issue on the [issue tracker](issues) if you find -the documentation lacking or confusing. I also appreciate any contributions -to the documentation. +Please create an issue on the [issue tracker] if you find the documentation +lacking or confusing. Any improvements to the documentation through pull +requests are also welcome, and appreciated. ## Help -You can create an issue on the [issue tracker](issues) to ask questions -or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue -tracker for now. +You can create an issue on the [issue tracker] to ask questions or report bugs. +I am not yet on spaces like matrix or IRC, so please use the issue tracker for +now. ## Contributing I am always looking for new ways to help improve this flake. If you would like to contribute, please read the [contributing guide](CONTRIBUTING.md) before -submitting a pull request. You can also create an issue on the -[issue tracker](issues) before submitting a pull request if you would -like to discuss a feature or bug fix. +submitting a pull request. You can also create an issue on the [issue tracker] +before submitting a pull request if you would like to discuss a feature or bug +fix. ## FAQ +[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose +[list of branches]: https://github.com/NotAShelf/nvf/branches +[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls + +**Q**: What platforms are supported? +
**A**: nvf actively supports Linux and Darwin platforms using standalone +Nix, NixOS or Home-Manager. Please take a look at the + **Q**: Can you add _X_? -
-**A**: Maybe! It is not one of our goals to support each and every Neovim -plugin, however, I am always open to new modules and plugin setup additions -to **nvf**. Use the [appropritate issue template](issues/new/choose) and I will -consider a module addition. +
**A**: Maybe! It is not one of our goals to support each and every Neovim +plugin, however, I am always open to new modules and plugin setup additions to +**nvf**. Use the [appropriate issue template] and I will consider a module +addition. As mentioned before, PRs adding new features are also welcome. **Q**: A plugin I need is not available in **nvf**. What to do? -
-**A**: **nvf** exposes several APIs for you to be able to add your own -plugin configurations! Please see the documentation on how you may do -this. +
**A**: **nvf** exposes several APIs for you to be able to add your own +plugin configurations! Please see the documentation on how you may do this. **Q**: Main branch is awfully silent, is the project dead? -
-**A**: No! Sometimes we branch out (e.g. v0.6) to avoid breaking userspace -and work in a separate branch until we make sure the new additions are -implemented in the most comfortable way available to the end user. If you have -not noticed any activity on the main branch, consider taking a look at the [list -of branches](https://github.com/NotAShelf/nvf/branches=) or the [list of open -pull requests](https://github.com/NotAShelf/nvf) +
**A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking +userspace and work in a separate branch until we make sure the new additions are +implemented in the most comfortable way possible for the end user. If you have +not noticed any activity on the main branch, consider taking a look at the +[list of branches] or the [list of open pull requests]. You may also consider +_testing_ those release branches to get access to new features ahead of time and +better prepare to breaking changes. ## Credits ### Contributors -Special thanks to +Special, heart-felt thanks to - [@fufexan](https://github.com/fufexan) - For the transition to flake-parts -- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work -- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible -- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates +- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to + work +- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally + possible +- [@horriblename](https://github.com/horriblename) - For actively implementing + planned features and quality of life updates - [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo -- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not +- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I + could not +- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull + requests and overall assistence +- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and + occasional code improvements and everyone who has submitted issues or pull requests! @@ -172,10 +209,18 @@ and everyone who has submitted issues or pull requests! This configuration borrows from and is based on a few other configurations, including: -- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on. -- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices. -- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas. -- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts. +- [@jordanisaacs's](https://github.com/jordanisaacs) + [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake + is originally based on. +- [@sioodmy's](https://github.com/sioodmy) + [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design + choices. +- [@wiltaylor's](https://github.com/wiltaylor) + [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and + design ideas. +- [@gvolpe's](https://github.com/gvolpe) + [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and + nix concepts. I am grateful for their previous work and inspiration, and I wholeheartedly recommend checking their work out. @@ -183,11 +228,14 @@ recommend checking their work out. ## License -Following the license of the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake), -**nvf** has been made available under the [**MIT License**](LICENSE). However, all assets -and documentation are published under the +Following the license of the +[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf** +has been made available under the [**MIT License**](LICENSE). However, all +assets and documentation are published under the [**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE). +
Yes, this includes the logo work too. Stop taking artwork that is not yours!
+ ---
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..7768d36e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,57 @@ + + +## Sanity Checking + + + +[editorconfig]: https://editorconfig.org +[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes + +- [ ] I have updated the [changelog] as per my changes. +- [ ] I have tested, and self-reviewed my code. +- Style and consistency + - [ ] I ran **Alejandra** to format my code (`nix fmt`). + - [ ] My code conforms to the [editorconfig] configuration of the project. + - [ ] My changes are consistent with the rest of the codebase. +- If new changes are particularly complex: + - [ ] My code includes comments in particularly complex areas + - [ ] I have added a section in the manual. + - [ ] _(For breaking changes)_ I have included a migration guide. +- Package(s) built: + - [ ] `.#nix` (default package) + - [ ] `.#maximal` + - [ ] `.#docs-html` +- Tested on platform(s) + - [ ] `x86_64-linux` + - [ ] `aarch64-linux` + - [ ] `x86_64-darwin` + - [ ] `aarch64-darwin` + + + +--- + +Add a :+1: [reaction] to [pull requests you find important]. + +[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/ +[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 00000000..204dcba7 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,22 @@ +name: Cleanup +on: + workflow_dispatch: + schedule: + - cron: "0 4 1 * *" # 4AM on 1st of every month + - cron: "0 4 15 * *" # 4AM on the 15th of every month +jobs: + branches: + name: Cleanup old branches + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Delete old branches" + uses: beatlabs/delete-old-branches-action@v0.0.10 + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + date: "1 months ago" + dry_run: false + delete_tags: false + exclude_open_pr_branches: true diff --git a/configuration.nix b/configuration.nix index 08b0f9b6..832bf95c 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,6 +19,7 @@ isMaximal: { lspsaga.enable = false; trouble.enable = true; lspSignature.enable = true; + otter-nvim.enable = isMaximal; lsplines.enable = isMaximal; nvim-docs-view.enable = isMaximal; }; @@ -50,9 +51,11 @@ isMaximal: { css.enable = isMaximal; sql.enable = isMaximal; java.enable = isMaximal; + kotlin.enable = isMaximal; ts.enable = isMaximal; svelte.enable = isMaximal; go.enable = isMaximal; + lua.enable = isMaximal; elixir.enable = isMaximal; zig.enable = isMaximal; ocaml.enable = isMaximal; @@ -67,6 +70,7 @@ isMaximal: { lsp.server = "clangd"; }; + scala.enable = isMaximal; rust = { enable = isMaximal; crates.enable = isMaximal; @@ -104,12 +108,10 @@ isMaximal: { transparent = false; }; - autopairs.enable = true; + autopairs.nvim-autopairs.enable = true; - autocomplete = { - enable = true; - type = "nvim-cmp"; - }; + autocomplete.nvim-cmp.enable = true; + snippets.luasnip.enable = true; filetree = { nvimTree = { @@ -155,7 +157,7 @@ isMaximal: { }; utility = { - ccc.enable = isMaximal; + ccc.enable = false; vim-wakatime.enable = false; icon-picker.enable = isMaximal; surround.enable = isMaximal; @@ -172,6 +174,7 @@ isMaximal: { notes = { obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled + neorg.enable = false; orgmode.enable = false; mind-nvim.enable = isMaximal; todo-comments.enable = true; diff --git a/docs/manual/configuring/dag-entries.md b/docs/manual/configuring/dag-entries.md index d5afa9b6..402cde66 100644 --- a/docs/manual/configuring/dag-entries.md +++ b/docs/manual/configuring/dag-entries.md @@ -5,16 +5,19 @@ can add code that relies on other code. However, if you don't know what the entries are called, it's hard to do that, so here is a list of the internal entries in nvf: -`vim.luaConfigRC` (top-level DAG): +## `vim.luaConfigRC` (top-level DAG) {#ch-vim-luaconfigrc} 1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply inserted before the rest of the DAG 2. `globalsScript` - used to set globals defined in `vim.globals` 3. `basic` - used to set basic configuration options -4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins -5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option, - see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own - plugins) DAG, used to set up internal plugins -6. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a +4. `optionsScript` - used to set options defined in `vim.o` +5. `theme` (this is simply placed before `pluginConfigs`, meaning that + surrounding entries don't depend on it) - used to set up the theme, which has + to be done before other plugins +6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option, + see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your + own plugins) DAG, used to set up internal plugins +7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a direct DAG, but is converted to, and resolved as one internally -7. `mappings` - the result of `vim.maps` +8. `mappings` - the result of `vim.maps` diff --git a/docs/manual/hacking/keybinds.md b/docs/manual/hacking/keybinds.md index f4a51499..63a05d64 100644 --- a/docs/manual/hacking/keybinds.md +++ b/docs/manual/hacking/keybinds.md @@ -7,37 +7,26 @@ section contains a general overview to how you may utilize said functions. ## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings} -To set a mapping, you should define it in `vim.maps.<>`. -The available modes are: - -- normal -- insert -- select -- visual -- terminal -- normalVisualOp -- visualOnly -- operator -- insertCommand -- lang -- command +To set a mapping, you should define it in `vim.keymaps`. An example, simple keybinding, can look like this: ```nix { - vim.maps.normal = { - "wq" = { + vim.keymaps = [ + { + key = "wq"; + mode = ["n"]; action = ":wq"; silent = true; desc = "Save file and quit"; - }; - }; + } + ]; } ``` There are many settings available in the options. Please refer to the -[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.maps.command._name_.action) +[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps) to see a list of them. **nvf** provides a list of helper commands, so that you don't have to write the diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 7fd48768..7cbdbaae 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -26,6 +26,32 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and brings unnecessary performance overhead while working with different configuration formats. +### `vim.maps` rewrite {#sec-vim-maps-rewrite} + +Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new +`vim.keymaps` submodule with support for a `mode` option has been introduced. It +can be either a string, or a list of strings, where a string represents the +short-name of the map mode(s), that the mapping should be set for. See +`:help map-modes` for more information. + +For example: + +```nix +vim.maps.normal."m" = { ... }; +``` + +has to be replaced by + +```nix +vim.keymaps = [ + { + key = "m"; + mode = "n"; + } + ... +]; +``` + ### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation} The nvim-code-action-menu plugin has been archived and broken for a long time, @@ -67,6 +93,9 @@ everyone. - Add dap-go for better dap configurations - Make noice.nvim customizable - Standardize border style options and add custom borders +- Remove `vim.disableDefaultRuntimePaths` in wrapper options. + - As nvf uses `$NVIM_APP_NAME` as of recent changes, we can safely assume any + configuration in `$XDG_CONFIG_HOME/nvf` is intentional. [rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim [rustaceanvim]: https://github.com/mrcjkb/rustaceanvim @@ -80,13 +109,17 @@ everyone. [ocaml-lsp]: https://github.com/ocaml/ocaml-lsp [new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim +[neo-tree.nvim]: https://github.com/nvim-neo-tree/neo-tree.nvim - Add [ocaml-lsp] support - Fix "Emac" typo - Add [new-file-template.nvim] to automatically fill new file contents using - templates. + templates + +- Make [neo-tree.nvim] display file icons properly by enabling + `visuals.nvimWebDevicons` [diniamo](https://github.com/diniamo): @@ -120,10 +153,29 @@ everyone. - Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the breaking changes section above for more details +- Add a `setupOpts` option to nvim-surround, which allows modifying options that + aren't defined in nvf. Move the alternate nvim-surround keybinds to use + `setupOpts`. + +- Remove `autopairs.type`, and rename `autopairs.enable` to + `autopairs.nvim-autopairs.enable`. The new + [](#opt-vim.autopairs.nvim-autopairs.enable) supports `setupOpts` format by + default. + +- Refactor of `nvim-cmp` and completion related modules + - Remove `autocomplete.type` in favor of per-plugin enable options such as + [](#opt-vim.autocomplete.nvim-cmp.enable). + - Deprecate legacy Vimsnip in favor of Luasnip, and integrate + friendly-snippets for bundled snippets. [](#opt-vim.snippets.luasnip.enable) + can be used to toggle Luasnip. + - Add sorting function options for completion sources under + [](#opt-vim.autocomplete.nvim-cmp.setupOpts.sorting.comparators) + [Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd() - Make Neovim's configuration file entirely Lua based. This comes with a few breaking changes: + - `vim.configRC` has been removed. You will need to migrate your entries to Neovim-compliant Lua code, and add them to `vim.luaConfigRC` instead. Existing vimscript configurations may be preserved in `vim.cmd` functions. @@ -132,6 +184,8 @@ everyone. has been introduced for setting up internal plugins. See the "DAG entries in nvf" manual page for more information. +- Rewrite `vim.maps`, see the breaking changes section above. + [NotAShelf](https://github.com/notashelf): [ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim @@ -187,12 +241,40 @@ everyone. - Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an additional Python LSP server. +- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration + without using additional Lua. See option documentation for more details. + +- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user + configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim) + +- Update `lualine.nvim` input and add missing themes: + - Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`, + `powerline_dark` and `solarized_light` themes. + [ppenguin](https://github.com/ppenguin): - Telescope: - Fixed `project-nvim` command and keybinding - Added default ikeybind/command for `Telescope resume` (`fr`) -[Soliprem](https://github.com/Soliprem) +[Soliprem](https://github.com/Soliprem): - Add LSP and Treesitter support for R under `vim.languages.R`. +- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with + ccc +- Add Neorg support under `vim.notes.neorg` +- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under + `vim.languages.kotlin` +- changed default keybinds for leap.nvim to avoid altering expected behavior + +[Bloxx12](https://github.com/Bloxx12) + +- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under + `vim.theme` +- Fix internal breakage in `elixir-tools` setup. + +[ksonj](https://github.com/ksonj): + +- Add LSP support for Scala via + [nvim-metals](https://github.com/scalameta/nvim-metals) + diff --git a/flake.lock b/flake.lock index a67a79af..c07fadc9 100644 --- a/flake.lock +++ b/flake.lock @@ -172,6 +172,22 @@ "type": "github" } }, + "plugin-base16": { + "flake": false, + "locked": { + "lastModified": 1716483968, + "narHash": "sha256-GRF/6AobXHamw8TZ3FjL7SI6ulcpwpcohsIuZeCSh2A=", + "owner": "rrethy", + "repo": "base16-nvim", + "rev": "6ac181b5733518040a33017dde654059cd771b7c", + "type": "github" + }, + "original": { + "owner": "rrethy", + "repo": "base16-nvim", + "type": "github" + } + }, "plugin-bufdelete-nvim": { "flake": false, "locked": { @@ -191,11 +207,11 @@ "plugin-catppuccin": { "flake": false, "locked": { - "lastModified": 1716704960, - "narHash": "sha256-UDPS+1o8FQGkfqiG4GX4DNUI2pU5hIvagmfnWTKDb44=", + "lastModified": 1728131011, + "narHash": "sha256-j6F078taxuGzr3jngrc+Pc5I1kDdxTLMETgq6Xn4w/4=", "owner": "catppuccin", "repo": "nvim", - "rev": "5215ea59df6d0a7e27da9a5cd1165e06d1b04cbe", + "rev": "7be452ee067978cdc8b2c5f3411f0c71ffa612b9", "type": "github" }, "original": { @@ -300,6 +316,22 @@ "type": "github" } }, + "plugin-cmp-luasnip": { + "flake": false, + "locked": { + "lastModified": 1696878902, + "narHash": "sha256-nUJJl2zyK/oSwz5RzI9j3gf9zpDfCImCYbPbVsyXgz8=", + "owner": "saadparwaiz1", + "repo": "cmp_luasnip", + "rev": "05a9ab28b53f71d1aece421ef32fee2cb857a843", + "type": "github" + }, + "original": { + "owner": "saadparwaiz1", + "repo": "cmp_luasnip", + "type": "github" + } + }, "plugin-cmp-nvim-lsp": { "flake": false, "locked": { @@ -348,22 +380,6 @@ "type": "github" } }, - "plugin-cmp-vsnip": { - "flake": false, - "locked": { - "lastModified": 1669100283, - "narHash": "sha256-2mkN03noOr5vBvRbSb35xZKorSH+8savQNZtgM9+QcM=", - "owner": "hrsh7th", - "repo": "cmp-vsnip", - "rev": "989a8a73c44e926199bfd05fa7a516d51f2d2752", - "type": "github" - }, - "original": { - "owner": "hrsh7th", - "repo": "cmp-vsnip", - "type": "github" - } - }, "plugin-codewindow-nvim": { "flake": false, "locked": { @@ -588,6 +604,22 @@ "type": "github" } }, + "plugin-friendly-snippets": { + "flake": false, + "locked": { + "lastModified": 1727061933, + "narHash": "sha256-yTsuV5unoujY0mhLINssYYBWCeefe+nJaxQHJKm7hlk=", + "owner": "rafamadriz", + "repo": "friendly-snippets", + "rev": "00ba9dd3df89509f95437b8d595553707c46d5ea", + "type": "github" + }, + "original": { + "owner": "rafamadriz", + "repo": "friendly-snippets", + "type": "github" + } + }, "plugin-gesture-nvim": { "flake": false, "locked": { @@ -812,14 +844,30 @@ "type": "github" } }, + "plugin-lua-utils-nvim": { + "flake": false, + "locked": { + "lastModified": 1708177208, + "narHash": "sha256-9ildzQEMkXKZ3LHq+khGFgRQFxlIXQclQ7QU3fcU1C4=", + "owner": "nvim-neorg", + "repo": "lua-utils.nvim", + "rev": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "lua-utils.nvim", + "type": "github" + } + }, "plugin-lualine": { "flake": false, "locked": { - "lastModified": 1712310396, - "narHash": "sha256-WcH2dWdRDgMkwBQhcgT+Z/ArMdm+VbRhmQftx4t2kNI=", + "lastModified": 1723473562, + "narHash": "sha256-gCm7m96PkZyrgjmt7Efc+NMZKStAq1zr7JRCYOgGDuE=", "owner": "hoob3rt", "repo": "lualine.nvim", - "rev": "0a5a66803c7407767b799067986b4dc3036e1983", + "rev": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056", "type": "github" }, "original": { @@ -828,6 +876,22 @@ "type": "github" } }, + "plugin-luasnip": { + "flake": false, + "locked": { + "lastModified": 1726165831, + "narHash": "sha256-nkaa1NGOI28Et2QitQB+Spv+J42QVdHE1oywteLcJJw=", + "owner": "L3MON4D3", + "repo": "LuaSnip", + "rev": "e808bee352d1a6fcf902ca1a71cee76e60e24071", + "type": "github" + }, + "original": { + "owner": "L3MON4D3", + "repo": "LuaSnip", + "type": "github" + } + }, "plugin-mind-nvim": { "flake": false, "locked": { @@ -924,6 +988,38 @@ "type": "github" } }, + "plugin-neorg": { + "flake": false, + "locked": { + "lastModified": 1727821831, + "narHash": "sha256-yfWQ6yKytu1jkWUtRZTVICslUWej6jVYv7frmSB7/6Q=", + "owner": "nvim-neorg", + "repo": "neorg", + "rev": "afc9a37bf021acb0853e95714c4c6436e1588286", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "neorg", + "type": "github" + } + }, + "plugin-neorg-telescope": { + "flake": false, + "locked": { + "lastModified": 1722358034, + "narHash": "sha256-ei4uUqpIQjGKzu5ryu0Hlmis9TS9FJsYnjt4J4QdWlw=", + "owner": "nvim-neorg", + "repo": "neorg-telescope", + "rev": "ddb2556644cae922699a239bbb0fe16e25b084b7", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "neorg-telescope", + "type": "github" + } + }, "plugin-new-file-template-nvim": { "flake": false, "locked": { @@ -1181,6 +1277,22 @@ "type": "github" } }, + "plugin-nvim-metals": { + "flake": false, + "locked": { + "lastModified": 1728295172, + "narHash": "sha256-ja/+MNxZ3H9io9jDwm5rhE6iKNi86a22eCOY75g19O8=", + "owner": "scalameta", + "repo": "nvim-metals", + "rev": "f861db9fda55939797ac1b05238c49b0dcdc3bdb", + "type": "github" + }, + "original": { + "owner": "scalameta", + "repo": "nvim-metals", + "type": "github" + } + }, "plugin-nvim-navbuddy": { "flake": false, "locked": { @@ -1405,6 +1517,22 @@ "type": "github" } }, + "plugin-otter-nvim": { + "flake": false, + "locked": { + "lastModified": 1724585935, + "narHash": "sha256-euHwoK2WHLF/hrjLY2P4yGrIbYyBN38FL3q4CKNZmLY=", + "owner": "jmbuhr", + "repo": "otter.nvim", + "rev": "ca9ce67d0399380b659923381b58d174344c9ee7", + "type": "github" + }, + "original": { + "owner": "jmbuhr", + "repo": "otter.nvim", + "type": "github" + } + }, "plugin-oxocarbon": { "flake": false, "locked": { @@ -1421,6 +1549,22 @@ "type": "github" } }, + "plugin-pathlib-nvim": { + "flake": false, + "locked": { + "lastModified": 1724943804, + "narHash": "sha256-YhCJeNKlcjgg3q51UWFhuIEPzNueC8YTpeuPPJDndvw=", + "owner": "pysan3", + "repo": "pathlib.nvim", + "rev": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1", + "type": "github" + }, + "original": { + "owner": "pysan3", + "repo": "pathlib.nvim", + "type": "github" + } + }, "plugin-plenary-nvim": { "flake": false, "locked": { @@ -1757,22 +1901,6 @@ "type": "github" } }, - "plugin-vim-vsnip": { - "flake": false, - "locked": { - "lastModified": 1704937299, - "narHash": "sha256-gvm6z4pgSULBVPukewRyjwxZ0vZgreQWbG/0kOB1QBo=", - "owner": "hrsh7th", - "repo": "vim-vsnip", - "rev": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9", - "type": "github" - }, - "original": { - "owner": "hrsh7th", - "repo": "vim-vsnip", - "type": "github" - } - }, "plugin-which-key": { "flake": false, "locked": { @@ -1818,6 +1946,7 @@ "nixpkgs": "nixpkgs", "nmd": "nmd", "plugin-alpha-nvim": "plugin-alpha-nvim", + "plugin-base16": "plugin-base16", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim", "plugin-catppuccin": "plugin-catppuccin", "plugin-ccc": "plugin-ccc", @@ -1826,10 +1955,10 @@ "plugin-cheatsheet-nvim": "plugin-cheatsheet-nvim", "plugin-cinnamon-nvim": "plugin-cinnamon-nvim", "plugin-cmp-buffer": "plugin-cmp-buffer", + "plugin-cmp-luasnip": "plugin-cmp-luasnip", "plugin-cmp-nvim-lsp": "plugin-cmp-nvim-lsp", "plugin-cmp-path": "plugin-cmp-path", "plugin-cmp-treesitter": "plugin-cmp-treesitter", - "plugin-cmp-vsnip": "plugin-cmp-vsnip", "plugin-codewindow-nvim": "plugin-codewindow-nvim", "plugin-comment-nvim": "plugin-comment-nvim", "plugin-conform-nvim": "plugin-conform-nvim", @@ -1844,6 +1973,7 @@ "plugin-fastaction-nvim": "plugin-fastaction-nvim", "plugin-fidget-nvim": "plugin-fidget-nvim", "plugin-flutter-tools": "plugin-flutter-tools", + "plugin-friendly-snippets": "plugin-friendly-snippets", "plugin-gesture-nvim": "plugin-gesture-nvim", "plugin-gitsigns-nvim": "plugin-gitsigns-nvim", "plugin-glow-nvim": "plugin-glow-nvim", @@ -1858,13 +1988,17 @@ "plugin-lsp-signature": "plugin-lsp-signature", "plugin-lspkind": "plugin-lspkind", "plugin-lspsaga": "plugin-lspsaga", + "plugin-lua-utils-nvim": "plugin-lua-utils-nvim", "plugin-lualine": "plugin-lualine", + "plugin-luasnip": "plugin-luasnip", "plugin-mind-nvim": "plugin-mind-nvim", "plugin-minimap-vim": "plugin-minimap-vim", "plugin-modes-nvim": "plugin-modes-nvim", "plugin-neo-tree-nvim": "plugin-neo-tree-nvim", "plugin-neocord": "plugin-neocord", "plugin-neodev-nvim": "plugin-neodev-nvim", + "plugin-neorg": "plugin-neorg", + "plugin-neorg-telescope": "plugin-neorg-telescope", "plugin-new-file-template-nvim": "plugin-new-file-template-nvim", "plugin-noice-nvim": "plugin-noice-nvim", "plugin-none-ls": "plugin-none-ls", @@ -1881,6 +2015,7 @@ "plugin-nvim-lightbulb": "plugin-nvim-lightbulb", "plugin-nvim-lint": "plugin-nvim-lint", "plugin-nvim-lspconfig": "plugin-nvim-lspconfig", + "plugin-nvim-metals": "plugin-nvim-metals", "plugin-nvim-navbuddy": "plugin-nvim-navbuddy", "plugin-nvim-navic": "plugin-nvim-navic", "plugin-nvim-neoclip": "plugin-nvim-neoclip", @@ -1895,7 +2030,9 @@ "plugin-obsidian-nvim": "plugin-obsidian-nvim", "plugin-onedark": "plugin-onedark", "plugin-orgmode-nvim": "plugin-orgmode-nvim", + "plugin-otter-nvim": "plugin-otter-nvim", "plugin-oxocarbon": "plugin-oxocarbon", + "plugin-pathlib-nvim": "plugin-pathlib-nvim", "plugin-plenary-nvim": "plugin-plenary-nvim", "plugin-project-nvim": "plugin-project-nvim", "plugin-registers": "plugin-registers", @@ -1917,7 +2054,6 @@ "plugin-vim-markdown": "plugin-vim-markdown", "plugin-vim-repeat": "plugin-vim-repeat", "plugin-vim-startify": "plugin-vim-startify", - "plugin-vim-vsnip": "plugin-vim-vsnip", "plugin-which-key": "plugin-which-key", "rnix-lsp": "rnix-lsp", "systems": "systems_2" diff --git a/flake.nix b/flake.nix index a506cec8..172ea94e 100644 --- a/flake.nix +++ b/flake.nix @@ -13,8 +13,8 @@ inherit inputs; specialArgs = {inherit lib;}; } { - # provide overridable systems - # https://github.com/nix-systems/nix-systems + # Allow users to bring their own systems. + # «https://github.com/nix-systems/nix-systems» systems = import inputs.systems; imports = [ ./flake/apps.nix @@ -62,7 +62,6 @@ pkgs, ... }: { - formatter = pkgs.alejandra; devShells = { default = self'.devShells.lsp; nvim-nix = pkgs.mkShell {packages = [config.packages.nix];}; @@ -70,6 +69,21 @@ packages = with pkgs; [nil statix deadnix alejandra]; }; }; + + # Provide the default formatter. `nix fmt` in project root + # will format available files with the correct formatter. + # P.S: Please do not format with nixfmt! It messes with many + # syntax elements and results in unreadable code. + formatter = pkgs.alejandra; + + # Check if codebase is properly formatted. + # This can be initiated with `nix build .#checks..nix-fmt` + # or with `nix flake check` + checks = { + nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} '' + alejandra --check ${self} < /dev/null | tee $out + ''; + }; }; }; @@ -156,6 +170,11 @@ flake = false; }; + plugin-otter-nvim = { + url = "github:jmbuhr/otter.nvim"; + flake = false; + }; + # Language support plugin-sqls-nvim = { url = "github:nanotee/sqls.nvim"; @@ -187,6 +206,11 @@ flake = false; }; + plugin-nvim-metals = { + url = "github:scalameta/nvim-metals"; + flake = false; + }; + # Formatters plugin-conform-nvim = { url = "github:stevearc/conform.nvim"; @@ -270,11 +294,6 @@ flake = false; }; - plugin-cmp-vsnip = { - url = "github:hrsh7th/cmp-vsnip"; - flake = false; - }; - plugin-cmp-path = { url = "github:hrsh7th/cmp-path"; flake = false; @@ -285,9 +304,19 @@ flake = false; }; + plugin-cmp-luasnip = { + url = "github:saadparwaiz1/cmp_luasnip"; + flake = false; + }; + # snippets - plugin-vim-vsnip = { - url = "github:hrsh7th/vim-vsnip"; + plugin-luasnip = { + url = "github:L3MON4D3/LuaSnip"; + flake = false; + }; + + plugin-friendly-snippets = { + url = "github:rafamadriz/friendly-snippets"; flake = false; }; @@ -342,6 +371,11 @@ }; # Themes + plugin-base16 = { + url = "github:rrethy/base16-nvim"; + flake = false; + }; + plugin-tokyonight = { url = "github:folke/tokyonight.nvim"; flake = false; @@ -624,6 +658,26 @@ flake = false; }; + plugin-lua-utils-nvim = { + url = "github:nvim-neorg/lua-utils.nvim"; + flake = false; + }; + + plugin-pathlib-nvim = { + url = "github:pysan3/pathlib.nvim"; + flake = false; + }; + + plugin-neorg = { + url = "github:nvim-neorg/neorg"; + flake = false; + }; + + plugin-neorg-telescope = { + url = "github:nvim-neorg/neorg-telescope"; + flake = false; + }; + plugin-nui-nvim = { # (required by noice.nvim) url = "github:MunifTanjim/nui.nvim"; diff --git a/lib/attrsets.nix b/lib/attrsets.nix new file mode 100644 index 00000000..59275af9 --- /dev/null +++ b/lib/attrsets.nix @@ -0,0 +1,5 @@ +{lib}: let + inherit (builtins) listToAttrs; +in { + mapListToAttrs = f: list: listToAttrs (map f list); +} diff --git a/lib/default.nix b/lib/default.nix index a418cff8..e6ccd2a7 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -10,6 +10,7 @@ dag = import ./dag.nix {inherit lib;}; languages = import ./languages.nix {inherit lib;}; lists = import ./lists.nix {inherit lib;}; + attrsets = import ./attrsets.nix {inherit lib;}; lua = import ./lua.nix {inherit lib;}; neovimConfiguration = import ../modules {inherit inputs lib;}; } diff --git a/lib/languages.nix b/lib/languages.nix index 9b72d4d4..bf9bb88b 100644 --- a/lib/languages.nix +++ b/lib/languages.nix @@ -2,8 +2,8 @@ {lib}: let inherit (builtins) isString getAttr; inherit (lib.options) mkOption; - inherit (lib.attrsets) listToAttrs; inherit (lib.types) bool; + inherit (lib.nvim.attrsets) mapListToAttrs; in { # A wrapper around `mkOption` to create a boolean option that is # used for Language Server modules. @@ -21,19 +21,19 @@ in { config, diagnosticsProviders, }: - listToAttrs - (map (v: let - type = - if isString v - then v - else getAttr v.type; - package = - if isString v - then diagnosticsProviders.${type}.package - else v.package; - in { - name = "${lang}-diagnostics-${type}"; - value = diagnosticsProviders.${type}.nullConfig package; - }) - config); + mapListToAttrs + (v: let + type = + if isString v + then v + else getAttr v.type; + package = + if isString v + then diagnosticsProviders.${type}.package + else v.package; + in { + name = "${lang}-diagnostics-${type}"; + value = diagnosticsProviders.${type}.nullConfig package; + }) + config; } diff --git a/lib/types/custom.nix b/lib/types/custom.nix index a94735c5..3d4a2bcb 100644 --- a/lib/types/custom.nix +++ b/lib/types/custom.nix @@ -1,8 +1,9 @@ {lib}: let - inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType; - inherit (lib.types) anything attrsOf; + inherit (lib.options) showOption showFiles getFiles mergeOneOption mergeEqualOption; + inherit (lib.strings) isString isStringLike; + inherit (lib.types) anything attrsOf listOf mkOptionType; inherit (lib.nvim.types) anythingConcatLists; - inherit (builtins) typeOf isAttrs any head concatLists stringLength; + inherit (builtins) typeOf isAttrs any head concatLists stringLength match; in { # HACK: Does this break anything in our case? # A modified version of the nixpkgs anything type that concatenates lists @@ -51,6 +52,16 @@ in { (mergeFunctions.${commonType} or mergeEqualOption) loc defs; }; + mergelessListOf = elemType: let + super = listOf elemType; + in + super + // { + name = "mergelessListOf"; + description = "mergeless ${super.description}"; + merge = mergeEqualOption; + }; + char = mkOptionType { name = "char"; description = "character"; @@ -58,4 +69,11 @@ in { check = value: stringLength value < 2; merge = mergeEqualOption; }; + + hexColor = mkOptionType { + name = "hex-color"; + descriptionClass = "noun"; + description = "RGB color in hex format"; + check = v: isString v && (match "#?[0-9a-fA-F]{6}" v) != null; + }; } diff --git a/lib/types/default.nix b/lib/types/default.nix index 6751229c..73b35956 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -6,10 +6,10 @@ typesDag = import ./dag.nix {inherit lib;}; typesPlugin = import ./plugins.nix {inherit inputs lib;}; typesLanguage = import ./languages.nix {inherit lib;}; - typesCustom = import ./custom.nix {inherit lib;}; + customTypes = import ./custom.nix {inherit lib;}; in { inherit (typesDag) dagOf; inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType; inherit (typesLanguage) diagnostics mkGrammarOption; - inherit (typesCustom) anythingConcatLists char; + inherit (customTypes) anythingConcatLists char hexColor mergelessListOf; } diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 7d24163e..656b7ab8 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -97,7 +97,7 @@ in { default = {}; type = submodule { - freeformType = attrsOf anything; + freeformType = anything; options = opts; }; }; diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix index 388913a7..779a7527 100644 --- a/modules/extra/deprecations.nix +++ b/modules/extra/deprecations.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib.modules) mkRemovedOptionModule; + inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule; in { imports = [ # 2024-06-06 @@ -14,5 +14,40 @@ in { available under `vim.ui.fastaction` as a replacement. Simply remove everything under `vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`. '') + + (mkRemovedOptionModule ["vim" "autopairs" "enable"] '' + vim.autopairs.enable has been removed in favor of per-plugin modules. + You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead. + '') + (mkRemovedOptionModule ["vim" "autopairs" "type"] '' + vim.autopairs.type has been removed in favor of per-plugin modules. + You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead. + '') + (mkRemovedOptionModule ["vim" "autocomplete" "enable"] '' + vim.autocomplete.enable has been removed in favor of per-plugin modules. + You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead. + '') + (mkRemovedOptionModule ["vim" "autocomplete" "type"] '' + vim.autocomplete.type has been removed in favor of per-plugin modules. + You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead. + '') + (mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] '' + vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip. + '') + (mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"]) + + # 2024-10-14 + (mkRemovedOptionModule ["vim" "configRC"] '' + Please migrate your configRC sections to Neovim's Lua format, and + add them to `vim.luaConfigRC`. + + See the v0.7 release notes for more information on why and how to + migrate your existing configurations to the new format. + '') + + (mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] '' + Nvf now uses $NVIM_APP_NAME so there is no longer the problem of + (accidental) leaking of user configuration. + '') ]; } diff --git a/modules/neovim/mappings/config.nix b/modules/neovim/mappings/config.nix index 28ebf081..4d7f2417 100644 --- a/modules/neovim/mappings/config.nix +++ b/modules/neovim/mappings/config.nix @@ -3,51 +3,75 @@ lib, ... }: let - inherit (lib.modules) mkIf; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.trivial) pipe; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.lists) flatten; + + legacyMapModes = { + normal = ["n"]; + insert = ["i"]; + select = ["s"]; + visual = ["v"]; + terminal = ["t"]; + normalVisualOp = ["n" "v" "o"]; + visualOnly = ["n" "x"]; + operator = ["o"]; + insertCommand = ["i" "c"]; + lang = ["l"]; + command = ["c"]; + }; cfg = config.vim; in { config = { - vim.maps = { - normal = mkIf cfg.disableArrows { - "" = { - action = ""; - - noremap = false; - }; - "" = { - action = ""; - - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - }; - - insert = mkIf cfg.disableArrows { - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - }; - }; + vim.keymaps = mkMerge [ + ( + mkIf cfg.disableArrows [ + { + key = ""; + mode = ["n" "i"]; + action = ""; + noremap = false; + } + { + key = ""; + mode = ["n" "i"]; + action = ""; + noremap = false; + } + { + key = ""; + mode = ["n" "i"]; + action = ""; + noremap = false; + } + { + key = ""; + mode = ["n" "i"]; + action = ""; + noremap = false; + } + ] + ) + ( + pipe cfg.maps + [ + (mapAttrsToList ( + oldMode: keybinds: + mapAttrsToList ( + key: bind: + bind + // { + inherit key; + mode = legacyMapModes.${oldMode}; + } + ) + keybinds + )) + flatten + ] + ) + ]; }; } diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix index 3b1f2634..8f0e8ebf 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -1,101 +1,97 @@ {lib, ...}: let - inherit (lib.options) mkOption; - inherit (lib.types) bool str attrsOf nullOr submodule; + inherit (lib.options) mkOption literalMD; + inherit (lib.types) either str listOf attrsOf nullOr submodule; inherit (lib.nvim.config) mkBool; - # Most of the keybindings code is highly inspired by pta2002/nixvim. - # Thank you! + mapConfigOptions = { - silent = - mkBool false - "Whether this mapping should be silent. Equivalent to adding to a map."; - - nowait = - mkBool false - "Whether to wait for extra input on ambiguous mappings. Equivalent to adding to a map."; - - script = - mkBool false - "Equivalent to adding