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}
|
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
||||||
|
|
||||||
To set a mapping, you should define it in `vim.maps.<<mode>>`.
|
To set a mapping, you should define it in `vim.keymaps`.
|
||||||
The available modes are:
|
|
||||||
|
|
||||||
- normal
|
|
||||||
- insert
|
|
||||||
- select
|
|
||||||
- visual
|
|
||||||
- terminal
|
|
||||||
- normalVisualOp
|
|
||||||
- visualOnly
|
|
||||||
- operator
|
|
||||||
- insertCommand
|
|
||||||
- lang
|
|
||||||
- command
|
|
||||||
|
|
||||||
An example, simple keybinding, can look like this:
|
An example, simple keybinding, can look like this:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
vim.maps.normal = {
|
vim.keymaps = [
|
||||||
"<leader>wq" = {
|
{
|
||||||
|
key = "<leader>wq";
|
||||||
|
mode = ["n"];
|
||||||
action = ":wq<CR>";
|
action = ":wq<CR>";
|
||||||
silent = true;
|
silent = true;
|
||||||
desc = "Save file and quit";
|
desc = "Save file and quit";
|
||||||
};
|
}
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
There are many settings available in the options. Please refer to the
|
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.
|
to see a list of them.
|
||||||
|
|
||||||
**nvf** provides a list of helper commands, so that you don't have to write the
|
**nvf** provides a list of helper commands, so that you don't have to write the
|
||||||
|
|
|
@ -97,7 +97,7 @@ in {
|
||||||
|
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
freeformType = attrsOf anything;
|
freeformType = anything;
|
||||||
options = opts;
|
options = opts;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,6 +31,9 @@ in {
|
||||||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
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"])
|
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption literalMD;
|
||||||
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
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'';
|
example = literalMD ''`["n" "v" "c"]` for normal, visual and command mode'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,9 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-autopairs"];
|
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 = {
|
options.vim.autopairs.nvim-autopairs = {
|
||||||
enable = mkEnableOption "autopairs" // {default = false;};
|
enable = mkEnableOption "autopairs";
|
||||||
setupOpts = mkPluginSetupOption "nvim-autopairs" {};
|
setupOpts = mkPluginSetupOption "nvim-autopairs" {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
cfg = config.vim.autocomplete.nvim-cmp;
|
cfg = config.vim.autocomplete.nvim-cmp;
|
||||||
in {
|
in {
|
||||||
options.vim.autocomplete.nvim-cmp = {
|
options.vim.autocomplete.nvim-cmp = {
|
||||||
enable = mkEnableOption "nvim-cmp" // {default = false;};
|
enable = mkEnableOption "nvim-cmp";
|
||||||
setupOpts = mkPluginSetupOption "the autocomplete plugin" {
|
setupOpts = mkPluginSetupOption "the autocomplete plugin" {
|
||||||
completion.completeopt = mkOption {
|
completion.completeopt = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
in {
|
in {
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-dap"];
|
vim = {
|
||||||
|
startPlugins = ["nvim-dap"];
|
||||||
|
|
||||||
vim.pluginRC =
|
pluginRC =
|
||||||
{
|
{
|
||||||
# TODO customizable keymaps
|
# TODO customizable keymaps
|
||||||
nvim-dap = entryAnywhere ''
|
nvim-dap = entryAnywhere ''
|
||||||
|
@ -28,7 +29,7 @@ in {
|
||||||
}
|
}
|
||||||
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
|
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
(mkSetLuaBinding mappings.continue "require('dap').continue")
|
(mkSetLuaBinding mappings.continue "require('dap').continue")
|
||||||
(mkSetLuaBinding mappings.restart "require('dap').restart")
|
(mkSetLuaBinding mappings.restart "require('dap').restart")
|
||||||
(mkSetLuaBinding mappings.terminate "require('dap').terminate")
|
(mkSetLuaBinding mappings.terminate "require('dap').terminate")
|
||||||
|
@ -47,11 +48,13 @@ in {
|
||||||
(mkSetLuaBinding mappings.goUp "require('dap').up")
|
(mkSetLuaBinding mappings.goUp "require('dap').up")
|
||||||
(mkSetLuaBinding mappings.goDown "require('dap').down")
|
(mkSetLuaBinding mappings.goDown "require('dap').down")
|
||||||
];
|
];
|
||||||
|
};
|
||||||
})
|
})
|
||||||
(mkIf (cfg.enable && cfg.ui.enable) {
|
(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")
|
local dapui = require("dapui")
|
||||||
dapui.setup()
|
dapui.setup()
|
||||||
''
|
''
|
||||||
|
@ -66,7 +69,8 @@ in {
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
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;
|
inherit (lib.nvim.types) pluginType;
|
||||||
in {
|
in {
|
||||||
options.vim.snippets.luasnip = {
|
options.vim.snippets.luasnip = {
|
||||||
enable = mkEnableOption "luasnip" // {default = false;};
|
enable = mkEnableOption "luasnip";
|
||||||
providers = mkOption {
|
providers = mkOption {
|
||||||
type = listOf pluginType;
|
type = listOf pluginType;
|
||||||
default = ["friendly-snippets"];
|
default = ["friendly-snippets"];
|
||||||
|
@ -12,7 +12,7 @@ in {
|
||||||
The snippet provider packages.
|
The snippet provider packages.
|
||||||
|
|
||||||
::: {.note}
|
::: {.note}
|
||||||
These are simply appended to `vim.startPlugins`.
|
These are simply appended to {option} `vim.startPlugins`.
|
||||||
:::
|
:::
|
||||||
'';
|
'';
|
||||||
example = literalExpression "[\"vimPlugins.vim-snippets\"]";
|
example = literalExpression "[\"vimPlugins.vim-snippets\"]";
|
||||||
|
|
Loading…
Add table
Reference in a new issue