mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 04:18:03 +00:00
Compare commits
28 commits
c1c6d3b4cd
...
86f594a1ce
Author | SHA1 | Date | |
---|---|---|---|
![]() |
86f594a1ce | ||
![]() |
887144f896 | ||
![]() |
d5b5c5294c | ||
![]() |
9a56cc3b8f | ||
![]() |
e6df7c6aa7 | ||
![]() |
2f281cf07a | ||
![]() |
9a47b6f83d | ||
![]() |
a17b1e0fa7 | ||
![]() |
e764f1fdf5 | ||
![]() |
ebc5426b78 | ||
![]() |
fcf185fd23 | ||
![]() |
beb9d99e24 | ||
![]() |
8cbe4ac3a8 | ||
![]() |
40984ca347 | ||
![]() |
34ffdaedcd | ||
![]() |
74f7367355 | ||
![]() |
e177e5f1c3 | ||
![]() |
ae5d39227c | ||
![]() |
ea0ee39687 | ||
![]() |
6ede63c170 | ||
![]() |
7a8b95cf7c | ||
![]() |
b637f921d5 | ||
649f5513f9 | |||
18ae3e1f6c | |||
614ad33a60 | |||
fdd0642c7d | |||
379d2a9f16 | |||
![]() |
f01e404b2e |
28 changed files with 810 additions and 478 deletions
74
.github/pull_request_template.md
vendored
74
.github/pull_request_template.md
vendored
|
@ -1,39 +1,57 @@
|
||||||
# Description
|
<!--
|
||||||
|
^ Please include a clear and concise description of the aim of your Pull Request above this line ^
|
||||||
|
|
||||||
A clear and concise description of the aim of your Pull Request.
|
For plugin dependency/module additions, please make sure to link the source link of the added plugin
|
||||||
|
or dependency in this section.
|
||||||
|
|
||||||
**If your pull request aims to fix an open issue or a present bug, please link the relevant issue below. If not, please remove this section**
|
If your pull request aims to fix an open issue or a please bug, please also link the relevant issue
|
||||||
Fixes #(issue)
|
below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside
|
||||||
|
this comment.
|
||||||
|
-->
|
||||||
|
|
||||||
## Type of change
|
## Sanity Checking
|
||||||
|
|
||||||
Please delete any options that are not relevant.
|
<!--
|
||||||
|
Please check all that apply. As before, this section is not a hard requirement but checklists with more checked
|
||||||
|
items are likely to be merged faster. You may save some time in maintainer review by performing self-reviews here
|
||||||
|
before submitting your pull request.
|
||||||
|
|
||||||
- Bug fix (non-breaking change which fixes an issue)
|
If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include
|
||||||
- New feature (non-breaking change which adds functionality)
|
it above in your description.
|
||||||
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
-->
|
||||||
- Translation/Language update
|
|
||||||
- Docs
|
|
||||||
- Other
|
|
||||||
|
|
||||||
## Checklist
|
[editorconfig]: https://editorconfig.org
|
||||||
|
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
|
||||||
|
|
||||||
Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis.
|
- [ ] I have updated the [changelog] as per my changes.
|
||||||
|
- [ ] I have tested, and self-reviewed my code.
|
||||||
|
- Style and consistency
|
||||||
|
- [ ] I ran **Alejandra** to format my code (`nix fmt`).
|
||||||
|
- [ ] My code conforms to the [editorconfig] configuration of the project.
|
||||||
|
- [ ] My changes are consistent with the rest of the codebase.
|
||||||
|
- If new changes are particularly complex:
|
||||||
|
- [ ] My code includes comments in particularly complex areas
|
||||||
|
- [ ] I have added a section in the manual.
|
||||||
|
- [ ] _(For breaking changes)_ I have included a migration guide.
|
||||||
|
- Package(s) built:
|
||||||
|
- [ ] `.#nix` (default package)
|
||||||
|
- [ ] `.#maximal`
|
||||||
|
- [ ] `.#docs-html`
|
||||||
|
- Tested on platform(s)
|
||||||
|
- [ ] `x86_64-linux`
|
||||||
|
- [ ] `aarch64-linux`
|
||||||
|
- [ ] `x86_64-darwin`
|
||||||
|
- [ ] `aarch64-darwin`
|
||||||
|
|
||||||
- [ ] My code follows the style and contributing guidelines of this project.
|
<!--
|
||||||
- [ ] I ran Alejandra to format my code (`nix fmt`).
|
If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult
|
||||||
- [ ] I have performed a self-review of my own code and tested it.
|
the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas.
|
efforts in the long run.
|
||||||
- [ ] My changes generate no new warnings.
|
-->
|
||||||
- [ ] This change requires a documentation update.
|
|
||||||
- [ ] I have updated the documentation accordingly.
|
|
||||||
|
|
||||||
## Screenshots & Logs
|
---
|
||||||
|
|
||||||
You are kindly requested to attach screenshots of your changes in actions and preferably your build/run logs for all available packages. If you are not sure how to do this, you can refer to the [documentation](https://notashelf.github.io/neovim-flake/).
|
Add a :+1: [reaction] to [pull requests you find important].
|
||||||
|
|
||||||
**Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.**
|
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||||
|
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
|
||||||
```console
|
|
||||||
# Paste your logs here
|
|
||||||
```
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ configuration formats.
|
||||||
|
|
||||||
### `vim.maps` rewrite {#sec-vim-maps-rewrite}
|
### `vim.maps` rewrite {#sec-vim-maps-rewrite}
|
||||||
|
|
||||||
Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new
|
Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new `vim.keymaps`
|
||||||
`mode` option has mode has been introduced. It can be either a string, or a list
|
submodule with support for a `mode` option has been introduced. It can be either a string, or a
|
||||||
of strings, where a string represents the short-name of the map mode(s), that
|
list of strings, where a string represents the short-name of the map mode(s), that the mapping
|
||||||
the mapping should be set for. See `:help map-modes` for more information.
|
should be set for. See `:help map-modes` for more information.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
@ -42,10 +42,13 @@ vim.maps.normal."<leader>m" = { ... };
|
||||||
has to be replaced by
|
has to be replaced by
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
vim.maps."<leader>m" = {
|
vim.keymaps = [
|
||||||
mode = "n";
|
{
|
||||||
|
key = "<leader>m";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
...
|
...
|
||||||
};
|
];
|
||||||
```
|
```
|
||||||
|
|
||||||
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
||||||
|
@ -112,7 +115,8 @@ everyone.
|
||||||
- Add [new-file-template.nvim] to automatically fill new file contents using
|
- Add [new-file-template.nvim] to automatically fill new file contents using
|
||||||
templates
|
templates
|
||||||
|
|
||||||
- Make [neo-tree.nvim] display file icons properly by enabling `visuals.nvimWebDevicons`
|
- Make [neo-tree.nvim] display file icons properly by enabling
|
||||||
|
`visuals.nvimWebDevicons`
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
@ -146,6 +150,8 @@ everyone.
|
||||||
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
||||||
breaking changes section above for more details
|
breaking changes section above for more details
|
||||||
|
|
||||||
|
- Add a `setupOpts` option to nvim-surround, which allows modifying options that aren't defined in nvf. Move the alternate nvim-surround keybinds to use `setupOpts`.
|
||||||
|
|
||||||
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
||||||
|
|
||||||
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
||||||
|
@ -231,13 +237,15 @@ everyone.
|
||||||
- Fixed `project-nvim` command and keybinding
|
- Fixed `project-nvim` command and keybinding
|
||||||
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
||||||
|
|
||||||
[Soliprem](https://github.com/Soliprem)
|
[Soliprem](https://github.com/Soliprem):
|
||||||
|
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
ccc
|
ccc
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
|
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
|
||||||
`vim.theme`
|
`vim.theme`
|
||||||
|
- Fix internal breakage in `elixir-tools` setup.
|
||||||
|
|
||||||
|
|
41
flake.lock
generated
41
flake.lock
generated
|
@ -207,11 +207,11 @@
|
||||||
"plugin-catppuccin": {
|
"plugin-catppuccin": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1716704960,
|
"lastModified": 1728131011,
|
||||||
"narHash": "sha256-UDPS+1o8FQGkfqiG4GX4DNUI2pU5hIvagmfnWTKDb44=",
|
"narHash": "sha256-j6F078taxuGzr3jngrc+Pc5I1kDdxTLMETgq6Xn4w/4=",
|
||||||
"owner": "catppuccin",
|
"owner": "catppuccin",
|
||||||
"repo": "nvim",
|
"repo": "nvim",
|
||||||
"rev": "5215ea59df6d0a7e27da9a5cd1165e06d1b04cbe",
|
"rev": "7be452ee067978cdc8b2c5f3411f0c71ffa612b9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -828,6 +828,39 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-lz-n": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727574854,
|
||||||
|
"narHash": "sha256-qDWNleR2NHFkiEKE/+LNVOBRwEeskMC4dWTl5BTyZuE=",
|
||||||
|
"owner": "nvim-neorocks",
|
||||||
|
"repo": "lz.n",
|
||||||
|
"rev": "470173e3cbef763c6d1b918f3f129b67db75e1f8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorocks",
|
||||||
|
"repo": "lz.n",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugin-lzn-auto-require": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727636949,
|
||||||
|
"narHash": "sha256-BAOzN+XOrFAJwHmsF8JtZ2EyjP9283FD/I2TbFqGSEw=",
|
||||||
|
"owner": "horriblename",
|
||||||
|
"repo": "lzn-auto-require",
|
||||||
|
"rev": "55ecd60831dac8c01d6f3dcb63a30a63a1690eb8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "horriblename",
|
||||||
|
"ref": "require-rewrite",
|
||||||
|
"repo": "lzn-auto-require",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-mind-nvim": {
|
"plugin-mind-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1859,6 +1892,8 @@
|
||||||
"plugin-lspkind": "plugin-lspkind",
|
"plugin-lspkind": "plugin-lspkind",
|
||||||
"plugin-lspsaga": "plugin-lspsaga",
|
"plugin-lspsaga": "plugin-lspsaga",
|
||||||
"plugin-lualine": "plugin-lualine",
|
"plugin-lualine": "plugin-lualine",
|
||||||
|
"plugin-lz-n": "plugin-lz-n",
|
||||||
|
"plugin-lzn-auto-require": "plugin-lzn-auto-require",
|
||||||
"plugin-mind-nvim": "plugin-mind-nvim",
|
"plugin-mind-nvim": "plugin-mind-nvim",
|
||||||
"plugin-minimap-vim": "plugin-minimap-vim",
|
"plugin-minimap-vim": "plugin-minimap-vim",
|
||||||
"plugin-modes-nvim": "plugin-modes-nvim",
|
"plugin-modes-nvim": "plugin-modes-nvim",
|
||||||
|
|
11
flake.nix
11
flake.nix
|
@ -113,6 +113,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
# Lazy loading
|
||||||
|
plugin-lz-n = {
|
||||||
|
url = "github:nvim-neorocks/lz.n";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-lzn-auto-require = {
|
||||||
|
url = "github:horriblename/lzn-auto-require/require-rewrite";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# LSP plugins
|
# LSP plugins
|
||||||
plugin-nvim-lspconfig = {
|
plugin-nvim-lspconfig = {
|
||||||
url = "github:neovim/nvim-lspconfig";
|
url = "github:neovim/nvim-lspconfig";
|
||||||
|
|
|
@ -67,6 +67,23 @@
|
||||||
mkLuaBinding binding.value action binding.description;
|
mkLuaBinding binding.value action binding.description;
|
||||||
|
|
||||||
pushDownDefault = attr: mapAttrs (_: mkDefault) attr;
|
pushDownDefault = attr: mapAttrs (_: mkDefault) attr;
|
||||||
|
|
||||||
|
mkLznBinding = mode: key: action: desc: {
|
||||||
|
inherit mode desc key action;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkSetLznBinding = binding: action: {
|
||||||
|
inherit action;
|
||||||
|
key = binding.value;
|
||||||
|
desc = binding.description;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkSetLuaLznBinding = binding: action: {
|
||||||
|
inherit action;
|
||||||
|
key = binding.value;
|
||||||
|
lua = true;
|
||||||
|
desc = binding.description;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
binds
|
binds
|
||||||
|
|
|
@ -84,10 +84,7 @@
|
||||||
|
|
||||||
# built (or "normalized") plugins that are modified
|
# built (or "normalized") plugins that are modified
|
||||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||||
builtOptPlugins = map (package: {
|
builtOptPlugins = map (package: package // {optional = true;}) (buildConfigPlugins vimOptions.optPlugins);
|
||||||
plugin = package;
|
|
||||||
optional = true;
|
|
||||||
}) (buildConfigPlugins vimOptions.optPlugins);
|
|
||||||
|
|
||||||
# additional Lua and Python3 packages, mapped to their respective functions
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
# to conform to the format mnw expects. end user should
|
# to conform to the format mnw expects. end user should
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
"build"
|
"build"
|
||||||
"rc"
|
"rc"
|
||||||
"warnings"
|
"warnings"
|
||||||
|
"lazy"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Extra modules, such as deprecation warnings
|
# Extra modules, such as deprecation warnings
|
||||||
|
|
|
@ -3,32 +3,75 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.trivial) pipe;
|
||||||
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
|
inherit (lib.lists) flatten;
|
||||||
|
|
||||||
|
legacyMapModes = {
|
||||||
|
normal = ["n"];
|
||||||
|
insert = ["i"];
|
||||||
|
select = ["s"];
|
||||||
|
visual = ["v"];
|
||||||
|
terminal = ["t"];
|
||||||
|
normalVisualOp = ["n" "v" "o"];
|
||||||
|
visualOnly = ["n" "x"];
|
||||||
|
operator = ["o"];
|
||||||
|
insertCommand = ["i" "c"];
|
||||||
|
lang = ["l"];
|
||||||
|
command = ["c"];
|
||||||
|
};
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
config = {
|
config = {
|
||||||
vim.maps = mkIf cfg.disableArrows {
|
vim.keymaps = mkMerge [
|
||||||
"<up>" = {
|
(
|
||||||
mode = ["n" "i"];
|
mkIf cfg.disableArrows [
|
||||||
action = "<nop>";
|
{
|
||||||
noremap = false;
|
key = "<up>";
|
||||||
};
|
mode = ["n" "i"];
|
||||||
"<down>" = {
|
action = "<nop>";
|
||||||
mode = ["n" "i"];
|
noremap = false;
|
||||||
action = "<nop>";
|
}
|
||||||
noremap = false;
|
{
|
||||||
};
|
key = "<down>";
|
||||||
"<left>" = {
|
mode = ["n" "i"];
|
||||||
mode = ["n" "i"];
|
action = "<nop>";
|
||||||
action = "<nop>";
|
noremap = false;
|
||||||
noremap = false;
|
}
|
||||||
};
|
{
|
||||||
"<right>" = {
|
key = "<left>";
|
||||||
mode = ["n" "i"];
|
mode = ["n" "i"];
|
||||||
action = "<nop>";
|
action = "<nop>";
|
||||||
noremap = false;
|
noremap = false;
|
||||||
};
|
}
|
||||||
};
|
{
|
||||||
|
key = "<right>";
|
||||||
|
mode = ["n" "i"];
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
(
|
||||||
|
pipe cfg.maps
|
||||||
|
[
|
||||||
|
(mapAttrsToList (
|
||||||
|
oldMode: keybinds:
|
||||||
|
mapAttrsToList (
|
||||||
|
key: bind:
|
||||||
|
bind
|
||||||
|
// {
|
||||||
|
inherit key;
|
||||||
|
mode = legacyMapModes.${oldMode};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
keybinds
|
||||||
|
))
|
||||||
|
flatten
|
||||||
|
]
|
||||||
|
)
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) either str listOf attrsOf nullOr submodule bool;
|
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
mapConfigOptions = {
|
mapConfigOptions = {
|
||||||
|
@ -31,6 +31,10 @@
|
||||||
options =
|
options =
|
||||||
mapConfigOptions
|
mapConfigOptions
|
||||||
// {
|
// {
|
||||||
|
key = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "The key that triggers this keybind.";
|
||||||
|
};
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = either str (listOf str);
|
type = either str (listOf str);
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -38,52 +42,56 @@
|
||||||
|
|
||||||
See `:help map-modes` for a list of modes.
|
See `:help map-modes` for a list of modes.
|
||||||
'';
|
'';
|
||||||
|
example = ''`["n" "v" "c"]` for normal, visual and command mode'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# legacy stuff
|
legacyMapOption = mode:
|
||||||
mapOption = submodule {
|
|
||||||
options = mapConfigOptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
mapOptions = mode:
|
|
||||||
mkOption {
|
mkOption {
|
||||||
description = "Mappings for ${mode} mode";
|
description = "Mappings for ${mode} mode";
|
||||||
type = attrsOf mapOption;
|
type = attrsOf (submodule {
|
||||||
|
options = mapConfigOptions;
|
||||||
|
});
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim = {
|
||||||
maps = mkOption {
|
keymaps = mkOption {
|
||||||
type = submodule {
|
type = listOf mapType;
|
||||||
freeformType = attrsOf mapType;
|
|
||||||
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.";
|
description = "Custom keybindings.";
|
||||||
example = ''
|
example = ''
|
||||||
maps = {
|
vim.keymaps = [
|
||||||
"<leader>m" = {
|
{
|
||||||
|
key = "<leader>m";
|
||||||
mode = "n";
|
mode = "n";
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>make<CR>";
|
action = ":make<CR>";
|
||||||
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
}
|
||||||
};
|
{
|
||||||
|
key = "<leader>l";
|
||||||
|
mode = ["n" "x"];
|
||||||
|
silent = true;
|
||||||
|
action = "<cmd>cnext<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
'';
|
'';
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
maps = {
|
||||||
|
normal = legacyMapOption "normal";
|
||||||
|
insert = legacyMapOption "insert";
|
||||||
|
select = legacyMapOption "select";
|
||||||
|
visual = legacyMapOption "visual and select";
|
||||||
|
terminal = legacyMapOption "terminal";
|
||||||
|
normalVisualOp = legacyMapOption "normal, visual, select and operator-pending (same as plain 'map')";
|
||||||
|
|
||||||
|
visualOnly = legacyMapOption "visual only";
|
||||||
|
operator = legacyMapOption "operator-pending";
|
||||||
|
insertCommand = legacyMapOption "insert and command-line";
|
||||||
|
lang = legacyMapOption "insert, command-line and lang-arg";
|
||||||
|
command = legacyMapOption "command-line";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding mkSetLuaLznBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
||||||
|
|
||||||
cfg = config.vim.debugger.nvim-dap;
|
cfg = config.vim.debugger.nvim-dap;
|
||||||
|
@ -49,24 +49,33 @@ in {
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
(mkIf (cfg.enable && cfg.ui.enable) {
|
(mkIf (cfg.enable && cfg.ui.enable) {
|
||||||
vim.startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
vim.startPlugins = ["nvim-nio"];
|
||||||
|
|
||||||
vim.pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
vim.lazy.plugins = [
|
||||||
local dapui = require("dapui")
|
{
|
||||||
dapui.setup()
|
package = "nvim-dap-ui";
|
||||||
''
|
setupModule = "dapui";
|
||||||
+ optionalString cfg.ui.autoStart ''
|
setupOpts = {};
|
||||||
|
|
||||||
|
keys = [
|
||||||
|
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
vim.pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (
|
||||||
|
optionalString cfg.ui.autoStart ''
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
dapui.open()
|
require("dapui").open()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
dapui.close()
|
require("dapui").close()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
dapui.close()
|
require("dapui").close()
|
||||||
end
|
end
|
||||||
'');
|
''
|
||||||
vim.maps.normal = mkSetLuaBinding mappings.toggleDapUI "require('dapui').toggle";
|
);
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkLznBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
|
||||||
inherit (lib.nvim.binds) pushDownDefault;
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
|
||||||
cfg = config.vim.filetree.nvimTree;
|
cfg = config.vim.filetree.nvimTree;
|
||||||
|
@ -16,19 +15,25 @@
|
||||||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-tree-lua"];
|
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
|
||||||
(mkBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
|
||||||
(mkBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
|
||||||
(mkBinding cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
|
||||||
(mkBinding cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
vim.binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>t" = "+NvimTree";
|
"<leader>t" = "+NvimTree";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vim.lazy.plugins = [
|
||||||
|
{
|
||||||
|
package = "nvim-tree-lua";
|
||||||
|
setupModule = "nvim-tree";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||||
|
keys = [
|
||||||
|
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||||
|
(mkLznBinding ["n"] cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||||
|
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||||
|
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
||||||
${
|
${
|
||||||
optionalString cfg.setupOpts.disable_netrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
|
@ -38,10 +43,9 @@ in {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
require'nvim-tree'.setup(${toLuaObject cfg.setupOpts})
|
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString cfg.openOnSetup ''
|
optionalString cfg.openOnSetup ''
|
||||||
|
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
||||||
-- autostart behaviour
|
-- autostart behaviour
|
||||||
-- Open on startup has been deprecated
|
-- Open on startup has been deprecated
|
||||||
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
||||||
|
|
|
@ -114,12 +114,12 @@ in {
|
||||||
(mkIf cfg.elixir-tools.enable {
|
(mkIf cfg.elixir-tools.enable {
|
||||||
vim.startPlugins = ["elixir-tools"];
|
vim.startPlugins = ["elixir-tools"];
|
||||||
vim.pluginRC.elixir-tools = entryAnywhere ''
|
vim.pluginRC.elixir-tools = entryAnywhere ''
|
||||||
local elixir-tools = require("elixir")
|
local elixir = require("elixir")
|
||||||
local elixirls = require("elixir-tools.elixirls")
|
local elixirls = require("elixir.elixirls")
|
||||||
|
|
||||||
-- disable imperative insstallations of various
|
-- disable imperative insstallations of various
|
||||||
-- elixir related tools installed by elixir-tools
|
-- elixir related tools installed by elixir-tools
|
||||||
elixir-tools.setup {
|
elixir.setup {
|
||||||
nextls = {
|
nextls = {
|
||||||
enable = false -- defaults to false
|
enable = false -- defaults to false
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding pushDownDefault;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
@ -15,15 +14,22 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["trouble"];
|
lazy.plugins = [
|
||||||
|
{
|
||||||
|
package = "trouble";
|
||||||
|
setupModule = "trouble";
|
||||||
|
inherit (cfg.trouble) setupOpts;
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
cmd = "Trouble";
|
||||||
(mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
keys = [
|
||||||
(mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||||
(mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||||
(mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||||
(mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||||
(mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||||
|
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||||
|
];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
@ -31,11 +37,6 @@ in {
|
||||||
"<leader>x" = "+Trouble";
|
"<leader>x" = "+Trouble";
|
||||||
"<leader>lw" = "Workspace";
|
"<leader>lw" = "Workspace";
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.trouble = entryAnywhere ''
|
|
||||||
-- Enable trouble diagnostics viewer
|
|
||||||
require("trouble").setup {}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
trouble = {
|
trouble = {
|
||||||
enable = mkEnableOption "trouble diagnostics viewer";
|
enable = mkEnableOption "trouble diagnostics viewer";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Trouble" {};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
||||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||||
|
|
|
@ -4,55 +4,49 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON;
|
inherit (builtins) toJSON;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkLznBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
|
||||||
|
|
||||||
cfg = config.vim.terminal.toggleterm;
|
cfg = config.vim.terminal.toggleterm;
|
||||||
|
lazygitMapDesc = "Open lazygit [toggleterm]";
|
||||||
in {
|
in {
|
||||||
config = mkMerge [
|
config = mkIf cfg.enable {
|
||||||
(
|
vim = {
|
||||||
mkIf cfg.enable {
|
lazy.plugins = [
|
||||||
vim = {
|
{
|
||||||
startPlugins = [
|
package = "toggleterm-nvim";
|
||||||
"toggleterm-nvim"
|
cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"];
|
||||||
|
keys = [
|
||||||
|
(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")
|
||||||
|
{
|
||||||
|
key = cfg.lazygit.mappings.open;
|
||||||
|
desc = lazygitMapDesc;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
|
setupModule = "toggleterm";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
after = optionalString cfg.lazygit.enable ''
|
||||||
|
local terminal = require 'toggleterm.terminal'
|
||||||
|
local lazygit = terminal.Terminal:new({
|
||||||
|
cmd = '${
|
||||||
|
if (cfg.lazygit.package != null)
|
||||||
|
then getExe cfg.lazygit.package
|
||||||
|
else "lazygit"
|
||||||
|
}',
|
||||||
|
direction = '${cfg.lazygit.direction}',
|
||||||
|
hidden = true,
|
||||||
|
on_open = function(term)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
pluginRC.toggleterm = entryAnywhere ''
|
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = '${lazygitMapDesc}'})
|
||||||
require("toggleterm").setup(${toLuaObject cfg.setupOpts})
|
|
||||||
'';
|
'';
|
||||||
};
|
}
|
||||||
}
|
];
|
||||||
)
|
};
|
||||||
(
|
};
|
||||||
mkIf (cfg.enable && cfg.lazygit.enable)
|
|
||||||
{
|
|
||||||
vim.startPlugins = optionals (cfg.lazygit.package != null) [
|
|
||||||
cfg.lazygit.package
|
|
||||||
];
|
|
||||||
vim.pluginRC.toggleterm-lazygit = entryAfter ["toggleterm"] ''
|
|
||||||
local terminal = require 'toggleterm.terminal'
|
|
||||||
local lazygit = terminal.Terminal:new({
|
|
||||||
cmd = '${
|
|
||||||
if (cfg.lazygit.package != null)
|
|
||||||
then getExe cfg.lazygit.package
|
|
||||||
else "lazygit"
|
|
||||||
}',
|
|
||||||
direction = '${cfg.lazygit.direction}',
|
|
||||||
hidden = true,
|
|
||||||
on_open = function(term)
|
|
||||||
vim.cmd("startinsert!")
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = 'Open lazygit [toggleterm]'})
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,20 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.strings) optionalString;
|
||||||
|
|
||||||
cfg = config.vim.binds.cheatsheet;
|
cfg = config.vim.binds.cheatsheet;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["cheatsheet-nvim"];
|
vim.lazy.plugins = [
|
||||||
|
{
|
||||||
|
package = "cheatsheet-nvim";
|
||||||
|
setupModule = "cheatsheet";
|
||||||
|
setupOpts = {};
|
||||||
|
cmd = ["Cheatsheet" "CheatsheetEdit"];
|
||||||
|
|
||||||
vim.pluginRC.cheaetsheet-nvim = entryAnywhere ''
|
before = optionalString config.vim.lazy.enable "require('lz.n').trigger_load('telescope')";
|
||||||
require('cheatsheet').setup({})
|
}
|
||||||
'';
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,16 @@
|
||||||
cfg = config.vim.utility.diffview-nvim;
|
cfg = config.vim.utility.diffview-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"diffview-nvim"
|
startPlugins = ["plenary-nvim"];
|
||||||
"plenary-nvim"
|
lazy.plugins = [
|
||||||
];
|
{
|
||||||
|
package = "diffview-nvim";
|
||||||
|
cmd = ["DiffviewClose" "DiffviewFileHistory" "DiffviewFocusFiles" "DiffviewLog" "DiffviewOpen" "DiffviewRefresh" "DiffviewToggleFiles"];
|
||||||
|
setupModule = "diffview";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.diffview-nvim = {
|
options.vim.utility.diffview-nvim = {
|
||||||
enable = mkEnableOption "diffview-nvim: cycle through diffs for all modified files for any git rev";
|
enable = mkEnableOption "diffview-nvim: cycle through diffs for all modified files for any git rev";
|
||||||
|
setupOpts = mkPluginSetupOption "Fidget" {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,22 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.utility.icon-picker;
|
cfg = config.vim.utility.icon-picker;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = ["dressing-nvim"];
|
||||||
"icon-picker-nvim"
|
|
||||||
"dressing-nvim"
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.pluginRC.icon-picker = entryAnywhere ''
|
vim.lazy.plugins = [
|
||||||
require("icon-picker").setup({
|
{
|
||||||
disable_legacy_commands = true
|
package = "icon-picker-nvim";
|
||||||
})
|
setupModule = "icon-picker";
|
||||||
'';
|
setupOpts = {
|
||||||
|
disable_legacy_commands = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
cmd = ["IconPickerInsert" "IconPickerNormal" "IconPickerYank"];
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,71 +3,59 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkLznBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.utility.motion.leap;
|
cfg = config.vim.utility.motion.leap;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"leap-nvim"
|
startPlugins = ["vim-repeat"];
|
||||||
"vim-repeat"
|
lazy.plugins = [
|
||||||
];
|
{
|
||||||
|
package = "leap-nvim";
|
||||||
|
keys = [
|
||||||
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||||
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||||
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||||
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||||
|
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||||
|
];
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
after = ''
|
||||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
require('leap').opts = {
|
||||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
max_phase_one_targets = nil,
|
||||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
highlight_unlabeled_phase_one_targets = false,
|
||||||
];
|
max_highlighted_traversal_targets = 10,
|
||||||
|
case_sensitive = false,
|
||||||
vim.maps.operator = mkMerge [
|
equivalence_classes = { ' \t\r\n', },
|
||||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
substitute_chars = {},
|
||||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
safe_labels = {
|
||||||
(mkBinding cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
"s", "f", "n", "u", "t", "/",
|
||||||
(mkBinding cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
"S", "F", "N", "L", "H", "M", "U", "G", "T", "?", "Z"
|
||||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
},
|
||||||
];
|
labels = {
|
||||||
|
"s", "f", "n",
|
||||||
vim.maps.visualOnly = mkMerge [
|
"j", "k", "l", "h", "o", "d", "w", "e", "m", "b",
|
||||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
|
||||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
"S", "F", "N",
|
||||||
(mkBinding cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
"J", "K", "L", "H", "O", "D", "W", "E", "M", "B",
|
||||||
(mkBinding cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
"U", "Y", "V", "R", "G", "T", "C", "X", "?", "Z"
|
||||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
},
|
||||||
];
|
special_keys = {
|
||||||
|
repeat_search = '<enter>',
|
||||||
vim.pluginRC.leap-nvim = entryAnywhere ''
|
next_phase_one_target = '<enter>',
|
||||||
require('leap').opts = {
|
next_target = {'<enter>', ';'},
|
||||||
max_phase_one_targets = nil,
|
prev_target = {'<tab>', ','},
|
||||||
highlight_unlabeled_phase_one_targets = false,
|
next_group = '<space>',
|
||||||
max_highlighted_traversal_targets = 10,
|
prev_group = '<tab>',
|
||||||
case_sensitive = false,
|
multi_accept = '<enter>',
|
||||||
equivalence_classes = { ' \t\r\n', },
|
multi_revert = '<backspace>',
|
||||||
substitute_chars = {},
|
},
|
||||||
safe_labels = {
|
}
|
||||||
"s", "f", "n", "u", "t", "/",
|
'';
|
||||||
"S", "F", "N", "L", "H", "M", "U", "G", "T", "?", "Z"
|
}
|
||||||
},
|
];
|
||||||
labels = {
|
};
|
||||||
"s", "f", "n",
|
|
||||||
"j", "k", "l", "h", "o", "d", "w", "e", "m", "b",
|
|
||||||
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
|
|
||||||
"S", "F", "N",
|
|
||||||
"J", "K", "L", "H", "O", "D", "W", "E", "M", "B",
|
|
||||||
"U", "Y", "V", "R", "G", "T", "C", "X", "?", "Z"
|
|
||||||
},
|
|
||||||
special_keys = {
|
|
||||||
repeat_search = '<enter>',
|
|
||||||
next_phase_one_target = '<enter>',
|
|
||||||
next_target = {'<enter>', ';'},
|
|
||||||
prev_target = {'<tab>', ','},
|
|
||||||
next_group = '<space>',
|
|
||||||
prev_group = '<tab>',
|
|
||||||
multi_accept = '<enter>',
|
|
||||||
multi_revert = '<backspace>',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,42 +3,29 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.utility.surround;
|
cfg = config.vim.utility.surround;
|
||||||
self = import ./surround.nix {inherit lib config;};
|
|
||||||
mappingDefinitions = self.options.vim.utility.surround.mappings;
|
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = [
|
startPlugins = ["nvim-surround"];
|
||||||
"nvim-surround"
|
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||||
];
|
|
||||||
|
|
||||||
pluginRC.surround = entryAnywhere ''
|
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings {
|
||||||
require('nvim-surround').setup()
|
insert = "<C-g>z";
|
||||||
'';
|
insert_line = "<C-g>Z";
|
||||||
|
normal = "gz";
|
||||||
maps = {
|
normal_cur = "gZ";
|
||||||
insert = mkMerge [
|
normal_line = "gzz";
|
||||||
(mkIf (mappings.insert != null) (mkSetBinding mappings.insert "<Plug>(nvim-surround-insert)"))
|
normal_cur_line = "gZZ";
|
||||||
(mkIf (mappings.insertLine != null) (mkSetBinding mappings.insertLine "<Plug>(nvim-surround-insert-line)"))
|
visual = "gz";
|
||||||
];
|
visual_line = "gZ";
|
||||||
normal = mkMerge [
|
delete = "gzd";
|
||||||
(mkIf (mappings.normal != null) (mkSetBinding mappings.normal "<Plug>(nvim-surround-normal)"))
|
change = "gzr";
|
||||||
(mkIf (mappings.normalCur != null) (mkSetBinding mappings.normalCur "<Plug>(nvim-surround-normal-cur)"))
|
change_line = "gZR";
|
||||||
(mkIf (mappings.normalLine != null) (mkSetBinding mappings.normalLine "<Plug>(nvim-surround-normal-line)"))
|
|
||||||
(mkIf (mappings.normalCurLine != null) (mkSetBinding mappings.normalCurLine "<Plug>(nvim-surround-normal-cur-line)"))
|
|
||||||
(mkIf (mappings.delete != null) (mkSetBinding mappings.delete "<Plug>(nvim-surround-delete)"))
|
|
||||||
(mkIf (mappings.change != null) (mkSetBinding mappings.change "<Plug>(nvim-surround-change)"))
|
|
||||||
];
|
|
||||||
visualOnly = mkMerge [
|
|
||||||
(mkIf (mappings.visual != null) (mkSetBinding mappings.visual "<Plug>(nvim-surround-visual)"))
|
|
||||||
(mkIf (mappings.visualLine != null) (mkSetBinding mappings.visualLine "<Plug>(nvim-surround-visual-line)"))
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,90 +1,24 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf mkDefault;
|
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) bool nullOr str;
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.surround = {
|
options.vim.utility.surround = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "nvim-surround: add/change/delete surrounding delimiter pairs with ease. Note that the default mappings deviate from upstreeam to avoid conflicts with nvim-leap.";
|
description = ''
|
||||||
|
nvim-surround: add/change/delete surrounding delimiter pairs with ease.
|
||||||
|
Note that the default mappings deviate from upstreeam to avoid conflicts
|
||||||
|
with nvim-leap.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
setupOpts = mkPluginSetupOption "nvim-surround" {};
|
||||||
|
|
||||||
useVendoredKeybindings = mkOption {
|
useVendoredKeybindings = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
|
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
|
||||||
};
|
};
|
||||||
mappings = {
|
|
||||||
insert = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "<C-g>z";
|
|
||||||
description = "Add surround character around the cursor";
|
|
||||||
};
|
|
||||||
insertLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "<C-g>Z";
|
|
||||||
description = "Add surround character around the cursor on new lines";
|
|
||||||
};
|
|
||||||
normal = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gz";
|
|
||||||
description = "Surround motion with character";
|
|
||||||
};
|
|
||||||
normalCur = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gZ";
|
|
||||||
description = "Surround motion with character on new lines";
|
|
||||||
};
|
|
||||||
normalLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gzz";
|
|
||||||
description = "Surround line with character";
|
|
||||||
};
|
|
||||||
normalCurLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gZZ";
|
|
||||||
description = "Surround line with character on new lines";
|
|
||||||
};
|
|
||||||
visual = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gz";
|
|
||||||
description = "Surround selection with character";
|
|
||||||
};
|
|
||||||
visualLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gZ";
|
|
||||||
description = "Surround selection with character on new lines";
|
|
||||||
};
|
|
||||||
delete = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gzd";
|
|
||||||
description = "Delete surrounding character";
|
|
||||||
};
|
|
||||||
change = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gzr";
|
|
||||||
description = "Change surrounding character";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config.vim.utility.surround = let
|
|
||||||
cfg = config.vim.utility.surround;
|
|
||||||
in {
|
|
||||||
mappings = mkIf (! cfg.useVendoredKeybindings) (mkDefault {
|
|
||||||
insert = null;
|
|
||||||
insertLine = null;
|
|
||||||
normal = null;
|
|
||||||
normalCur = null;
|
|
||||||
normalLine = null;
|
|
||||||
normalCurLine = null;
|
|
||||||
visual = null;
|
|
||||||
visualLine = null;
|
|
||||||
delete = null;
|
|
||||||
change = null;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.nvim.binds) pushDownDefault;
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.binds) pushDownDefault mkSetLznBinding;
|
||||||
|
|
||||||
cfg = config.vim.telescope;
|
cfg = config.vim.telescope;
|
||||||
self = import ./telescope.nix {inherit pkgs lib;};
|
self = import ./telescope.nix {inherit pkgs lib;};
|
||||||
|
@ -18,45 +18,58 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = [
|
startPlugins = ["plenary-nvim"];
|
||||||
"telescope"
|
|
||||||
"plenary-nvim"
|
|
||||||
];
|
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
lazy.plugins = [
|
||||||
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
{
|
||||||
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
package = "telescope";
|
||||||
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
setupModule = "telescope";
|
||||||
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
inherit (cfg) setupOpts;
|
||||||
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
|
# FIXME: how do I deal with extensions? set all as deps?
|
||||||
(mkSetBinding mappings.resume "<cmd> Telescope resume<CR>")
|
after = ''
|
||||||
|
local telescope = require("telescope")
|
||||||
|
${optionalString config.vim.ui.noice.enable "telescope.load_extension('noice')"}
|
||||||
|
${optionalString config.vim.notify.nvim-notify.enable "telescope.load_extension('notify')"}
|
||||||
|
${optionalString config.vim.projects.project-nvim.enable "telescope.load_extension('projects')"}
|
||||||
|
'';
|
||||||
|
|
||||||
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
cmd = ["Telescope"];
|
||||||
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
|
||||||
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
|
||||||
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
|
||||||
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
|
||||||
|
|
||||||
(mkIf config.vim.lsp.enable (mkMerge [
|
keys =
|
||||||
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
[
|
||||||
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||||
|
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||||
|
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||||
|
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||||
|
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
||||||
|
|
||||||
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||||
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||||
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||||
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||||
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||||
]))
|
]
|
||||||
|
++ (optionals config.vim.lsp.enable [
|
||||||
|
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||||
|
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||||
|
|
||||||
(
|
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||||
mkIf config.vim.treesitter.enable
|
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||||
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||||
)
|
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||||
|
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||||
(
|
])
|
||||||
mkIf config.vim.projects.project-nvim.enable
|
++ (
|
||||||
(mkSetBinding mappings.findProjects "<cmd> Telescope projects<CR>")
|
optionals config.vim.treesitter.enable [
|
||||||
)
|
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
optionals config.vim.projects.project-nvim.enable [
|
||||||
|
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
@ -66,29 +79,6 @@ in {
|
||||||
"<leader>fv" = "Telescope Git";
|
"<leader>fv" = "Telescope Git";
|
||||||
"<leader>fvc" = "Commits";
|
"<leader>fvc" = "Commits";
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.telescope = entryAnywhere ''
|
|
||||||
local telescope = require('telescope')
|
|
||||||
telescope.setup(${toLuaObject cfg.setupOpts})
|
|
||||||
|
|
||||||
${
|
|
||||||
if config.vim.ui.noice.enable
|
|
||||||
then "telescope.load_extension('noice')"
|
|
||||||
else ""
|
|
||||||
}
|
|
||||||
|
|
||||||
${
|
|
||||||
if config.vim.notify.nvim-notify.enable
|
|
||||||
then "telescope.load_extension('notify')"
|
|
||||||
else ""
|
|
||||||
}
|
|
||||||
|
|
||||||
${
|
|
||||||
if config.vim.projects.project-nvim.enable
|
|
||||||
then "telescope.load_extension('projects')"
|
|
||||||
else ""
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,17 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.visuals.fidget-nvim;
|
cfg = config.vim.visuals.fidget-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["fidget-nvim"];
|
vim.lazy.plugins = [
|
||||||
|
{
|
||||||
vim.pluginRC.fidget-nvim = entryAnywhere ''
|
package = "fidget-nvim";
|
||||||
require'fidget'.setup(${toLuaObject cfg.setupOpts})
|
setupModule = "fidget";
|
||||||
'';
|
event = "LspAttach";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
85
modules/wrapper/lazy/config.nix
Normal file
85
modules/wrapper/lazy/config.nix
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) toJSON typeOf head length tryEval filter;
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
|
cfg = config.vim.lazy;
|
||||||
|
|
||||||
|
toLuaLznKeySpec = {
|
||||||
|
desc,
|
||||||
|
noremap,
|
||||||
|
expr,
|
||||||
|
nowait,
|
||||||
|
ft,
|
||||||
|
key,
|
||||||
|
action,
|
||||||
|
lua,
|
||||||
|
mode,
|
||||||
|
}: {
|
||||||
|
"@1" = key;
|
||||||
|
"@2" =
|
||||||
|
if lua
|
||||||
|
then mkLuaInline action
|
||||||
|
else action;
|
||||||
|
inherit desc noremap expr nowait ft mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
toLuaLznSpec = spec: let
|
||||||
|
name =
|
||||||
|
if typeOf spec.package == "string"
|
||||||
|
then spec.package
|
||||||
|
else if (spec.package ? pname && (tryEval spec.package.pname).success)
|
||||||
|
then spec.package.pname
|
||||||
|
else spec.package.name;
|
||||||
|
in
|
||||||
|
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||||
|
// {
|
||||||
|
"@1" = name;
|
||||||
|
before =
|
||||||
|
if spec.before != null
|
||||||
|
then
|
||||||
|
mkLuaInline ''
|
||||||
|
function()
|
||||||
|
${spec.before}
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else null;
|
||||||
|
|
||||||
|
after =
|
||||||
|
if spec.setupModule == null && spec.after == null
|
||||||
|
then null
|
||||||
|
else
|
||||||
|
mkLuaInline ''
|
||||||
|
function()
|
||||||
|
${
|
||||||
|
optionalString (spec.setupModule != null)
|
||||||
|
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
|
||||||
|
}
|
||||||
|
${optionalString (spec.after != null) spec.after}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
keys =
|
||||||
|
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
||||||
|
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
|
||||||
|
# empty list or str or (listOf str)
|
||||||
|
else spec.keys;
|
||||||
|
};
|
||||||
|
lznSpecs = map toLuaLznSpec cfg.plugins;
|
||||||
|
in {
|
||||||
|
config.vim = mkIf cfg.enable {
|
||||||
|
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||||
|
|
||||||
|
optPlugins = map (plugin: plugin.package) cfg.plugins;
|
||||||
|
|
||||||
|
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
||||||
|
require('lz.n').load(${toLuaObject lznSpecs})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
6
modules/wrapper/lazy/default.nix
Normal file
6
modules/wrapper/lazy/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./lazy.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
205
modules/wrapper/lazy/lazy.nix
Normal file
205
modules/wrapper/lazy/lazy.nix
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) enum listOf submodule nullOr str bool int attrsOf anything either oneOf;
|
||||||
|
inherit (lib.nvim.types) pluginType;
|
||||||
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
|
lznKeysSpec = submodule {
|
||||||
|
options = {
|
||||||
|
key = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
description = "Key to bind to. If key is null this entry is ignored.";
|
||||||
|
};
|
||||||
|
|
||||||
|
action = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Action to trigger.";
|
||||||
|
};
|
||||||
|
lua = mkBool false ''
|
||||||
|
If true, `action` is considered to be lua code.
|
||||||
|
Thus, it will not be wrapped in `""`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
desc = mkOption {
|
||||||
|
description = "Description of the key map";
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
ft = mkOption {
|
||||||
|
description = "TBD";
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
mode = mkOption {
|
||||||
|
description = "Modes to bind in";
|
||||||
|
type = listOf str;
|
||||||
|
default = ["n" "x" "s" "o"];
|
||||||
|
};
|
||||||
|
|
||||||
|
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.";
|
||||||
|
expr = mkBool false "Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||||
|
nowait = mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lznPluginType = submodule {
|
||||||
|
options = {
|
||||||
|
## Should probably infer from the actual plugin somehow
|
||||||
|
## In general this is the name passed to packadd, so the dir name of the plugin
|
||||||
|
# name = mkOption {
|
||||||
|
# type= str;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Non-lz.n options
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = pluginType;
|
||||||
|
description = "Plugin package";
|
||||||
|
};
|
||||||
|
|
||||||
|
setupModule = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
description = "Lua module to run setup function on.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
setupOpts = mkOption {
|
||||||
|
type = submodule {freeformType = attrsOf anything;};
|
||||||
|
description = "Options to pass to the setup function";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
# lz.n options
|
||||||
|
|
||||||
|
enabled = mkOption {
|
||||||
|
type = nullOr (either bool str);
|
||||||
|
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
before = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
after = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
description = "Lua code to run after plugin is loaded. This will be wrapped in a function.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
event = mkOption {
|
||||||
|
description = "Lazy-load on event";
|
||||||
|
default = null;
|
||||||
|
type = let
|
||||||
|
event = submodule {
|
||||||
|
options = {
|
||||||
|
event = mkOption {
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
description = "Exact event name";
|
||||||
|
example = "BufEnter";
|
||||||
|
};
|
||||||
|
pattern = mkOption {
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
description = "Event pattern";
|
||||||
|
example = "BufEnter *.lua";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
nullOr (oneOf [str (listOf str) event]);
|
||||||
|
};
|
||||||
|
|
||||||
|
cmd = mkOption {
|
||||||
|
description = "Lazy-load on command";
|
||||||
|
default = null;
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
};
|
||||||
|
|
||||||
|
ft = mkOption {
|
||||||
|
description = "Lazy-load on filetype";
|
||||||
|
default = null;
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
};
|
||||||
|
|
||||||
|
keys = mkOption {
|
||||||
|
description = "Lazy-load on key mapping";
|
||||||
|
default = null;
|
||||||
|
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||||
|
example = ''
|
||||||
|
keys = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>s";
|
||||||
|
action = ":DapStepOver<cr>";
|
||||||
|
desc = "DAP Step Over";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = ["n", "x"];
|
||||||
|
key = "<leader>dc";
|
||||||
|
action = "function() require('dap').continue() end";
|
||||||
|
lua = true;
|
||||||
|
desc = "DAP Continue";
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
colorscheme = mkOption {
|
||||||
|
description = "Lazy-load on colorscheme.";
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
priority = mkOption {
|
||||||
|
type = nullOr int;
|
||||||
|
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
load = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Lua code to override the `vim.g.lz_n.load()` function for a single plugin.
|
||||||
|
|
||||||
|
This will be wrapped in a function
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.lazy = {
|
||||||
|
enable = mkEnableOption "plugin lazy-loading" // {default = true;};
|
||||||
|
loader = mkOption {
|
||||||
|
description = "Lazy loader to use";
|
||||||
|
type = enum ["lz.n"];
|
||||||
|
default = "lz.n";
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins = mkOption {
|
||||||
|
default = [];
|
||||||
|
type = listOf lznPluginType;
|
||||||
|
description = "list of plugins to lazy load";
|
||||||
|
example = ''
|
||||||
|
[
|
||||||
|
{
|
||||||
|
package = "toggleterm-nvim";
|
||||||
|
after = lib.generators.mkLuaInline "function() require('toggleterm').setup{} end";
|
||||||
|
cmd = ["ToggleTerm"];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,9 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map mapAttrs filter removeAttrs attrNames;
|
inherit (builtins) map mapAttrs filter;
|
||||||
inherit (lib.attrsets) mapAttrsToList filterAttrs attrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.strings) concatLines concatMapStringsSep;
|
inherit (lib.strings) concatLines concatMapStringsSep optionalString;
|
||||||
inherit (lib.trivial) showWarnings;
|
inherit (lib.trivial) showWarnings;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
||||||
|
@ -41,40 +41,9 @@ in {
|
||||||
inherit (keymap) desc silent nowait script expr unique noremap;
|
inherit (keymap) desc silent nowait script expr unique noremap;
|
||||||
};
|
};
|
||||||
|
|
||||||
toLuaKeymap = {
|
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
|
||||||
name,
|
|
||||||
value,
|
|
||||||
}: "vim.keymap.set(${toLuaObject value.mode}, ${toLuaObject name}, ${toLuaObject (getAction value)}, ${toLuaObject (getOpts value)})";
|
|
||||||
|
|
||||||
namedModes = {
|
keymaps = concatLines (map toLuaKeymap cfg.keymaps);
|
||||||
"normal" = ["n"];
|
|
||||||
"insert" = ["i"];
|
|
||||||
"select" = ["s"];
|
|
||||||
"visual" = ["v"];
|
|
||||||
"terminal" = ["t"];
|
|
||||||
"normalVisualOp" = ["n" "v" "o"];
|
|
||||||
"visualOnly" = ["n" "x"];
|
|
||||||
"operator" = ["o"];
|
|
||||||
"insertCommand" = ["i" "c"];
|
|
||||||
"lang" = ["l"];
|
|
||||||
"command" = ["c"];
|
|
||||||
};
|
|
||||||
|
|
||||||
maps =
|
|
||||||
removeAttrs cfg.maps (attrNames namedModes)
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.normal;}) cfg.maps.normal
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.insert;}) cfg.maps.insert
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.select;}) cfg.maps.select
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.visual;}) cfg.maps.visual
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.terminal;}) cfg.maps.terminal
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.normalVisualOp;}) cfg.maps.normalVisualOp
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.visualOnly;}) cfg.maps.visualOnly
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.operator;}) cfg.maps.operator
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.insertCommand;}) cfg.maps.insertCommand
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.lang;}) cfg.maps.lang
|
|
||||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.command;}) cfg.maps.command;
|
|
||||||
|
|
||||||
keymaps = concatLines (map toLuaKeymap (attrsToList (filterAttrs (_: value: value != null) maps)));
|
|
||||||
in {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
luaConfigRC = {
|
luaConfigRC = {
|
||||||
|
@ -86,6 +55,8 @@ in {
|
||||||
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
|
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
|
||||||
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
||||||
mappings = entryAfter ["extraPluginConfigs"] keymaps;
|
mappings = entryAfter ["extraPluginConfigs"] keymaps;
|
||||||
|
# FIXME: put this somewhere less stupid
|
||||||
|
footer = entryAfter ["mappings"] (optionalString config.vim.lazy.enable "require('lzn-auto-require').enable()");
|
||||||
};
|
};
|
||||||
|
|
||||||
builtLuaConfigRC = let
|
builtLuaConfigRC = let
|
||||||
|
|
Loading…
Add table
Reference in a new issue