mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 12:28:32 +00:00
Compare commits
9 commits
43a28e7b3d
...
b2300d276b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b2300d276b | ||
![]() |
2b3c0cde23 | ||
![]() |
630b8ffe51 | ||
![]() |
1ebc002042 | ||
![]() |
ebda97a032 | ||
![]() |
6921ac4e4e | ||
ef413736e9 | |||
![]() |
e77632e4eb | ||
![]() |
b39b84490f |
9 changed files with 68 additions and 70 deletions
|
@ -7,37 +7,26 @@ section contains a general overview to how you may utilize said functions.
|
|||
|
||||
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
||||
|
||||
To set a mapping, you should define it in `vim.maps.<<mode>>`.
|
||||
The available modes are:
|
||||
|
||||
- normal
|
||||
- insert
|
||||
- select
|
||||
- visual
|
||||
- terminal
|
||||
- normalVisualOp
|
||||
- visualOnly
|
||||
- operator
|
||||
- insertCommand
|
||||
- lang
|
||||
- command
|
||||
To set a mapping, you should define it in `vim.keymaps`.
|
||||
|
||||
An example, simple keybinding, can look like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.maps.normal = {
|
||||
"<leader>wq" = {
|
||||
vim.keymaps = [
|
||||
{
|
||||
key = "<leader>wq";
|
||||
mode = ["n"];
|
||||
action = ":wq<CR>";
|
||||
silent = true;
|
||||
desc = "Save file and quit";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
There are many settings available in the options. Please refer to the
|
||||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.maps.command._name_.action)
|
||||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps)
|
||||
to see a list of them.
|
||||
|
||||
**nvf** provides a list of helper commands, so that you don't have to write the
|
||||
|
|
|
@ -97,7 +97,7 @@ in {
|
|||
|
||||
default = {};
|
||||
type = submodule {
|
||||
freeformType = attrsOf anything;
|
||||
freeformType = anything;
|
||||
options = opts;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -31,6 +31,9 @@ in {
|
|||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||
'')
|
||||
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.options) mkOption literalMD;
|
||||
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
See `:help map-modes` for a list of modes.
|
||||
'';
|
||||
example = ''`["n" "v" "c"]` for normal, visual and command mode'';
|
||||
example = literalMD ''`["n" "v" "c"]` for normal, visual and command mode'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -12,7 +12,9 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-autopairs"];
|
||||
pluginRC.autopairs = entryAnywhere "require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})";
|
||||
pluginRC.autopairs = entryAnywhere ''
|
||||
require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ in {
|
|||
];
|
||||
|
||||
options.vim.autopairs.nvim-autopairs = {
|
||||
enable = mkEnableOption "autopairs" // {default = false;};
|
||||
enable = mkEnableOption "autopairs";
|
||||
setupOpts = mkPluginSetupOption "nvim-autopairs" {};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
cfg = config.vim.autocomplete.nvim-cmp;
|
||||
in {
|
||||
options.vim.autocomplete.nvim-cmp = {
|
||||
enable = mkEnableOption "nvim-cmp" // {default = false;};
|
||||
enable = mkEnableOption "nvim-cmp";
|
||||
setupOpts = mkPluginSetupOption "the autocomplete plugin" {
|
||||
completion.completeopt = mkOption {
|
||||
type = str;
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
in {
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
vim.startPlugins = ["nvim-dap"];
|
||||
vim = {
|
||||
startPlugins = ["nvim-dap"];
|
||||
|
||||
vim.pluginRC =
|
||||
pluginRC =
|
||||
{
|
||||
# TODO customizable keymaps
|
||||
nvim-dap = entryAnywhere ''
|
||||
|
@ -28,7 +29,7 @@ in {
|
|||
}
|
||||
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
maps.normal = mkMerge [
|
||||
(mkSetLuaBinding mappings.continue "require('dap').continue")
|
||||
(mkSetLuaBinding mappings.restart "require('dap').restart")
|
||||
(mkSetLuaBinding mappings.terminate "require('dap').terminate")
|
||||
|
@ -47,11 +48,13 @@ in {
|
|||
(mkSetLuaBinding mappings.goUp "require('dap').up")
|
||||
(mkSetLuaBinding mappings.goDown "require('dap').down")
|
||||
];
|
||||
};
|
||||
})
|
||||
(mkIf (cfg.enable && cfg.ui.enable) {
|
||||
vim.startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
||||
vim = {
|
||||
startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
||||
|
||||
vim.pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
||||
pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
||||
local dapui = require("dapui")
|
||||
dapui.setup()
|
||||
''
|
||||
|
@ -66,7 +69,8 @@ in {
|
|||
dapui.close()
|
||||
end
|
||||
'');
|
||||
vim.maps.normal = mkSetLuaBinding mappings.toggleDapUI "require('dapui').toggle";
|
||||
maps.normal = mkSetLuaBinding mappings.toggleDapUI "require('dapui').toggle";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
inherit (lib.nvim.types) pluginType;
|
||||
in {
|
||||
options.vim.snippets.luasnip = {
|
||||
enable = mkEnableOption "luasnip" // {default = false;};
|
||||
enable = mkEnableOption "luasnip";
|
||||
providers = mkOption {
|
||||
type = listOf pluginType;
|
||||
default = ["friendly-snippets"];
|
||||
|
@ -12,7 +12,7 @@ in {
|
|||
The snippet provider packages.
|
||||
|
||||
::: {.note}
|
||||
These are simply appended to `vim.startPlugins`.
|
||||
These are simply appended to {option} `vim.startPlugins`.
|
||||
:::
|
||||
'';
|
||||
example = literalExpression "[\"vimPlugins.vim-snippets\"]";
|
||||
|
|
Loading…
Add table
Reference in a new issue