mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-14 04:55:57 +01:00
Compare commits
42 commits
f9cec7b4cc
...
56012ea8f9
Author | SHA1 | Date | |
---|---|---|---|
56012ea8f9 | |||
|
140ed6daa8 | ||
50609c731e | |||
72a5e6c684 | |||
ef46635c85 | |||
56d9c0aa1f | |||
2f4dcafaa3 | |||
fecf9f48be | |||
be0fd17510 | |||
eb8d75a4ae | |||
7647353c40 | |||
d9a984bf6f | |||
ff999f3803 | |||
a8d7f98dc4 | |||
d2b8e27b16 | |||
25dc887a8e | |||
8ca0760b01 | |||
e982955540 | |||
0388898648 | |||
f17cf118a6 | |||
6d681c2c08 | |||
4d8dcc7e49 | |||
5c7fd22c1d | |||
738f6709ff | |||
43263040a4 | |||
6eea801cd6 | |||
4997865547 | |||
4c5b33b827 | |||
27eedd0db6 | |||
f3817fb4b2 | |||
82499551f3 | |||
|
433525525d | ||
|
4ff3919f76 | ||
|
f5270d30a9 | ||
|
b682148337 | ||
|
b38886d25d | ||
|
79e1691120 | ||
|
3766db3503 | ||
|
685176e94a | ||
|
21aa2096e6 | ||
|
e710afd1ac | ||
|
bea3b43733 |
49 changed files with 1208 additions and 577 deletions
|
@ -7,9 +7,11 @@ inputs: let
|
||||||
lib ? pkgs.lib,
|
lib ? pkgs.lib,
|
||||||
check ? true,
|
check ? true,
|
||||||
extraSpecialArgs ? {},
|
extraSpecialArgs ? {},
|
||||||
|
extraModules ? [],
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
modulesWithInputs {
|
modulesWithInputs {
|
||||||
inherit pkgs lib check extraSpecialArgs;
|
inherit pkgs lib check extraSpecialArgs extraModules;
|
||||||
configuration.imports = modules;
|
configuration.imports = modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,11 +25,14 @@ inputs: let
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
debugMode = {
|
debugMode = {
|
||||||
enable = false;
|
enable = false;
|
||||||
level = 20;
|
level = 16;
|
||||||
logFile = "/tmp/nvim.log";
|
logFile = "/tmp/nvim.log";
|
||||||
};
|
};
|
||||||
|
|
||||||
spellcheck.vim-dirtytalk.enable = true;
|
spellcheck = {
|
||||||
|
enable = isMaximal;
|
||||||
|
programmingWordlist.enable = isMaximal;
|
||||||
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
formatOnSave = true;
|
formatOnSave = true;
|
||||||
|
@ -222,6 +227,7 @@ inputs: let
|
||||||
};
|
};
|
||||||
|
|
||||||
assistant = {
|
assistant = {
|
||||||
|
chatgpt.enable = isMaximal;
|
||||||
copilot = {
|
copilot = {
|
||||||
enable = isMaximal;
|
enable = isMaximal;
|
||||||
cmp.enable = isMaximal;
|
cmp.enable = isMaximal;
|
||||||
|
|
|
@ -127,10 +127,12 @@
|
||||||
|
|
||||||
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
||||||
--revision ${revision} \
|
--revision ${revision} \
|
||||||
|
--header ${./man/header.5} \
|
||||||
|
--footer ${./man/footer.5} \
|
||||||
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
|
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
|
||||||
$out/share/man/man5/neovim-flake.5
|
$out/share/man/man5/neovim-flake.5
|
||||||
|
|
||||||
cp ${./neovim-flake.1} $out/share/man/man1/neovim-flake.1
|
cp ${./man/neovim-flake.1} $out/share/man/man1/neovim-flake.1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Generate the HTML manual pages
|
# Generate the HTML manual pages
|
||||||
|
|
|
@ -9,6 +9,5 @@
|
||||||
neovim-flake configuration specification
|
neovim-flake configuration specification
|
||||||
.SH "OPTIONS"
|
.SH "OPTIONS"
|
||||||
.PP
|
.PP
|
||||||
You can use the following options in
|
You can use the following options to configure neovim-flake:
|
||||||
home\-configuration\&.nix:
|
|
||||||
.PP
|
.PP
|
|
@ -9,13 +9,17 @@
|
||||||
.cflags 4 /
|
.cflags 4 /
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm neovim-flake
|
.Nm neovim-flake
|
||||||
.Nd a extensible and distro-agonistic Neovim configuration wrapper in Nix
|
.Nd A highly modular, extensible and distro-agnostic Neovim distribution for Nix/NixOS.
|
||||||
.
|
.
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
.Pp
|
.Pp
|
||||||
Please report any bugs on the
|
Please report any bugs that you might encounter on the
|
||||||
\m[blue]\fBproject issue tracker\fR\m[]\&.
|
\m[blue]\fBproject issue tracker\fR\m[]\&.
|
||||||
|
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Pp
|
||||||
|
\fBneovim-flake\fR(5)
|
||||||
|
|
||||||
.Sh AUTHOR
|
.Sh AUTHOR
|
||||||
.Pp
|
.Pp
|
||||||
\fBneovim-flake contributors\fR
|
\fBneovim-flake contributors\fR
|
||||||
|
@ -25,5 +29,5 @@ Author.
|
||||||
|
|
||||||
.Sh COPYRIGHT
|
.Sh COPYRIGHT
|
||||||
.br
|
.br
|
||||||
Copyright \(co 2017\(en2022 neovim-flake contributors
|
Copyright \(co 2023\(en2024 neovim-flake contributors
|
||||||
.br
|
.br
|
|
@ -2,37 +2,79 @@
|
||||||
|
|
||||||
Release notes for release 0.6
|
Release notes for release 0.6
|
||||||
|
|
||||||
|
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide}
|
||||||
|
|
||||||
|
In v0.6 we are introducing `setupOpts`: many plugin related options are moved into their respective `setupOpts`
|
||||||
|
submodule, e.g. `nvimTree.disableNetrw` is renamed to `nvimTree.setupOpts.disable_netrw`.
|
||||||
|
|
||||||
|
_Why?_ in short, you can now pass in anything to setupOpts and it will be passed to your `require'plugin'.setup{...}`.
|
||||||
|
No need to wait for us to support every single plugin option.
|
||||||
|
|
||||||
|
The warnings when you rebuild your config should be enough to guide you through what you need to do, if there's an
|
||||||
|
option that was renamed but wasn't listed in the warning, please file a bug report!
|
||||||
|
|
||||||
|
To make your migration process less annoying, here's a keybind that will help you with renaming stuff from camelCase to
|
||||||
|
snake_case (you'll be doing that a lot):
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- paste this in a temp.lua file and load it in vim with :source /path/to/temp.lua
|
||||||
|
function camelToSnake()
|
||||||
|
-- Get the current word under the cursor
|
||||||
|
local word = vim.fn.expand("<cword>")
|
||||||
|
-- Replace each capital letter with an underscore followed by its lowercase equivalent
|
||||||
|
local snakeCase = string.gsub(word, "%u", function(match)
|
||||||
|
return "_" .. string.lower(match)
|
||||||
|
end)
|
||||||
|
-- Remove the leading underscore if present
|
||||||
|
if string.sub(snakeCase, 1, 1) == "_" then
|
||||||
|
snakeCase = string.sub(snakeCase, 2)
|
||||||
|
end
|
||||||
|
vim.fn.setreg(vim.v.register, snakeCase)
|
||||||
|
-- Select the word under the cursor and paste
|
||||||
|
vim.cmd("normal! viwP")
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap = true, silent = true })
|
||||||
|
```
|
||||||
|
|
||||||
## Changelog {#sec-release-0.6-changelog}
|
## Changelog {#sec-release-0.6-changelog}
|
||||||
|
|
||||||
[ksonj](https://github.com/ksonj):
|
[ksonj](https://github.com/ksonj):
|
||||||
|
|
||||||
- Add Terraform language support
|
- Added Terraform language support.
|
||||||
|
|
||||||
|
- Added `ChatGPT.nvim`, which can be enabled with [`vim.assistant.chatgpt`](vim.assistant.chatgpt). Do
|
||||||
|
keep in mind that this option requires `OPENAI_API_KEY` environment variable to be set.
|
||||||
|
|
||||||
[donnerinoern](https://github.com/donnerinoern):
|
[donnerinoern](https://github.com/donnerinoern):
|
||||||
|
|
||||||
- Added Gruvbox theme
|
- Added Gruvbox theme.
|
||||||
|
|
||||||
- Added marksman LSP for Markdown
|
- Added marksman LSP for Markdown.
|
||||||
|
|
||||||
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind
|
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind.
|
||||||
|
|
||||||
- colorizer.nvim: switched to a maintained fork
|
- colorizer.nvim: switched to a maintained fork.
|
||||||
|
|
||||||
- Added `markdown-preview.nvim`, moved `glow.nvim` to a brand new `vim.utility.preview` category.
|
- Added `markdown-preview.nvim`, moved `glow.nvim` to a brand new `vim.utility.preview` category.
|
||||||
|
|
||||||
[elijahimmer](https://github.com/elijahimmer)
|
[elijahimmer](https://github.com/elijahimmer)
|
||||||
|
|
||||||
- Added rose-pine theme
|
- Added rose-pine theme.
|
||||||
|
|
||||||
|
[jacekpoz](https://github.com/jacekpoz):
|
||||||
|
|
||||||
|
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.
|
||||||
|
|
||||||
[horriblename](https://github.com/horriblename):
|
[horriblename](https://github.com/horriblename):
|
||||||
|
|
||||||
- Fixed empty winbar when breadcrumbs are disabled
|
- Fixed empty winbar when breadcrumbs are disabled.
|
||||||
|
|
||||||
- Added custom `setupOpts` for various plugins
|
- Added custom `setupOpts` for various plugins.
|
||||||
|
|
||||||
- Removed support for deprecated plugin "nvim-compe"
|
- Removed support for deprecated plugin "nvim-compe".
|
||||||
|
|
||||||
- Moved most plugins to `setupOpts` method
|
- Moved most plugins to `setupOpts` method.
|
||||||
|
|
||||||
[frothymarrow](https://github.com/frothymarrow):
|
[frothymarrow](https://github.com/frothymarrow):
|
||||||
|
|
||||||
|
@ -42,35 +84,36 @@ Release notes for release 0.6
|
||||||
been removed in favor of [vim.fidget-nvim.notification.window.align](vim.fidget-nvim.notification.window.align), which now supports
|
been removed in favor of [vim.fidget-nvim.notification.window.align](vim.fidget-nvim.notification.window.align), which now supports
|
||||||
`top` and `bottom` values. `vim.fidget-nvim.align.right` has no longer any equivalent and also has been removed.
|
`top` and `bottom` values. `vim.fidget-nvim.align.right` has no longer any equivalent and also has been removed.
|
||||||
|
|
||||||
- `which-key.nvim` categories can now be customized through [vim.binds.whichKey.register](vim.binds.whichKey.register).
|
- `which-key.nvim` categories can now be customized through [vim.binds.whichKey.register](vim.binds.whichKey.register)
|
||||||
|
|
||||||
- Added `magick` to `vim.luaPackages` for `image.nvim`
|
- Added `magick` to `vim.luaPackages` for `image.nvim`.
|
||||||
|
|
||||||
- Added `alejandra` to the default devShell.
|
- Added `alejandra` to the default devShell.
|
||||||
|
|
||||||
- Migrated neovim-flake to `makeNeovimUnstable` wrapper
|
- Migrated neovim-flake to `makeNeovimUnstable` wrapper.
|
||||||
|
|
||||||
[notashelf](https://github.com/notashelf):
|
[notashelf](https://github.com/notashelf):
|
||||||
|
|
||||||
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now
|
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. All documentation options
|
||||||
|
and files are fully free of Asciidoc, and will now use Nixpkgs flavored markdown.
|
||||||
|
|
||||||
- Bumped plugin inputs to their latest versions
|
- Bumped plugin inputs to their latest versions.
|
||||||
|
|
||||||
- Deprecated `presence.nvim` in favor of `neocord`. This means `vim.rich-presence.presence-nvim` is removed and will throw
|
- Deprecated `presence.nvim` in favor of `neocord`. This means `vim.rich-presence.presence-nvim` is removed and will throw
|
||||||
a warning if used. You are recommended to rewrite your neocord configuration from scratch based on the
|
a warning if used. You are recommended to rewrite your neocord configuration from scratch based on the.
|
||||||
[official documentation](https://github.com/IogaMaster/neocord)
|
[official documentation](https://github.com/IogaMaster/neocord)
|
||||||
|
|
||||||
- Removed Tabnine plugin due to the usage of imperative tarball downloads. If you'd like to see it back, please make an issue.
|
- Removed Tabnine plugin due to the usage of imperative tarball downloads. If you'd like to see it back, please create an issue.
|
||||||
|
|
||||||
- Added support for css and tailwindcss through vscode-language-servers-extracted & tailwind-language-server.
|
- Added support for css and tailwindcss through vscode-language-servers-extracted & tailwind-language-server.
|
||||||
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`
|
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`.
|
||||||
|
|
||||||
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus` and `disabled_filetypes` through the new
|
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus` and `disabled_filetypes` through the new
|
||||||
options: [vim.statusline.lualine.alwaysDivideMiddle](vim.statusline.lualine.alwaysDivideMiddle),
|
options: [vim.statusline.lualine.alwaysDivideMiddle](vim.statusline.lualine.alwaysDivideMiddle),
|
||||||
[vim.statusline.lualine.ignoreFocus](vim.statusline.lualine.ignoreFocus) and
|
[vim.statusline.lualine.ignoreFocus](vim.statusline.lualine.ignoreFocus) and
|
||||||
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes)
|
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes).
|
||||||
|
|
||||||
- Updated all plugin inputs to their latest versions (**14.04.2024**) - this brought minor color changes to the Catppuccin
|
- Updated all plugin inputs to their latest versions (**21.04.2024**) - this brought minor color changes to the Catppuccin
|
||||||
theme.
|
theme.
|
||||||
|
|
||||||
- Moved home-manager module entrypoint to `flake/modules` and added an experimental Nixos module. This requires further testing
|
- Moved home-manager module entrypoint to `flake/modules` and added an experimental Nixos module. This requires further testing
|
||||||
|
@ -87,7 +130,8 @@ Release notes for release 0.6
|
||||||
- Changed the tree structure to distinguish between core options and plugin options.
|
- Changed the tree structure to distinguish between core options and plugin options.
|
||||||
|
|
||||||
- Added plugin auto-discovery from plugin inputs. This is mostly from
|
- Added plugin auto-discovery from plugin inputs. This is mostly from
|
||||||
[JordanIsaac's neovim-flake](https://github.com/jordanisaacs/neovim-flake)
|
[JordanIsaac's neovim-flake](https://github.com/jordanisaacs/neovim-flake). Allows contributors to add plugin inputs
|
||||||
|
with the `plugin-` prefix to have them automatically discovered for the `plugin` type in `lib/types`.
|
||||||
|
|
||||||
- Moved internal `wrapLuaConfig` to the extended library, structured its arguments to take `luaBefore`, `luaConfig`
|
- Moved internal `wrapLuaConfig` to the extended library, structured its arguments to take `luaBefore`, `luaConfig`
|
||||||
and `luaAfter` as strings, which are then concatted inside a lua block.
|
and `luaAfter` as strings, which are then concatted inside a lua block.
|
||||||
|
@ -96,6 +140,12 @@ Release notes for release 0.6
|
||||||
for inserting verbatim Lua configuration before and after the resolved Lua DAG respectively. Both of those options
|
for inserting verbatim Lua configuration before and after the resolved Lua DAG respectively. Both of those options
|
||||||
take strings as the type, so you may read the contents of a Lua file from a given path.
|
take strings as the type, so you may read the contents of a Lua file from a given path.
|
||||||
|
|
||||||
[jacekpoz](https://github.com/jacekpoz):
|
- Added [`vim.spellChecking.ignoredFiletypes`](vim.spellChecking.ignoredFiletypes)
|
||||||
|
and [`vim.spellChecking.programmingWordlist.enable`](vim.spellChecking.programmingWordlist.enable) for ignoring certain filetypes
|
||||||
|
in spellchecking and enabling `vim-dirtytalk` respectively. The previously used `vim.spellcheck.vim-dirtytalk` aliases to the latter
|
||||||
|
option.
|
||||||
|
|
||||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.
|
- Exposed `withRuby`, `withNodeJs`, `withPython3`, and `python3Packages` from the `makeNeovimConfig` function under their respective options.
|
||||||
|
|
||||||
|
- Added [`vim.extraPackages`](vim.extraPackages) for appending additional packages to the wrapper PATH, making said packages available
|
||||||
|
while inside the Neovim session.
|
||||||
|
|
120
flake.lock
120
flake.lock
|
@ -131,11 +131,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712791164,
|
"lastModified": 1713537308,
|
||||||
"narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=",
|
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5",
|
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -262,11 +262,11 @@
|
||||||
"plugin-catppuccin": {
|
"plugin-catppuccin": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713033163,
|
"lastModified": 1713105352,
|
||||||
"narHash": "sha256-hmWp/+qFEJ0zZBjR6kz+EuyHswI0T+DhmUneSPZVhkM=",
|
"narHash": "sha256-yTVou/WArEWygBBs2NFPI9Dm9iSGfwVftKFbOAGl8tk=",
|
||||||
"owner": "catppuccin",
|
"owner": "catppuccin",
|
||||||
"repo": "nvim",
|
"repo": "nvim",
|
||||||
"rev": "fc98570d85ae772e56dc42cf8d7d6a497a909bdb",
|
"rev": "a1439ad7c584efb3d0ce14ccb835967f030450fe",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -502,11 +502,11 @@
|
||||||
"plugin-dashboard-nvim": {
|
"plugin-dashboard-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712210522,
|
"lastModified": 1713420371,
|
||||||
"narHash": "sha256-i/kKj69yeij/aUP3RpIL1opN5tUiy6C1vehSSLYHbgw=",
|
"narHash": "sha256-zcWBgDM409n6rmb06FqVXbC+HU9HJN0+ADoTJDWHvbA=",
|
||||||
"owner": "glepnir",
|
"owner": "glepnir",
|
||||||
"repo": "dashboard-nvim",
|
"repo": "dashboard-nvim",
|
||||||
"rev": "681300934baf36f6184ca41f0b26aed22056d4ee",
|
"rev": "6d06924b562de6f0bb136edf1bf549afbf6b7d00",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -566,11 +566,11 @@
|
||||||
"plugin-elixir-ls": {
|
"plugin-elixir-ls": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711286188,
|
"lastModified": 1713432893,
|
||||||
"narHash": "sha256-OIB5f+FBOPsTWKGWyoU+/NQDMsJXBdj1v7UclbTP5ZY=",
|
"narHash": "sha256-4xIX5j920uKYHvwH+Ftid4UixMa274a/37CZIw6dg6M=",
|
||||||
"owner": "elixir-lsp",
|
"owner": "elixir-lsp",
|
||||||
"repo": "elixir-ls",
|
"repo": "elixir-ls",
|
||||||
"rev": "3e71900e0d0891f9f95e35d9a52b16c6a773a259",
|
"rev": "df03608f11700ece5c8f8202ccd4d7f296df54df",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -582,11 +582,11 @@
|
||||||
"plugin-elixir-tools": {
|
"plugin-elixir-tools": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710172806,
|
"lastModified": 1713617654,
|
||||||
"narHash": "sha256-pVDeS9oCFzA9t9J/JfYG/RfdMoSmaaERd5nUgL9KHyM=",
|
"narHash": "sha256-pJgtW51FLs+Yr+tlQckRmGkRnSUQNI3fEROn3D51mMs=",
|
||||||
"owner": "elixir-tools",
|
"owner": "elixir-tools",
|
||||||
"repo": "elixir-tools.nvim",
|
"repo": "elixir-tools.nvim",
|
||||||
"rev": "4d003f4b41ab9b4f8b569104fa7818f048ed4e25",
|
"rev": "3c4f8344a341818417b3d75c04eb96d894cb4640",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -614,11 +614,11 @@
|
||||||
"plugin-flutter-tools": {
|
"plugin-flutter-tools": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711622317,
|
"lastModified": 1713525182,
|
||||||
"narHash": "sha256-TQRz2MHg6qnzZGUDVFUoaZJiTBwQ3Hjqvc8AAeVS93Y=",
|
"narHash": "sha256-krcaaDPJsftkrcEov1QdKQUQBH6+PgjNwFamWpmNFkU=",
|
||||||
"owner": "akinsho",
|
"owner": "akinsho",
|
||||||
"repo": "flutter-tools.nvim",
|
"repo": "flutter-tools.nvim",
|
||||||
"rev": "4f18033c3b78aa5450e538d81dfbbb3e67aeadec",
|
"rev": "f04131d6b2c82c2a7624a8843642d6269b50b437",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -646,11 +646,11 @@
|
||||||
"plugin-gitsigns-nvim": {
|
"plugin-gitsigns-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712937200,
|
"lastModified": 1713620636,
|
||||||
"narHash": "sha256-8pAy6mICiXpUO36ctWXbmRVB7cDSSDIArh9Nq59az9I=",
|
"narHash": "sha256-UK3DyvrQ0kLm9wrMQ6tLDoDunoThbY/Yfjn+eCZpuMw=",
|
||||||
"owner": "lewis6991",
|
"owner": "lewis6991",
|
||||||
"repo": "gitsigns.nvim",
|
"repo": "gitsigns.nvim",
|
||||||
"rev": "d96ef3bbff0bdbc3916a220f5c74a04c4db033f2",
|
"rev": "035da036e68e509ed158414416c827d022d914bd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -742,11 +742,11 @@
|
||||||
"plugin-image-nvim": {
|
"plugin-image-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712327429,
|
"lastModified": 1713467683,
|
||||||
"narHash": "sha256-usDtW+WnaeTdxx1ALCiZu/gnx2so7QneOjWoEXiChoQ=",
|
"narHash": "sha256-qSGtiBl94RJMffoxXEV74fNcmrYcKtfPc3Aw65tzuDM=",
|
||||||
"owner": "3rd",
|
"owner": "3rd",
|
||||||
"repo": "image.nvim",
|
"repo": "image.nvim",
|
||||||
"rev": "9be5ede323756d7ee2bbef2bc157767b3972cce6",
|
"rev": "301de7919b2c0378cb7a782663f67abbcb198b17",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1015,11 +1015,11 @@
|
||||||
"plugin-nvim-bufferline-lua": {
|
"plugin-nvim-bufferline-lua": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1709805539,
|
"lastModified": 1713525468,
|
||||||
"narHash": "sha256-drvgwupiyRAoShL2enXEYUumkYJnG+QtIkBIVqVZK+U=",
|
"narHash": "sha256-28ZkN2o6xumhvXGbxRl3/eODhMOgJfOig/+svi/uAZk=",
|
||||||
"owner": "akinsho",
|
"owner": "akinsho",
|
||||||
"repo": "nvim-bufferline.lua",
|
"repo": "nvim-bufferline.lua",
|
||||||
"rev": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef",
|
"rev": "f6f00d9ac1a51483ac78418f9e63126119a70709",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1095,11 +1095,11 @@
|
||||||
"plugin-nvim-dap": {
|
"plugin-nvim-dap": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711382674,
|
"lastModified": 1713432622,
|
||||||
"narHash": "sha256-HoLnYeA18TpHM1SJ3NOY53ZAyBo2y2EoUbAIr7TqtQI=",
|
"narHash": "sha256-kEn2INrNMQSLHY3gpSVV+cTx9f1nFeUCM6by9WGn5Sg=",
|
||||||
"owner": "mfussenegger",
|
"owner": "mfussenegger",
|
||||||
"repo": "nvim-dap",
|
"repo": "nvim-dap",
|
||||||
"rev": "405df1dcc2e395ab5173a9c3d00e03942c023074",
|
"rev": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1159,11 +1159,11 @@
|
||||||
"plugin-nvim-lspconfig": {
|
"plugin-nvim-lspconfig": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713075103,
|
"lastModified": 1713507075,
|
||||||
"narHash": "sha256-3GS1udfgzbghho1xtwZ5N1MZgWXWrJnW36Gnl/SAzIQ=",
|
"narHash": "sha256-/SqLT0PG2RUWyknYpcXlcU/aUyKWZMBs35s1sPRkEmc=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "nvim-lspconfig",
|
"repo": "nvim-lspconfig",
|
||||||
"rev": "76b1bbaecbe7215498983356d50a16b46c20d6b0",
|
"rev": "ed8b8a15acc441aec669f97d75f2c1f2ac8c8aa5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1303,11 +1303,11 @@
|
||||||
"plugin-nvim-treesitter-context": {
|
"plugin-nvim-treesitter-context": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713029046,
|
"lastModified": 1713520917,
|
||||||
"narHash": "sha256-9r8UjGPAbLFHR3eYReLOR7SmBI+H6l6BeUrzaocq3YU=",
|
"narHash": "sha256-AT49dDlwPaV41O+rcUCzzdra8moIg4iDAIhZJb6j0zE=",
|
||||||
"owner": "nvim-treesitter",
|
"owner": "nvim-treesitter",
|
||||||
"repo": "nvim-treesitter-context",
|
"repo": "nvim-treesitter-context",
|
||||||
"rev": "ba05c6b753130d96b284d3e8ba8f54c28c0fb6d1",
|
"rev": "ba4289ad345ececd335a9cdd7b9616fd0bb6be92",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1335,11 +1335,11 @@
|
||||||
"plugin-nvim-web-devicons": {
|
"plugin-nvim-web-devicons": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712684166,
|
"lastModified": 1713596748,
|
||||||
"narHash": "sha256-v+dhVbAN2OKLdS5YbSLmZsLijO4meSUBG26R+Ivm/BM=",
|
"narHash": "sha256-yxsKBCP0ICMiH23tcLoTfZJ3VqNMhgkjOzynjPSRb8Q=",
|
||||||
"owner": "nvim-tree",
|
"owner": "nvim-tree",
|
||||||
"repo": "nvim-web-devicons",
|
"repo": "nvim-web-devicons",
|
||||||
"rev": "6e355632387a085f15a66ad68cf681c1d7374a04",
|
"rev": "31ba3c489e56a7f20881cee013cea1269b6b2f2d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1351,11 +1351,11 @@
|
||||||
"plugin-obsidian-nvim": {
|
"plugin-obsidian-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712778222,
|
"lastModified": 1713538455,
|
||||||
"narHash": "sha256-jjsDXGdFMgdalgkw8HSY3+EfiTkYotsNA6txk1/09VY=",
|
"narHash": "sha256-nIAaQa0DBYBQyfTEJi3Lzqs7QJqyw0Cemq6Hm704K60=",
|
||||||
"owner": "epwalsh",
|
"owner": "epwalsh",
|
||||||
"repo": "obsidian.nvim",
|
"repo": "obsidian.nvim",
|
||||||
"rev": "1265a1fbfca5979f629ecedb2552f743c70f458f",
|
"rev": "ec0f44e1921d2701bd99a542031d280f1e3930b5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1383,11 +1383,11 @@
|
||||||
"plugin-orgmode-nvim": {
|
"plugin-orgmode-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712982802,
|
"lastModified": 1713539113,
|
||||||
"narHash": "sha256-zfw3eHBnJPPhsNr8aG8kn3pAchxklvk5aiFm2rys7PQ=",
|
"narHash": "sha256-0Ayu2kVpnsxu/ER0nx+t7nyU9oNN8URLrGQtAKKb7Ls=",
|
||||||
"owner": "nvim-orgmode",
|
"owner": "nvim-orgmode",
|
||||||
"repo": "orgmode",
|
"repo": "orgmode",
|
||||||
"rev": "5875037fa9c7c8e0abf29cd69510150355d248a0",
|
"rev": "389e91f6f935aa845bc0cd13dd80f75431c34751",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1464,11 +1464,11 @@
|
||||||
"plugin-rose-pine": {
|
"plugin-rose-pine": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712685632,
|
"lastModified": 1713451685,
|
||||||
"narHash": "sha256-A9C5BJiOdT/F6JzWxJw/La77nxCoX3/bND15DM9st6k=",
|
"narHash": "sha256-AdPSz5+nCOnLWexBasHuxRxEKbL4WVg+uV78//W5nLs=",
|
||||||
"owner": "rose-pine",
|
"owner": "rose-pine",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "9cd7d8aad3606a95d733a45d16275eb7a5a836a3",
|
"rev": "17b466e79479758b332a3cac12544a3ad2be6241",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1560,11 +1560,11 @@
|
||||||
"plugin-telescope": {
|
"plugin-telescope": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713022073,
|
"lastModified": 1713586895,
|
||||||
"narHash": "sha256-ZktFx77Ukuk1/Qhmf1wUEe0+wODM7f2H+PlXsDDTjcA=",
|
"narHash": "sha256-3mrcol36HmY31pMAadirDdZqJtD0f+m8V0Lz8FnBx0M=",
|
||||||
"owner": "nvim-telescope",
|
"owner": "nvim-telescope",
|
||||||
"repo": "telescope.nvim",
|
"repo": "telescope.nvim",
|
||||||
"rev": "4d4ade7f2b8f403e8816ca50c05ed16e259b21fb",
|
"rev": "a4432dfb9b0b960c4cbc8765a42dc4fe2e029e8f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1592,11 +1592,11 @@
|
||||||
"plugin-toggleterm-nvim": {
|
"plugin-toggleterm-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707733615,
|
"lastModified": 1713526392,
|
||||||
"narHash": "sha256-FJyDxQm2vs9R4WkqAbh6ryCvEABfrLSKRrAGo/qI5jM=",
|
"narHash": "sha256-liy+AE8a+jll1fhROBKpJaTE9YZHQvYosOW4euGZNYc=",
|
||||||
"owner": "akinsho",
|
"owner": "akinsho",
|
||||||
"repo": "toggleterm.nvim",
|
"repo": "toggleterm.nvim",
|
||||||
"rev": "193786e0371e3286d3bc9aa0079da1cd41beaa62",
|
"rev": "dca1c80fb8ec41c97e7c3ef308719d8143fbbb05",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1672,11 +1672,11 @@
|
||||||
"plugin-vim-illuminate": {
|
"plugin-vim-illuminate": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707016059,
|
"lastModified": 1713467568,
|
||||||
"narHash": "sha256-KNIu4cNyZddZSRS8KZ0U0T8uSSLJu8iqNLQN8e+Bv94=",
|
"narHash": "sha256-o0D1edrsHkaljrzBFZXjdxiK/5ziCGJxM/kYNJgBI1E=",
|
||||||
"owner": "RRethy",
|
"owner": "RRethy",
|
||||||
"repo": "vim-illuminate",
|
"repo": "vim-illuminate",
|
||||||
"rev": "305bf07b919ac526deb5193280379e2f8b599926",
|
"rev": "e522e0dd742a83506db0a72e1ced68c9c130f185",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -2095,11 +2095,11 @@
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713070736,
|
"lastModified": 1713572548,
|
||||||
"narHash": "sha256-FatD7AHSoZGfn2JCOkDt9v04YkJG3PLfC7U7pU6r+bM=",
|
"narHash": "sha256-bYNsY9HwrV8+eJGRYvfLEP6/Sgf2Kr9qNbnB91OYMMM=",
|
||||||
"owner": "mitchellh",
|
"owner": "mitchellh",
|
||||||
"repo": "zig-overlay",
|
"repo": "zig-overlay",
|
||||||
"rev": "1c04fe593ef5124fd84e3d8726d481cba8b527b8",
|
"rev": "76bccd85db6a182dfcbf8a5f4b540953f029a12c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -550,6 +550,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Assistant
|
# Assistant
|
||||||
|
plugin-chatgpt = {
|
||||||
|
url = "github:jackMort/ChatGPT.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
plugin-copilot-lua = {
|
plugin-copilot-lua = {
|
||||||
url = "github:zbirenbaum/copilot.lua";
|
url = "github:zbirenbaum/copilot.lua";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
|
|
@ -7,8 +7,9 @@ packages: inputs: {
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything;
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
|
||||||
cfg = config.programs.neovim-flake;
|
cfg = config.programs.neovim-flake;
|
||||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||||
|
@ -21,7 +22,24 @@ in {
|
||||||
meta.maintainers = with maintainers; [NotAShelf];
|
meta.maintainers = with maintainers; [NotAShelf];
|
||||||
|
|
||||||
options.programs.neovim-flake = {
|
options.programs.neovim-flake = {
|
||||||
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
|
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
||||||
|
|
||||||
|
enableManpages = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to enable manpages for neovim-flake.";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultEditor = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to set `neovim-flake` as the default editor.
|
||||||
|
|
||||||
|
This will set the `EDITOR` environment variable as `nvim`
|
||||||
|
if set to true.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
finalPackage = mkOption {
|
finalPackage = mkOption {
|
||||||
type = anything;
|
type = anything;
|
||||||
|
@ -57,8 +75,13 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [cfg.finalPackage];
|
|
||||||
|
|
||||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
||||||
|
|
||||||
|
home = {
|
||||||
|
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
||||||
|
packages =
|
||||||
|
[cfg.finalPackage]
|
||||||
|
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Home Manager module
|
# NixOS module
|
||||||
packages: inputs: {
|
packages: inputs: {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
@ -6,9 +6,10 @@ packages: inputs: {
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkOverride;
|
||||||
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything;
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
|
||||||
cfg = config.programs.neovim-flake;
|
cfg = config.programs.neovim-flake;
|
||||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||||
|
@ -21,7 +22,24 @@ in {
|
||||||
meta.maintainers = with maintainers; [NotAShelf];
|
meta.maintainers = with maintainers; [NotAShelf];
|
||||||
|
|
||||||
options.programs.neovim-flake = {
|
options.programs.neovim-flake = {
|
||||||
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
|
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
||||||
|
|
||||||
|
enableManpages = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to enable manpages for neovim-flake.";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultEditor = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to set `neovim-flake` as the default editor.
|
||||||
|
|
||||||
|
This will set the `EDITOR` environment variable as `nvim`
|
||||||
|
if set to true.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
finalPackage = mkOption {
|
finalPackage = mkOption {
|
||||||
type = anything;
|
type = anything;
|
||||||
|
@ -57,8 +75,13 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [cfg.finalPackage];
|
|
||||||
|
|
||||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");
|
||||||
|
systemPackages =
|
||||||
|
[cfg.finalPackage]
|
||||||
|
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) bool;
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
|
inherit (lib.lists) flatten;
|
||||||
in {
|
in {
|
||||||
mkBool = value: description:
|
mkBool = value: description:
|
||||||
mkOption {
|
mkOption {
|
||||||
|
@ -8,4 +11,55 @@ in {
|
||||||
default = value;
|
default = value;
|
||||||
inherit description;
|
inherit description;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Generates a list of mkRenamedOptionModule, from a mapping of the old name to
|
||||||
|
the new name. Nested options can optionally supply a "_name" to indicate its
|
||||||
|
new name.
|
||||||
|
|
||||||
|
# Example
|
||||||
|
|
||||||
|
```nix
|
||||||
|
batchRenameOptions ["nvimTree"] ["nvimTree" "setupOpts"] {
|
||||||
|
disableNetrw = "disable_netrw";
|
||||||
|
nestedOption = {
|
||||||
|
_name = "nested_option";
|
||||||
|
somethingElse = "something_else";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The above code is equivalent to this:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
[
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
["nvimTree" "disableNetrw"]
|
||||||
|
["nvimTree" "setupOpts" "disable_netrw"]
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
["nvimTree" "nestedOption" "somethingElse"]
|
||||||
|
["nvimTree" "setupOpts" "nested_option" "something_else"]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
batchRenameOptions = oldBasePath: newBasePath: mappings: let
|
||||||
|
genSetupOptRenames = oldSubpath: newSubpath: table:
|
||||||
|
mapAttrsToList (
|
||||||
|
oldName: newNameOrNestedOpts:
|
||||||
|
if builtins.isAttrs newNameOrNestedOpts
|
||||||
|
then
|
||||||
|
genSetupOptRenames (oldSubpath ++ [oldName]) (newSubpath ++ [newNameOrNestedOpts._name or oldName])
|
||||||
|
(builtins.removeAttrs newNameOrNestedOpts ["_name"])
|
||||||
|
else
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(oldBasePath ++ oldSubpath ++ [oldName])
|
||||||
|
(newBasePath ++ newSubpath ++ [newNameOrNestedOpts])
|
||||||
|
)
|
||||||
|
table;
|
||||||
|
in
|
||||||
|
flatten (genSetupOptRenames [] [] mappings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,11 @@ in {
|
||||||
|
|
||||||
pluginsOpt = {
|
pluginsOpt = {
|
||||||
description,
|
description,
|
||||||
|
example,
|
||||||
default ? [],
|
default ? [],
|
||||||
}:
|
}:
|
||||||
mkOption {
|
mkOption {
|
||||||
inherit description default;
|
inherit example description default;
|
||||||
type = pluginsType;
|
type = pluginsType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,7 +91,13 @@ in {
|
||||||
*/
|
*/
|
||||||
mkPluginSetupOption = pluginName: opts:
|
mkPluginSetupOption = pluginName: opts:
|
||||||
mkOption {
|
mkOption {
|
||||||
description = "Option table to pass into the setup function of " + pluginName;
|
description = ''
|
||||||
|
Option table to pass into the setup function of ${pluginName}
|
||||||
|
|
||||||
|
You can pass in any additional options even if they're
|
||||||
|
not listed in the docs
|
||||||
|
'';
|
||||||
|
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
freeformType = attrsOf anything;
|
freeformType = attrsOf anything;
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
|
||||||
inherit (lib.types) path int package bool str listOf attrsOf;
|
|
||||||
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
|
||||||
in {
|
|
||||||
options.vim = {
|
|
||||||
package = mkOption {
|
|
||||||
type = package;
|
|
||||||
default = pkgs.neovim-unwrapped;
|
|
||||||
description = ''
|
|
||||||
The neovim package to use.
|
|
||||||
|
|
||||||
You will need to use an unwrapped package for this option to work as intended.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
debugMode = {
|
|
||||||
enable = mkEnableOption "debug mode";
|
|
||||||
level = mkOption {
|
|
||||||
type = int;
|
|
||||||
default = 20;
|
|
||||||
description = "Set the debug level";
|
|
||||||
};
|
|
||||||
|
|
||||||
logFile = mkOption {
|
|
||||||
type = path;
|
|
||||||
default = "/tmp/nvim.log";
|
|
||||||
description = "Set the log file";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
viAlias = mkOption {
|
|
||||||
description = "Enable vi alias";
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
vimAlias = mkOption {
|
|
||||||
description = "Enable vim alias";
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
startPlugins = pluginsOpt {
|
|
||||||
default = [];
|
|
||||||
description = "List of plugins to startup.";
|
|
||||||
};
|
|
||||||
|
|
||||||
optPlugins = pluginsOpt {
|
|
||||||
default = [];
|
|
||||||
description = "List of plugins to optionally load";
|
|
||||||
};
|
|
||||||
|
|
||||||
extraPlugins = mkOption {
|
|
||||||
type = attrsOf extraPluginType;
|
|
||||||
default = {};
|
|
||||||
description = ''
|
|
||||||
List of plugins and related config.
|
|
||||||
Note that these are setup after builtin plugins.
|
|
||||||
'';
|
|
||||||
example = literalExpression ''
|
|
||||||
with pkgs.vimPlugins; {
|
|
||||||
aerial = {
|
|
||||||
package = aerial-nvim;
|
|
||||||
setup = "require('aerial').setup {}";
|
|
||||||
};
|
|
||||||
harpoon = {
|
|
||||||
package = harpoon;
|
|
||||||
setup = "require('harpoon').setup {}";
|
|
||||||
after = ["aerial"];
|
|
||||||
};
|
|
||||||
}'';
|
|
||||||
};
|
|
||||||
|
|
||||||
luaPackages = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
List of lua packages to install.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./build
|
|
||||||
./warnings
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -4,30 +4,44 @@ inputs: {
|
||||||
lib ? pkgs.lib,
|
lib ? pkgs.lib,
|
||||||
check ? true,
|
check ? true,
|
||||||
extraSpecialArgs ? {},
|
extraSpecialArgs ? {},
|
||||||
|
extraModules ? [],
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map filter isString toString getAttr;
|
inherit (builtins) map filter isString toString getAttr;
|
||||||
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
||||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||||
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
||||||
|
inherit (lib.strings) makeBinPath escapeShellArgs concatStringsSep;
|
||||||
|
inherit (lib.lists) concatLists optional;
|
||||||
inherit (lib.attrsets) recursiveUpdate;
|
inherit (lib.attrsets) recursiveUpdate;
|
||||||
inherit (lib.asserts) assertMsg;
|
inherit (lib.asserts) assertMsg;
|
||||||
|
|
||||||
|
# call the extedended library with `lib` and `inputs` as arguments
|
||||||
|
# lib is used to provide the standard library functions to the extended library
|
||||||
|
# but it can be overridden while this file is being called
|
||||||
|
# inputs is used to pass inputs to the plugin autodiscovery function
|
||||||
extendedLib = import ../lib/stdlib-extended.nix lib inputs;
|
extendedLib = import ../lib/stdlib-extended.nix lib inputs;
|
||||||
|
|
||||||
|
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
||||||
|
# check can be disabled while calling this file is called
|
||||||
|
# to avoid checking in all modules
|
||||||
nvimModules = import ./modules.nix {
|
nvimModules = import ./modules.nix {
|
||||||
inherit check pkgs;
|
inherit check pkgs;
|
||||||
lib = extendedLib;
|
lib = extendedLib;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# evaluate the extended library with the modules
|
||||||
|
# optionally with any additional modules passed by the user
|
||||||
module = extendedLib.evalModules {
|
module = extendedLib.evalModules {
|
||||||
modules = [configuration] ++ nvimModules;
|
|
||||||
specialArgs = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs;
|
specialArgs = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs;
|
||||||
|
modules = concatLists [[configuration] nvimModules extraModules];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# alias to the internal configuration
|
||||||
vimOptions = module.config.vim;
|
vimOptions = module.config.vim;
|
||||||
|
|
||||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
# build a vim plugin with the given name and arguments
|
||||||
|
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||||
|
# instead
|
||||||
buildPlug = {pname, ...} @ args:
|
buildPlug = {pname, ...} @ args:
|
||||||
assert assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
|
assert assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
|
||||||
buildVimPlugin (args
|
buildVimPlugin (args
|
||||||
|
@ -60,24 +74,51 @@ inputs: {
|
||||||
(f: f != null)
|
(f: f != null)
|
||||||
plugins);
|
plugins);
|
||||||
|
|
||||||
plugins =
|
# built (or "normalized") plugins that are modified
|
||||||
(buildConfigPlugins vimOptions.startPlugins)
|
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||||
++ (map (package: {
|
builtOptPlugins = map (package: {
|
||||||
plugin = package;
|
plugin = package;
|
||||||
optional = false;
|
optional = false;
|
||||||
})
|
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||||
(buildConfigPlugins
|
|
||||||
vimOptions.optPlugins));
|
|
||||||
|
|
||||||
neovim = wrapNeovimUnstable vimOptions.package (makeNeovimConfig {
|
# combine built start and optional plugins
|
||||||
inherit (vimOptions) viAlias;
|
# into a single list
|
||||||
inherit (vimOptions) vimAlias;
|
plugins = builtStartPlugins ++ builtOptPlugins;
|
||||||
inherit extraLuaPackages;
|
|
||||||
inherit plugins;
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
|
# to conform to the format makeNeovimConfig expects. end user should
|
||||||
|
# only ever need to pass a list of packages, which are modified
|
||||||
|
# here
|
||||||
|
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||||
|
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||||
|
|
||||||
|
extraWrapperArgs =
|
||||||
|
concatStringsSep " " (optional (vimOptions.extraPackages != []) ''--prefix PATH : "${makeBinPath vimOptions.extraPackages}"'');
|
||||||
|
|
||||||
|
# wrap user's desired neovim package with the desired neovim configuration
|
||||||
|
# using wrapNeovimUnstable and makeNeovimConfig from nixpkgs.
|
||||||
|
# the makeNeovimConfig function takes the following arguments:
|
||||||
|
# - withPython (bool)
|
||||||
|
# - extraPython3Packages (lambda)
|
||||||
|
# - withNodeJs (bool)
|
||||||
|
# - withRuby (bool)
|
||||||
|
# - extraLuaPackages (lambda)
|
||||||
|
# - plugins (list)
|
||||||
|
# - customRC (string)
|
||||||
|
# and returns the wrapped package
|
||||||
|
neovimConfigured = makeNeovimConfig {
|
||||||
|
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
||||||
|
inherit plugins extraLuaPackages extraPython3Packages;
|
||||||
customRC = vimOptions.builtConfigRC;
|
customRC = vimOptions.builtConfigRC;
|
||||||
|
};
|
||||||
|
|
||||||
|
neovim-wrapped = wrapNeovimUnstable vimOptions.package (recursiveUpdate neovimConfigured {
|
||||||
|
wrapperArgs = escapeShellArgs neovimConfigured.wrapperArgs + " " + extraWrapperArgs;
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
inherit (module) options config;
|
inherit (module) options config;
|
||||||
inherit (module._module.args) pkgs;
|
inherit (module._module.args) pkgs;
|
||||||
inherit neovim;
|
|
||||||
|
# expose wrapped neovim-package
|
||||||
|
neovim = neovim-wrapped;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,17 @@
|
||||||
inherit (lib.modules) mkDefault;
|
inherit (lib.modules) mkDefault;
|
||||||
inherit (lib.lists) concatLists;
|
inherit (lib.lists) concatLists;
|
||||||
|
|
||||||
core = map (p: ./core + "/${p}") [
|
# The core neovim modules.
|
||||||
"build"
|
# Contains configuration for core neovim features
|
||||||
"warnings"
|
# such as spellchecking, mappings, and the init script (init.vim).
|
||||||
];
|
|
||||||
|
|
||||||
neovim = map (p: ./neovim + "/${p}") [
|
neovim = map (p: ./neovim + "/${p}") [
|
||||||
"basic"
|
"init"
|
||||||
"mappings"
|
"mappings"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Individual plugin modules, separated by the type of plugin.
|
||||||
|
# While adding a new type, you must make sure your type is
|
||||||
|
# included in the list below.
|
||||||
plugins = map (p: ./plugins + "/${p}") [
|
plugins = map (p: ./plugins + "/${p}") [
|
||||||
"assistant"
|
"assistant"
|
||||||
"autopairs"
|
"autopairs"
|
||||||
|
@ -44,7 +45,15 @@
|
||||||
"visuals"
|
"visuals"
|
||||||
];
|
];
|
||||||
|
|
||||||
allModules = concatLists [core neovim plugins];
|
# The neovim wrapper, used to build a wrapped neovim package
|
||||||
|
# using the configuration passed in `neovim` and `plugins` modules.
|
||||||
|
wrapper = map (p: ./wrapper + "/${p}") [
|
||||||
|
"build"
|
||||||
|
"rc"
|
||||||
|
"warnings"
|
||||||
|
];
|
||||||
|
|
||||||
|
allModules = concatLists [neovim plugins wrapper];
|
||||||
|
|
||||||
pkgsModule = {config, ...}: {
|
pkgsModule = {config, ...}: {
|
||||||
config = {
|
config = {
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
|
||||||
inherit (lib.strings) concatStringsSep;
|
|
||||||
inherit (lib.lists) optionals;
|
|
||||||
inherit (lib.types) listOf str;
|
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
|
||||||
|
|
||||||
cfg = config.vim.spellChecking;
|
|
||||||
in {
|
|
||||||
options.vim.spellChecking = {
|
|
||||||
enable = mkEnableOption "neovim's built-in spellchecking";
|
|
||||||
languages = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = ["en"];
|
|
||||||
example = literalExpression ''["en" "de"]'';
|
|
||||||
description = "The languages to be used for spellchecking";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
vim = {
|
|
||||||
configRC.spellchecking = entryAfter ["basic"] ''
|
|
||||||
" Spellchecking
|
|
||||||
set spell
|
|
||||||
set spelllang=${concatStringsSep "," cfg.languages}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
config = {
|
|
||||||
vim.startPlugins = ["plenary-nvim"];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -145,6 +145,7 @@ in {
|
||||||
default = true;
|
default = true;
|
||||||
description = "New splits will open to the right";
|
description = "New splits will open to the right";
|
||||||
};
|
};
|
||||||
|
|
||||||
enableEditorconfig = mkOption {
|
enableEditorconfig = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -167,25 +168,19 @@ in {
|
||||||
config.vim.configRC.basic = entryAfter ["globalsScript"] ''
|
config.vim.configRC.basic = entryAfter ["globalsScript"] ''
|
||||||
" Settings that are set for everything
|
" Settings that are set for everything
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
|
set hidden
|
||||||
|
set shortmess+=c
|
||||||
|
set expandtab
|
||||||
set mouse=${cfg.mouseSupport}
|
set mouse=${cfg.mouseSupport}
|
||||||
set tabstop=${toString cfg.tabWidth}
|
set tabstop=${toString cfg.tabWidth}
|
||||||
set shiftwidth=${toString cfg.tabWidth}
|
set shiftwidth=${toString cfg.tabWidth}
|
||||||
set softtabstop=${toString cfg.tabWidth}
|
set softtabstop=${toString cfg.tabWidth}
|
||||||
set expandtab
|
|
||||||
set cmdheight=${toString cfg.cmdHeight}
|
set cmdheight=${toString cfg.cmdHeight}
|
||||||
set updatetime=${toString cfg.updateTime}
|
set updatetime=${toString cfg.updateTime}
|
||||||
set shortmess+=c
|
|
||||||
set tm=${toString cfg.mapTimeout}
|
set tm=${toString cfg.mapTimeout}
|
||||||
set hidden
|
|
||||||
set cursorlineopt=${toString cfg.cursorlineOpt}
|
set cursorlineopt=${toString cfg.cursorlineOpt}
|
||||||
set scrolloff=${toString cfg.scrollOffset}
|
set scrolloff=${toString cfg.scrollOffset}
|
||||||
|
|
||||||
${optionalString cfg.debugMode.enable ''
|
|
||||||
" Debug mode settings
|
|
||||||
set verbose=${toString cfg.debugMode.level}
|
|
||||||
set verbosefile=${cfg.debugMode.logFile}
|
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.splitBelow ''
|
${optionalString cfg.splitBelow ''
|
||||||
set splitbelow
|
set splitbelow
|
||||||
''}
|
''}
|
50
modules/neovim/init/debug.nix
Normal file
50
modules/neovim/init/debug.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) path enum nullOr;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
|
cfg = config.vim.debugMode;
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
debugMode = {
|
||||||
|
enable = mkEnableOption "debug mode";
|
||||||
|
level = mkOption {
|
||||||
|
type = enum [2 3 4 5 8 9 11 12 13 14 15 16];
|
||||||
|
default = 16;
|
||||||
|
description = ''
|
||||||
|
Set verbosity level of Neovim while debug mode is enabled.
|
||||||
|
|
||||||
|
Value must be be one of the levels expected by Neovim's
|
||||||
|
[`verbose` option](https://neovim.io/doc/user/options.html#'verbose')
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
logFile = mkOption {
|
||||||
|
type = nullOr path;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Set the log file that will be used to store verbose messages
|
||||||
|
set by the `verbose` option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.vim = mkIf cfg.enable {
|
||||||
|
luaConfigRC.debug-mode = entryAfter ["basic"] ''
|
||||||
|
-- Debug mode settings
|
||||||
|
vim.o.verbose = ${toString cfg.level},
|
||||||
|
|
||||||
|
${optionalString (cfg.logFile != null) ''
|
||||||
|
-- Set verbose log file
|
||||||
|
vim.o.verbosefile = ${cfg.logFile},
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./configrc.nix
|
./basic.nix
|
||||||
|
./debug.nix
|
||||||
./spellcheck.nix
|
./spellcheck.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
70
modules/neovim/init/spellcheck.nix
Normal file
70
modules/neovim/init/spellcheck.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkRenamedOptionModule;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.types) listOf str;
|
||||||
|
inherit (lib.nvim.lua) listToLuaTable;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
|
cfg = config.vim.spellcheck;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule ["vim" "spellChecking"] ["vim" "spellcheck"])
|
||||||
|
];
|
||||||
|
|
||||||
|
options.vim.spellcheck = {
|
||||||
|
enable = mkEnableOption "neovim's built-in spellchecking";
|
||||||
|
languages = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["en"];
|
||||||
|
example = literalExpression ''["en" "de"]'';
|
||||||
|
description = ''
|
||||||
|
A list of languages that should be used for spellchecking.
|
||||||
|
|
||||||
|
To add your own language files, you may place your `spell`
|
||||||
|
directory in either `~/.config/nvim` or the
|
||||||
|
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
|
||||||
|
directory provided by neovim-flake.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ignoredFiletypes = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["toggleterm"];
|
||||||
|
example = literalExpression ''["markdown" "gitcommit"]'';
|
||||||
|
description = ''
|
||||||
|
A list of filetypes for which spellchecking will be disabled.
|
||||||
|
|
||||||
|
You may use `echo &filetype` in neovim to find out the
|
||||||
|
filetype for a specific buffer.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
programmingWordlist.enable = mkEnableOption ''
|
||||||
|
vim-dirtytalk, a wordlist for programmers containing
|
||||||
|
common programming terms.
|
||||||
|
|
||||||
|
Setting this value as `true` has the same effect
|
||||||
|
as setting {option}`vim.spellCheck.enable`
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim.luaConfigRC.spellcheck = entryAfter ["basic"] ''
|
||||||
|
vim.opt.spell = true
|
||||||
|
vim.opt.spelllang = ${listToLuaTable cfg.languages}
|
||||||
|
|
||||||
|
-- Disable spellchecking for certain filetypes
|
||||||
|
-- as configured by `vim.spellcheck.ignoredFiletypes`
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
pattern = ${listToLuaTable cfg.ignoredFiletypes},
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.spell = false
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
59
modules/neovim/mappings/config.nix
Normal file
59
modules/neovim/mappings/config.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
|
cfg = config.vim;
|
||||||
|
in {
|
||||||
|
config = {
|
||||||
|
vim.maps = {
|
||||||
|
normal =
|
||||||
|
mkIf cfg.disableArrows {
|
||||||
|
"<up>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<down>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<left>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<right>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// mkIf cfg.mapLeaderSpace {
|
||||||
|
"<space>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
insert = mkIf cfg.disableArrows {
|
||||||
|
"<up>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<down>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<left>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<right>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,57 +1,6 @@
|
||||||
{
|
{
|
||||||
config,
|
imports = [
|
||||||
lib,
|
./config.nix
|
||||||
...
|
./options.nix
|
||||||
}: let
|
];
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
|
|
||||||
cfg = config.vim;
|
|
||||||
in {
|
|
||||||
vim.maps = {
|
|
||||||
normal =
|
|
||||||
mkIf cfg.disableArrows {
|
|
||||||
"<up>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<down>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<left>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<right>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// mkIf cfg.mapLeaderSpace {
|
|
||||||
"<space>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
insert = mkIf cfg.disableArrows {
|
|
||||||
"<up>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<down>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<left>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<right>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
101
modules/neovim/mappings/options.nix
Normal file
101
modules/neovim/mappings/options.nix
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) bool str 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 <silent> to a map.";
|
||||||
|
|
||||||
|
nowait =
|
||||||
|
mkBool false
|
||||||
|
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||||
|
|
||||||
|
script =
|
||||||
|
mkBool false
|
||||||
|
"Equivalent to adding <script> to a map.";
|
||||||
|
|
||||||
|
expr =
|
||||||
|
mkBool false
|
||||||
|
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||||
|
|
||||||
|
unique =
|
||||||
|
mkBool false
|
||||||
|
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
||||||
|
|
||||||
|
noremap =
|
||||||
|
mkBool true
|
||||||
|
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
||||||
|
|
||||||
|
desc = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mapOption = submodule {
|
||||||
|
options =
|
||||||
|
mapConfigOptions
|
||||||
|
// {
|
||||||
|
action = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "The action to execute.";
|
||||||
|
};
|
||||||
|
|
||||||
|
lua = mkOption {
|
||||||
|
type = bool;
|
||||||
|
description = ''
|
||||||
|
If true, `action` is considered to be lua code.
|
||||||
|
Thus, it will not be wrapped in `""`.
|
||||||
|
'';
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mapOptions = mode:
|
||||||
|
mkOption {
|
||||||
|
description = "Mappings for ${mode} mode";
|
||||||
|
type = attrsOf mapOption;
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
maps = mkOption {
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
normal = mapOptions "normal";
|
||||||
|
insert = mapOptions "insert";
|
||||||
|
select = mapOptions "select";
|
||||||
|
visual = mapOptions "visual and select";
|
||||||
|
terminal = mapOptions "terminal";
|
||||||
|
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
|
||||||
|
|
||||||
|
visualOnly = mapOptions "visual only";
|
||||||
|
operator = mapOptions "operator-pending";
|
||||||
|
insertCommand = mapOptions "insert and command-line";
|
||||||
|
lang = mapOptions "insert, command-line and lang-arg";
|
||||||
|
command = mapOptions "command-line";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Custom keybindings for any mode.
|
||||||
|
|
||||||
|
For plain maps (e.g. just 'map' or 'remap') use `maps.normalVisualOp`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = ''
|
||||||
|
maps = {
|
||||||
|
normal."<leader>m" = {
|
||||||
|
silent = true;
|
||||||
|
action = "<cmd>make<CR>";
|
||||||
|
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
25
modules/plugins/assistant/chatgpt/chatgpt.nix
Normal file
25
modules/plugins/assistant/chatgpt/chatgpt.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.assistant.chatgpt = {
|
||||||
|
enable = mkEnableOption "ChatGPT AI assistant. Requires the environment variable OPENAI_API_KEY to be set";
|
||||||
|
setupOpts = mkPluginSetupOption "chatgpt" {};
|
||||||
|
mappings = {
|
||||||
|
chatGpt = mkMappingOption "ChatGPT" "<leader>ac";
|
||||||
|
editWithInstructions = mkMappingOption "[ChatGPT] Edit with instructions" "<leader>ae";
|
||||||
|
grammarCorrection = mkMappingOption "[ChatGPT] Grammar correction" "<leader>ag";
|
||||||
|
translate = mkMappingOption "[ChatGPT] Translate" "<leader>at";
|
||||||
|
keyword = mkMappingOption "[ChatGPT] Keywords" "<leader>ak";
|
||||||
|
docstring = mkMappingOption "[ChatGPT] Docstring" "<leader>ad";
|
||||||
|
addTests = mkMappingOption "[ChatGPT] Add tests" "<leader>aa";
|
||||||
|
optimize = mkMappingOption "[ChatGPT] Optimize code" "<leader>ao";
|
||||||
|
summarize = mkMappingOption "[ChatGPT] Summarize" "<leader>as";
|
||||||
|
fixBugs = mkMappingOption "[ChatGPT] Fix bugs" "<leader>af";
|
||||||
|
explain = mkMappingOption "[ChatGPT] Explain code" "<leader>ax";
|
||||||
|
roxygenEdit = mkMappingOption "[ChatGPT] Roxygen edit" "<leader>ar";
|
||||||
|
readabilityanalysis = mkMappingOption "[ChatGPT] Code reability analysis" "<leader>al";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
46
modules/plugins/assistant/chatgpt/config.nix
Normal file
46
modules/plugins/assistant/chatgpt/config.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.assistant.chatgpt;
|
||||||
|
|
||||||
|
self = import ./chatgpt.nix {inherit lib;};
|
||||||
|
mappingDefinitions = self.options.vim.assistant.chatgpt.mappings;
|
||||||
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
|
maps = mkMerge [
|
||||||
|
(mkSetBinding mappings.editWithInstructions "<cmd>ChatGPTEditWithInstruction<CR>")
|
||||||
|
(mkSetBinding mappings.grammarCorrection "<cmd>ChatGPTRun grammar_correction<CR>")
|
||||||
|
(mkSetBinding mappings.translate "<cmd>ChatGPTRun translate<CR>")
|
||||||
|
(mkSetBinding mappings.keyword "<cmd>ChatGPTRun keywords<CR>")
|
||||||
|
(mkSetBinding mappings.docstring "<cmd>ChatGPTRun docstring<CR>")
|
||||||
|
(mkSetBinding mappings.addTests "<cmd>ChatGPTRun add_tests<CR>")
|
||||||
|
(mkSetBinding mappings.optimize "<cmd>ChatGPTRun optimize_code<CR>")
|
||||||
|
(mkSetBinding mappings.summarize "<cmd>ChatGPTRun summarize<CR>")
|
||||||
|
(mkSetBinding mappings.fixBugs "<cmd>ChatGPTRun fix_bugs<CR>")
|
||||||
|
(mkSetBinding mappings.explain "<cmd>ChatGPTRun explain_code<CR>")
|
||||||
|
(mkSetBinding mappings.roxygenEdit "<cmd>ChatGPTRun roxygen_edit<CR>")
|
||||||
|
(mkSetBinding mappings.readabilityanalysis "<cmd>ChatGPTRun code_readability_analysis<CR>")
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = [
|
||||||
|
"chatgpt"
|
||||||
|
];
|
||||||
|
luaConfigRC.chagpt = entryAnywhere ''
|
||||||
|
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
maps.normal = mkMerge [
|
||||||
|
(mkSetBinding mappings.chatGpt "<cmd>ChatGPT<CR>")
|
||||||
|
maps
|
||||||
|
];
|
||||||
|
maps.visual = maps;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./basic
|
./chatgpt.nix
|
||||||
./mappings
|
|
||||||
|
|
||||||
./config.nix
|
./config.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) nullOr str enum float;
|
inherit (lib.types) nullOr str enum float;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./chatgpt
|
||||||
./copilot
|
./copilot
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.nvimtreelua = entryAnywhere ''
|
vim.luaConfigRC.nvimtreelua = entryAnywhere ''
|
||||||
${
|
${
|
||||||
optionalString cfg.disableNetrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
-- disable netrew completely
|
-- disable netrew completely
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
|
@ -7,7 +7,71 @@
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.types) nullOr str bool int submodule listOf enum oneOf attrs addCheck;
|
inherit (lib.types) nullOr str bool int submodule listOf enum oneOf attrs addCheck;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.nvim.config) batchRenameOptions;
|
||||||
|
|
||||||
|
migrationTable = {
|
||||||
|
disableNetrw = "disable_netrw";
|
||||||
|
hijackNetrw = "hijack_netrw";
|
||||||
|
autoreloadOnWrite = "autoreload_on_write";
|
||||||
|
updateFocusedFile = "update_focused_file";
|
||||||
|
sort = {
|
||||||
|
sorter = "sorter";
|
||||||
|
foldersFirst = "folders_first";
|
||||||
|
};
|
||||||
|
hijackCursor = "hijack_cursor";
|
||||||
|
hijackUnnamedBufferWhenOpening = "hijack_unnamed_buffer_when_opening";
|
||||||
|
rootDirs = "root_dirs";
|
||||||
|
preferStartupRoot = "prefer_startup_root";
|
||||||
|
syncRootWithCwd = "sync_root_with_cwd";
|
||||||
|
reloadOnBufEnter = "reload_on_buf_enter";
|
||||||
|
respectBufCwd = "respect_buf_cwd";
|
||||||
|
hijackDirectories = "hijack_directories";
|
||||||
|
systemOpen = {
|
||||||
|
args = "args";
|
||||||
|
cmd = "cmd";
|
||||||
|
};
|
||||||
|
diagnostics = "diagnostics";
|
||||||
|
git = {
|
||||||
|
enable = "enable";
|
||||||
|
showOnDirs = "show_on_dirs";
|
||||||
|
showOnOpenDirs = "show_on_open_dirs";
|
||||||
|
disableForDirs = "disable_for_dirs";
|
||||||
|
timeout = "timeout";
|
||||||
|
};
|
||||||
|
modified = "modified";
|
||||||
|
filesystemWatchers = "filesystem_watchers";
|
||||||
|
selectPrompts = "select_prompts";
|
||||||
|
view = "view";
|
||||||
|
renderer = {
|
||||||
|
addTrailing = "add_trailing";
|
||||||
|
groupEmpty = "group_empty";
|
||||||
|
fullName = "full_name";
|
||||||
|
highlightGit = "highlight_git";
|
||||||
|
highlightOpenedFiles = "highlight_opened_files";
|
||||||
|
highlightModified = "highlight_modified";
|
||||||
|
rootFolderLabel = "root_folder_label";
|
||||||
|
indentWidth = "indent_width";
|
||||||
|
indentMarkers = "indent_markers";
|
||||||
|
specialFiles = "special_files";
|
||||||
|
symlinkDestination = "symlink_destination";
|
||||||
|
icons = "icons";
|
||||||
|
};
|
||||||
|
filters = "filters";
|
||||||
|
trash = "trash";
|
||||||
|
actions = "actions";
|
||||||
|
liveFilter = "live_filter";
|
||||||
|
tab = "tab";
|
||||||
|
notify = "notify";
|
||||||
|
ui = "ui";
|
||||||
|
};
|
||||||
|
|
||||||
|
renamedSetupOpts =
|
||||||
|
batchRenameOptions
|
||||||
|
["vim" "filetree" "nvimTree"]
|
||||||
|
["vim" "filetree" "nvimTree" "setupOpts"]
|
||||||
|
migrationTable;
|
||||||
in {
|
in {
|
||||||
|
imports = renamedSetupOpts;
|
||||||
options.vim.filetree.nvimTree = {
|
options.vim.filetree.nvimTree = {
|
||||||
enable = mkEnableOption "filetree via nvim-tree.lua";
|
enable = mkEnableOption "filetree via nvim-tree.lua";
|
||||||
|
|
||||||
|
@ -34,12 +98,6 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
disableNetrw = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "Disables netrw and replaces it with tree";
|
|
||||||
type = bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "Nvim Tree" {
|
setupOpts = mkPluginSetupOption "Nvim Tree" {
|
||||||
hijack_netrw = mkOption {
|
hijack_netrw = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -47,6 +105,12 @@ in {
|
||||||
type = bool;
|
type = bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
disable_netrw = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "Disables netrw and replaces it with tree";
|
||||||
|
type = bool;
|
||||||
|
};
|
||||||
|
|
||||||
auto_reload_on_write = mkOption {
|
auto_reload_on_write = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Auto reload tree on write";
|
description = "Auto reload tree on write";
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
lspSignature = {
|
lspSignature = {
|
||||||
enable = mkEnableOption "lsp signature viewer";
|
enable = mkEnableOption "lsp signature viewer";
|
||||||
setupOpts = lib.nvim.types.mkPluginSetupOption "lsp-signature" {};
|
setupOpts = mkPluginSetupOption "lsp-signature" {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib) types mkRenamedOptionModule;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.types) enum int;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
imports = let
|
imports = let
|
||||||
renamedSetupOption = oldPath: newPath:
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
@ -18,9 +20,9 @@ in {
|
||||||
options.vim.lsp.nvim-docs-view = {
|
options.vim.lsp.nvim-docs-view = {
|
||||||
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
||||||
|
|
||||||
setupOpts = lib.nvim.types.mkPluginSetupOption "nvim-docs-view" {
|
setupOpts = mkPluginSetupOption "nvim-docs-view" {
|
||||||
position = mkOption {
|
position = mkOption {
|
||||||
type = types.enum ["left" "right" "top" "bottom"];
|
type = enum ["left" "right" "top" "bottom"];
|
||||||
default = "right";
|
default = "right";
|
||||||
description = ''
|
description = ''
|
||||||
Where to open the docs view panel
|
Where to open the docs view panel
|
||||||
|
@ -28,7 +30,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
height = mkOption {
|
height = mkOption {
|
||||||
type = types.int;
|
type = int;
|
||||||
default = 10;
|
default = 10;
|
||||||
description = ''
|
description = ''
|
||||||
Height of the docs view panel if the position is set to either top or bottom
|
Height of the docs view panel if the position is set to either top or bottom
|
||||||
|
@ -36,7 +38,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
width = mkOption {
|
width = mkOption {
|
||||||
type = types.int;
|
type = int;
|
||||||
default = 60;
|
default = 60;
|
||||||
description = ''
|
description = ''
|
||||||
Width of the docs view panel if the position is set to either left or right
|
Width of the docs view panel if the position is set to either left or right
|
||||||
|
@ -44,7 +46,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
update_mode = mkOption {
|
update_mode = mkOption {
|
||||||
type = types.enum ["auto" "manual"];
|
type = enum ["auto" "manual"];
|
||||||
default = "auto";
|
default = "auto";
|
||||||
description = ''
|
description = ''
|
||||||
Determines the mechanism used to update the docs view panel content.
|
Determines the mechanism used to update the docs view panel content.
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) bool str nullOr;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = let
|
imports = let
|
||||||
renamedSetupOption = oldPath: newPath:
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
@ -20,21 +23,21 @@ in {
|
||||||
obsidian = {
|
obsidian = {
|
||||||
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
|
||||||
|
|
||||||
setupOpts = lib.nvim.types.mkPluginSetupOption "Obsidian.nvim" {
|
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
|
||||||
dir = mkOption {
|
dir = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "~/my-vault";
|
default = "~/my-vault";
|
||||||
description = "Obsidian vault directory";
|
description = "Obsidian vault directory";
|
||||||
};
|
};
|
||||||
|
|
||||||
daily_notes = {
|
daily_notes = {
|
||||||
folder = mkOption {
|
folder = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Directory in which daily notes should be created";
|
description = "Directory in which daily notes should be created";
|
||||||
};
|
};
|
||||||
date_format = mkOption {
|
date_format = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Date format used for creating daily notes";
|
description = "Date format used for creating daily notes";
|
||||||
};
|
};
|
||||||
|
@ -43,7 +46,7 @@ in {
|
||||||
completion = {
|
completion = {
|
||||||
nvim_cmp = mkOption {
|
nvim_cmp = mkOption {
|
||||||
# if using nvim-cmp, otherwise set to false
|
# if using nvim-cmp, otherwise set to false
|
||||||
type = types.bool;
|
type = bool;
|
||||||
description = "If using nvim-cmp, otherwise set to false";
|
description = "If using nvim-cmp, otherwise set to false";
|
||||||
default = config.vim.autocomplete.type == "nvim-cmp";
|
default = config.vim.autocomplete.type == "nvim-cmp";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkMerge mkIf;
|
inherit (lib.modules) mkMerge mkIf;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkBinding;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) str listOf;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = let
|
imports = let
|
||||||
renamedSetupOption = oldPath: newPath:
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
@ -19,10 +22,10 @@ in {
|
||||||
options.vim.notes.todo-comments = {
|
options.vim.notes.todo-comments = {
|
||||||
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";
|
||||||
|
|
||||||
setupOpts = lib.nvim.types.mkPluginSetupOption "todo-comments.nvim" {
|
setupOpts = mkPluginSetupOption "todo-comments.nvim" {
|
||||||
highlight = {
|
highlight = {
|
||||||
pattern = mkOption {
|
pattern = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = ''.*<(KEYWORDS)(\([^\)]*\))?:'';
|
default = ''.*<(KEYWORDS)(\([^\)]*\))?:'';
|
||||||
description = "vim regex pattern used for highlighting comments";
|
description = "vim regex pattern used for highlighting comments";
|
||||||
};
|
};
|
||||||
|
@ -30,19 +33,19 @@ in {
|
||||||
|
|
||||||
search = {
|
search = {
|
||||||
pattern = mkOption {
|
pattern = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = ''\b(KEYWORDS)(\([^\)]*\))?:'';
|
default = ''\b(KEYWORDS)(\([^\)]*\))?:'';
|
||||||
description = "ripgrep regex pattern used for searching comments";
|
description = "ripgrep regex pattern used for searching comments";
|
||||||
};
|
};
|
||||||
|
|
||||||
command = mkOption {
|
command = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "${pkgs.ripgrep}/bin/rg";
|
default = "${pkgs.ripgrep}/bin/rg";
|
||||||
description = "search command";
|
description = "search command";
|
||||||
};
|
};
|
||||||
|
|
||||||
args = mkOption {
|
args = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = ["--color=never" "--no-heading" "--with-filename" "--line-number" "--column"];
|
default = ["--color=never" "--no-heading" "--with-filename" "--line-number" "--column"];
|
||||||
description = "arguments to pass to the search command";
|
description = "arguments to pass to the search command";
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf nvim;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.projects.project-nvim;
|
cfg = config.vim.projects.project-nvim;
|
||||||
in {
|
in {
|
||||||
|
@ -12,8 +14,8 @@ in {
|
||||||
"project-nvim"
|
"project-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.project-nvim = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.project-nvim = entryAnywhere ''
|
||||||
require('project_nvim').setup(${nvim.lua.toLuaObject cfg.setupOpts})
|
require('project_nvim').setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.types) bool listOf str enum;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = let
|
imports = let
|
||||||
renamedSetupOption = oldPath: newPath:
|
renamedSetupOption = oldPath: newPath:
|
||||||
|
@ -24,54 +27,54 @@ in {
|
||||||
options.vim.projects.project-nvim = {
|
options.vim.projects.project-nvim = {
|
||||||
enable = mkEnableOption "project-nvim for project management";
|
enable = mkEnableOption "project-nvim for project management";
|
||||||
|
|
||||||
setupOpts = lib.nvim.types.mkPluginSetupOption "Project.nvim" {
|
setupOpts = mkPluginSetupOption "Project.nvim" {
|
||||||
manual_mode = mkOption {
|
manual_mode = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
|
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
|
||||||
};
|
};
|
||||||
|
|
||||||
# detection methods should accept one or more strings from a list
|
# detection methods should accept one or more strings from a list
|
||||||
detection_methods = mkOption {
|
detection_methods = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = ["lsp" "pattern"];
|
default = ["lsp" "pattern"];
|
||||||
description = "Detection methods to use";
|
description = "Detection methods to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
# patterns
|
# patterns
|
||||||
patterns = mkOption {
|
patterns = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
|
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
|
||||||
description = "Patterns to use for pattern detection method";
|
description = "Patterns to use for pattern detection method";
|
||||||
};
|
};
|
||||||
|
|
||||||
# table of lsp servers to ignore by name
|
# table of lsp servers to ignore by name
|
||||||
lsp_ignored = mkOption {
|
lsp_ignored = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "LSP servers no ignore by name";
|
description = "LSP servers no ignore by name";
|
||||||
};
|
};
|
||||||
|
|
||||||
exclude_dirs = mkOption {
|
exclude_dirs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "Directories to exclude from project root search";
|
description = "Directories to exclude from project root search";
|
||||||
};
|
};
|
||||||
|
|
||||||
show_hidden = mkOption {
|
show_hidden = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Show hidden files in telescope picker";
|
description = "Show hidden files in telescope picker";
|
||||||
};
|
};
|
||||||
|
|
||||||
silent_chdir = mkOption {
|
silent_chdir = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Silently change directory when changing project";
|
description = "Silently change directory when changing project";
|
||||||
};
|
};
|
||||||
|
|
||||||
scope_chdir = mkOption {
|
scope_chdir = mkOption {
|
||||||
type = types.enum ["global" "tab" "win"];
|
type = enum ["global" "tab" "win"];
|
||||||
default = "global";
|
default = "global";
|
||||||
description = "What scope to change the directory";
|
description = "What scope to change the directory";
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
cfg = config.vim.spellcheck;
|
cfg = config.vim.spellcheck;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.vim-dirtytalk.enable {
|
config = mkIf (cfg.enable && cfg.programmingWordlist.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["vim-dirtytalk"];
|
startPlugins = ["vim-dirtytalk"];
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.modules) mkAliasOptionModule;
|
||||||
in {
|
in {
|
||||||
options.vim.spellcheck.vim-dirtytalk = {
|
imports = [
|
||||||
enable = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words";
|
(mkAliasOptionModule ["vim" "spellcheck" "vim-dirtytalk" "enable"] ["vim" "spellcheck" "programmingWordlist" "enable"])
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib.types) nullOr str enum bool package either int;
|
inherit (lib.types) nullOr str enum bool package either int;
|
||||||
inherit (lib) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
|
|
13
modules/wrapper/build/config.nix
Normal file
13
modules/wrapper/build/config.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.attrsets) attrValues;
|
||||||
|
|
||||||
|
cfg = config.vim;
|
||||||
|
in {
|
||||||
|
config = {
|
||||||
|
vim.startPlugins = map (x: x.package) (attrValues cfg.extraPlugins);
|
||||||
|
};
|
||||||
|
}
|
144
modules/wrapper/build/options.nix
Normal file
144
modules/wrapper/build/options.nix
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.types) package bool str listOf attrsOf;
|
||||||
|
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.neovim-unwrapped;
|
||||||
|
description = ''
|
||||||
|
The neovim package to use.
|
||||||
|
|
||||||
|
::: {.warning}
|
||||||
|
You will need to use an unwrapped package for this
|
||||||
|
option to work as intended.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
viAlias = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Enable the `vi` alias for `nvim`";
|
||||||
|
};
|
||||||
|
|
||||||
|
vimAlias = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Enable the `vim` alias for `nvim`";
|
||||||
|
};
|
||||||
|
|
||||||
|
startPlugins = pluginsOpt {
|
||||||
|
default = ["plenary-nvim"];
|
||||||
|
example = literalExpression ''
|
||||||
|
[pkgs.vimPlugins.telescope-nvim]
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
List of plugins to load on startup. This is used
|
||||||
|
internally to add plugins to Neovim's runtime.
|
||||||
|
|
||||||
|
To add additional plugins to your configuration, consider
|
||||||
|
using the [{option}`vim.extraPlugins`](#opt-vim.optPlugins)
|
||||||
|
option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
optPlugins = pluginsOpt {
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''
|
||||||
|
[pkgs.vimPlugins.vim-ghost]
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
List of plugins to optionally load on startup.
|
||||||
|
|
||||||
|
This option has the same type definition as {option}`vim.startPlugins`
|
||||||
|
and plugins in this list are appended to {option}`vim.startPlugins` by
|
||||||
|
the wrapper during the build process.
|
||||||
|
|
||||||
|
To avoid overriding packages and dependencies provided by startPlugins, you
|
||||||
|
are recommended to use this option or {option}`vim.extraPlugins` option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPlugins = mkOption {
|
||||||
|
type = attrsOf extraPluginType;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
A list of plugins and their configurations that will be
|
||||||
|
set up after builtin plugins.
|
||||||
|
|
||||||
|
This option takes a special type that allows you to order
|
||||||
|
your custom plugins using neovim-flake's modified DAG
|
||||||
|
library.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = literalExpression ''
|
||||||
|
with pkgs.vimPlugins; {
|
||||||
|
aerial = {
|
||||||
|
package = aerial-nvim;
|
||||||
|
setup = "require('aerial').setup {}";
|
||||||
|
};
|
||||||
|
|
||||||
|
harpoon = {
|
||||||
|
package = harpoon;
|
||||||
|
setup = "require('harpoon').setup {}";
|
||||||
|
after = ["aerial"]; # place harpoon configuration after aerial
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPackages = mkOption {
|
||||||
|
type = listOf package;
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''[pkgs.fzf pkgs.ripgrep]'';
|
||||||
|
description = ''
|
||||||
|
List of additional packages to make available to the Neovim
|
||||||
|
wrapper.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# this defaults to `true` in the wrapper
|
||||||
|
# and since we passs this value to the wrapper
|
||||||
|
# with an inherit, it should be `true` here as well
|
||||||
|
withRuby =
|
||||||
|
mkEnableOption ''
|
||||||
|
Ruby support in the Neovim wrapper.
|
||||||
|
''
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
withNodeJs = mkEnableOption ''
|
||||||
|
NodeJs support in the Neovim wrapper.
|
||||||
|
'';
|
||||||
|
|
||||||
|
luaPackages = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''["magick" "serpent"]'';
|
||||||
|
description = ''
|
||||||
|
List of lua packages to install.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
withPython3 = mkEnableOption ''
|
||||||
|
Python3 support in the Neovim wrapper.
|
||||||
|
'';
|
||||||
|
|
||||||
|
python3Packages = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''["pynvim"]'';
|
||||||
|
description = ''
|
||||||
|
List of python packages to install.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,14 +4,13 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map mapAttrs toJSON filter;
|
inherit (builtins) map mapAttrs toJSON filter;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames;
|
inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames;
|
||||||
inherit (lib.strings) optionalString isString concatStringsSep;
|
inherit (lib.strings) isString concatStringsSep;
|
||||||
inherit (lib.misc) mapAttrsFlatten;
|
inherit (lib.misc) mapAttrsFlatten;
|
||||||
inherit (lib.trivial) showWarnings;
|
inherit (lib.trivial) showWarnings;
|
||||||
inherit (lib.types) bool str oneOf attrsOf nullOr attrs submodule lines listOf either path;
|
inherit (lib.types) str nullOr;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.types) dagOf;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter topoSort mkLuarcSection mkVimrcSection;
|
inherit (lib.nvim.dag) entryAnywhere entryAfter topoSort mkLuarcSection mkVimrcSection;
|
||||||
inherit (lib.nvim.lua) toLuaObject wrapLuaConfig;
|
inherit (lib.nvim.lua) toLuaObject wrapLuaConfig;
|
||||||
inherit (lib.nvim.vim) valToVim;
|
inherit (lib.nvim.vim) valToVim;
|
||||||
|
@ -86,204 +85,7 @@
|
||||||
inherit mode;
|
inherit mode;
|
||||||
})
|
})
|
||||||
maps);
|
maps);
|
||||||
|
|
||||||
mapOption = submodule {
|
|
||||||
options =
|
|
||||||
mapConfigOptions
|
|
||||||
// {
|
|
||||||
action = mkOption {
|
|
||||||
type = str;
|
|
||||||
description = "The action to execute.";
|
|
||||||
};
|
|
||||||
|
|
||||||
lua = mkOption {
|
|
||||||
type = bool;
|
|
||||||
description = ''
|
|
||||||
If true, `action` is considered to be lua code.
|
|
||||||
Thus, it will not be wrapped in `""`.
|
|
||||||
'';
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mapOptions = mode:
|
|
||||||
mkOption {
|
|
||||||
description = "Mappings for ${mode} mode";
|
|
||||||
type = attrsOf mapOption;
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
options = {
|
|
||||||
vim = {
|
|
||||||
enableLuaLoader = mkEnableOption ''
|
|
||||||
the experimental Lua module loader to speed up the start up process
|
|
||||||
'';
|
|
||||||
|
|
||||||
additionalRuntimePaths = mkOption {
|
|
||||||
type = listOf (either path str);
|
|
||||||
default = [];
|
|
||||||
example = literalExpression ''
|
|
||||||
[
|
|
||||||
"~/.config/nvim-extra" # absolute path, as a string - impure
|
|
||||||
./nvim # relative path, as a path - pure
|
|
||||||
]
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
Additional runtime paths that will be appended to the
|
|
||||||
active runtimepath of the Neovim. This can be used to
|
|
||||||
add additional lookup paths for configs, plugins, spell
|
|
||||||
languages and other things you would generally place in
|
|
||||||
your `$HOME/.config/nvim`.
|
|
||||||
|
|
||||||
This is meant as a declarative alternative to throwing
|
|
||||||
files into `~/.config/nvim` and having the Neovim
|
|
||||||
wrapper pick them up. For more details on
|
|
||||||
`vim.o.runtimepath`, and what paths to use; please see
|
|
||||||
[the official documentation](https://neovim.io/doc/user/options.html#'runtimepath')
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
globals = mkOption {
|
|
||||||
default = {};
|
|
||||||
type = attrs;
|
|
||||||
description = "Set containing global variable values";
|
|
||||||
};
|
|
||||||
|
|
||||||
maps = mkOption {
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
normal = mapOptions "normal";
|
|
||||||
insert = mapOptions "insert";
|
|
||||||
select = mapOptions "select";
|
|
||||||
visual = mapOptions "visual and select";
|
|
||||||
terminal = mapOptions "terminal";
|
|
||||||
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
|
|
||||||
|
|
||||||
visualOnly = mapOptions "visual only";
|
|
||||||
operator = mapOptions "operator-pending";
|
|
||||||
insertCommand = mapOptions "insert and command-line";
|
|
||||||
lang = mapOptions "insert, command-line and lang-arg";
|
|
||||||
command = mapOptions "command-line";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
default = {};
|
|
||||||
description = ''
|
|
||||||
Custom keybindings for any mode.
|
|
||||||
|
|
||||||
For plain maps (e.g. just 'map' or 'remap') use `maps.normalVisualOp`.
|
|
||||||
'';
|
|
||||||
|
|
||||||
example = ''
|
|
||||||
maps = {
|
|
||||||
normal."<leader>m" = {
|
|
||||||
silent = true;
|
|
||||||
action = "<cmd>make<CR>";
|
|
||||||
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
configRC = mkOption {
|
|
||||||
type = oneOf [(dagOf lines) str];
|
|
||||||
default = {};
|
|
||||||
description = ''
|
|
||||||
Contents of vimrc, either as a string or a DAG.
|
|
||||||
|
|
||||||
If this option is passed as a DAG, it will be resolved
|
|
||||||
according to the DAG resolution rules (e.g. entryBefore
|
|
||||||
or entryAfter) as per the neovim-flake library.
|
|
||||||
'';
|
|
||||||
|
|
||||||
example = literalMD ''
|
|
||||||
```vim
|
|
||||||
" Set the tab size to 4 spaces
|
|
||||||
set tabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set expandtab
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
luaConfigPre = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = let
|
|
||||||
additionalRuntimePaths = concatStringsSep "," cfg.additionalRuntimePaths;
|
|
||||||
in ''
|
|
||||||
${optionalString (cfg.additionalRuntimePaths != []) ''
|
|
||||||
if not vim.o.runtimepath:find('${additionalRuntimePaths}', 1, true) then
|
|
||||||
vim.o.runtimepath = vim.o.runtimepath .. ',' .. '${additionalRuntimePaths}'
|
|
||||||
end
|
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
|
||||||
'';
|
|
||||||
|
|
||||||
defaultText = literalMD ''
|
|
||||||
By default, this option will **append** paths in
|
|
||||||
[vim.additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
|
|
||||||
to the `runtimepath` and enable the experimental Lua module loader
|
|
||||||
if [vim.enableLuaLoader](#opt-vim.enableLuaLoader) is set to true.
|
|
||||||
'';
|
|
||||||
|
|
||||||
description = ''
|
|
||||||
Verbatim lua code that will be inserted **before**
|
|
||||||
the result of `luaConfigRc` DAG has been resolved.
|
|
||||||
|
|
||||||
This option **does not** take a DAG set, but a string
|
|
||||||
instead. Useful when you'd like to insert contents
|
|
||||||
of lua configs after the DAG result.
|
|
||||||
|
|
||||||
::: {.warning}
|
|
||||||
You do not want to override this option. It is used
|
|
||||||
internally to set certain options as early as possible
|
|
||||||
and should be avoided unless you know what you're doing.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
luaConfigRC = mkOption {
|
|
||||||
type = oneOf [(dagOf lines) str];
|
|
||||||
default = {};
|
|
||||||
description = ''
|
|
||||||
Lua configuration, either as a string or a DAG.
|
|
||||||
|
|
||||||
If this option is passed as a DAG, it will be resolved
|
|
||||||
according to the DAG resolution rules (e.g. entryBefore
|
|
||||||
or entryAfter) as per the neovim-flake library.
|
|
||||||
'';
|
|
||||||
|
|
||||||
example = literalMD ''
|
|
||||||
```lua
|
|
||||||
-- Set the tab size to 4 spaces
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
vim.opt.expandtab = true
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
luaConfigPost = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "";
|
|
||||||
description = ''
|
|
||||||
Verbatim lua code that will be inserted after
|
|
||||||
the result of the `luaConfigRc` DAG has been resolved
|
|
||||||
|
|
||||||
This option **does not** take a DAG set, but a string
|
|
||||||
instead. Useful when you'd like to insert contents
|
|
||||||
of lua configs after the DAG result.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
builtConfigRC = mkOption {
|
|
||||||
internal = true;
|
|
||||||
type = lines;
|
|
||||||
description = "The built config for neovim after resolving the DAG";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = let
|
config = let
|
||||||
filterNonNull = mappings: filterAttrs (_name: value: value != null) mappings;
|
filterNonNull = mappings: filterAttrs (_name: value: value != null) mappings;
|
||||||
globalsScript =
|
globalsScript =
|
||||||
|
@ -328,7 +130,6 @@ in {
|
||||||
result;
|
result;
|
||||||
in {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = map (x: x.package) (attrValues cfg.extraPlugins);
|
|
||||||
configRC = {
|
configRC = {
|
||||||
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript);
|
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript);
|
||||||
|
|
6
modules/wrapper/rc/default.nix
Normal file
6
modules/wrapper/rc/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./options.nix
|
||||||
|
];
|
||||||
|
}
|
203
modules/wrapper/rc/options.nix
Normal file
203
modules/wrapper/rc/options.nix
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.types) str oneOf attrs lines listOf either path bool;
|
||||||
|
inherit (lib.nvim.types) dagOf;
|
||||||
|
inherit (lib.nvim.lua) listToLuaTable;
|
||||||
|
cfg = config.vim;
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
enableLuaLoader = mkEnableOption ''
|
||||||
|
the experimental Lua module loader to speed up the start up process
|
||||||
|
|
||||||
|
If `true`, this will enable the experimental Lua module loader which:
|
||||||
|
- overrides loadfile
|
||||||
|
- adds the lua loader using the byte-compilation cache
|
||||||
|
- adds the libs loader
|
||||||
|
- removes the default Neovim loader
|
||||||
|
|
||||||
|
This is disabled by default. Before setting this option, please
|
||||||
|
take a look at the [{option}`official documentation`](https://neovim.io/doc/user/lua.html#vim.loader.enable()).
|
||||||
|
'';
|
||||||
|
|
||||||
|
disableDefaultRuntimePaths = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
example = false;
|
||||||
|
description = ''
|
||||||
|
Disables the default runtime paths that are set by Neovim
|
||||||
|
when it starts up. This is useful when you want to have
|
||||||
|
full control over the runtime paths that are set by Neovim.
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
To avoid leaking imperative user configuration into your
|
||||||
|
configuration, this is enabled by default. If you wish
|
||||||
|
to load configuration from user configuration directories
|
||||||
|
(e.g. `$HOME/.config/nvim`, `$HOME/.config/nvim/after`
|
||||||
|
and `$HOME/.local/share/nvim/site`) you may set this
|
||||||
|
option to true.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
additionalRuntimePaths = mkOption {
|
||||||
|
type = listOf (either path str);
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''
|
||||||
|
[
|
||||||
|
"$HOME/.config/nvim-extra" # absolute path, as a string - impure
|
||||||
|
./nvim # relative path, as a path - pure
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Additional runtime paths that will be appended to the
|
||||||
|
active runtimepath of the Neovim. This can be used to
|
||||||
|
add additional lookup paths for configs, plugins, spell
|
||||||
|
languages and other things you would generally place in
|
||||||
|
your `$HOME/.config/nvim`.
|
||||||
|
|
||||||
|
This is meant as a declarative alternative to throwing
|
||||||
|
files into `~/.config/nvim` and having the Neovim
|
||||||
|
wrapper pick them up. For more details on
|
||||||
|
`vim.o.runtimepath`, and what paths to use; please see
|
||||||
|
[the official documentation](https://neovim.io/doc/user/options.html#'runtimepath')
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
globals = mkOption {
|
||||||
|
type = attrs;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
An attribute set containing global variable values
|
||||||
|
for storing vim variables as early as possible. If
|
||||||
|
populated, this soption will set vim variables in the
|
||||||
|
built configRC as the first item.
|
||||||
|
|
||||||
|
E.g. {foo = "bar"} will set `g:foo` to "bar" where
|
||||||
|
the type of `bar` in the resulting vimscript will be
|
||||||
|
infered from the type of the value in the `{name = value}`
|
||||||
|
pair.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
configRC = mkOption {
|
||||||
|
type = oneOf [(dagOf lines) str];
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Contents of vimrc, either as a string or a DAG.
|
||||||
|
|
||||||
|
If this option is passed as a DAG, it will be resolved
|
||||||
|
according to the DAG resolution rules (e.g. entryBefore
|
||||||
|
or entryAfter) as per the neovim-flake library.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = literalMD ''
|
||||||
|
```vim
|
||||||
|
" Set the tab size to 4 spaces
|
||||||
|
set tabstop=4
|
||||||
|
set shiftwidth=4
|
||||||
|
set expandtab
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
luaConfigPre = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = ''
|
||||||
|
${optionalString (cfg.additionalRuntimePaths != []) ''
|
||||||
|
-- The following list is generated from `vim.additionalRuntimePaths`
|
||||||
|
-- and is used to append additional runtime paths to the
|
||||||
|
-- `runtimepath` option.
|
||||||
|
local additionalRuntimePaths = ${listToLuaTable cfg.additionalRuntimePaths};
|
||||||
|
|
||||||
|
for _, path in ipairs(additionalRuntimePaths) do
|
||||||
|
vim.opt.runtimepath:append(path)
|
||||||
|
end
|
||||||
|
''}
|
||||||
|
|
||||||
|
${optionalString cfg.disableDefaultRuntimePaths ''
|
||||||
|
-- Remove default user runtime paths from the
|
||||||
|
-- `runtimepath` option to avoid leaking user configuration
|
||||||
|
-- into the final neovim wrapper
|
||||||
|
vim.opt.runtimepath:remove(vim.fn.stdpath('config')) -- $HOME/.config/nvim
|
||||||
|
vim.opt.runtimepath:remove(vim.fn.stdpath('config') .. "/after") -- $HOME/.config/nvim/after
|
||||||
|
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- $HOME/.local/share/nvim/site
|
||||||
|
''}
|
||||||
|
|
||||||
|
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
||||||
|
'';
|
||||||
|
|
||||||
|
defaultText = literalMD ''
|
||||||
|
By default, this option will **append** paths in
|
||||||
|
[vim.additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
|
||||||
|
to the `runtimepath` and enable the experimental Lua module loader
|
||||||
|
if [vim.enableLuaLoader](#opt-vim.enableLuaLoader) is set to true.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = literalExpression ''"$${builtins.readFile ./my-lua-config-pre.lua}"'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Verbatim lua code that will be inserted **before**
|
||||||
|
the result of `luaConfigRc` DAG has been resolved.
|
||||||
|
|
||||||
|
This option **does not** take a DAG set, but a string
|
||||||
|
instead. Useful when you'd like to insert contents
|
||||||
|
of lua configs after the DAG result.
|
||||||
|
|
||||||
|
::: {.warning}
|
||||||
|
You do not want to override this option with mkForce
|
||||||
|
It is used internally to set certain options as early
|
||||||
|
as possible and should be avoided unless you know what
|
||||||
|
you're doing. Passing a string to this option will
|
||||||
|
merge it with the default contents.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
luaConfigRC = mkOption {
|
||||||
|
type = oneOf [(dagOf lines) str];
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Lua configuration, either as a string or a DAG.
|
||||||
|
|
||||||
|
If this option is passed as a DAG, it will be resolved
|
||||||
|
according to the DAG resolution rules (e.g. entryBefore
|
||||||
|
or entryAfter) as per the neovim-flake library.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = literalMD ''
|
||||||
|
```lua
|
||||||
|
-- Set the tab size to 4 spaces
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
luaConfigPost = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
example = literalExpression ''"$${builtins.readFile ./my-lua-config-post.lua}"'';
|
||||||
|
description = ''
|
||||||
|
Verbatim lua code that will be inserted **after**
|
||||||
|
the result of the `luaConfigRc` DAG has been resolved
|
||||||
|
|
||||||
|
This option **does not** take a DAG set, but a string
|
||||||
|
instead. Useful when you'd like to insert contents
|
||||||
|
of lua configs after the DAG result.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
builtConfigRC = mkOption {
|
||||||
|
internal = true;
|
||||||
|
type = lines;
|
||||||
|
description = "The built config for neovim after resolving the DAG";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue