mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 12:28:32 +00:00
Compare commits
5 commits
f5b887f960
...
c641f7642e
Author | SHA1 | Date | |
---|---|---|---|
c641f7642e | |||
205f14faee | |||
f9476384b7 | |||
6fc850be1d | |||
![]() |
b39b84490f |
8 changed files with 89 additions and 29 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
|
||||
|
|
|
@ -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'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -31,10 +31,6 @@ in {
|
|||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.nvimWebDevicons.enable {
|
||||
vim.startPlugins = ["nvim-web-devicons"];
|
||||
})
|
||||
|
||||
(mkIf cfg.scrollBar.enable {
|
||||
vim.startPlugins = ["scrollbar-nvim"];
|
||||
vim.pluginRC.scrollBar = entryAnywhere ''
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{...}: {
|
||||
{
|
||||
imports = [
|
||||
./fidget
|
||||
./nvim-web-devicons
|
||||
|
||||
./config.nix
|
||||
./visuals.nix
|
||||
./fidget
|
||||
];
|
||||
}
|
||||
|
|
21
modules/plugins/visuals/nvim-web-devicons/config.nix
Normal file
21
modules/plugins/visuals/nvim-web-devicons/config.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.visuals.nvim-web-devicons;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-web-devicons"];
|
||||
|
||||
pluginRC.nvim-web-devicons = entryAnywhere ''
|
||||
require("nvim-web-devicons").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/visuals/nvim-web-devicons/default.nix
Normal file
6
modules/plugins/visuals/nvim-web-devicons/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-web-devicons.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.types) nullOr attrsOf attrs enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
imports = [
|
||||
(mkRenamedOptionModule ["vim" "visuals" "nvimWebDevicons"] ["vim" "visuals" "nvim-web-devicons"])
|
||||
];
|
||||
|
||||
options.vim.visuals.nvim-web-devicons = {
|
||||
enable = mkEnableOption "Neovim dev icons [nvim-web-devicons]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "nvim-web-devicons" {
|
||||
color_icons = mkEnableOption "different highlight colors per icon";
|
||||
variant = mkOption {
|
||||
type = nullOr (enum ["light" "dark"]);
|
||||
default = null;
|
||||
description = "Set the light or dark variant manually, instead of relying on `background`";
|
||||
};
|
||||
|
||||
override = mkOption {
|
||||
type = attrsOf attrs;
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
{
|
||||
zsh = {
|
||||
name = "Zsh";
|
||||
icon = "";
|
||||
color = "#428850";
|
||||
cterm_color = "65";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Your personal icon overrides.
|
||||
|
||||
You can specify color or cterm_color instead of specifying
|
||||
both of them. DevIcon will be appended to `name`
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -12,8 +12,6 @@ in {
|
|||
options.vim.visuals = {
|
||||
enable = mkEnableOption "Visual enhancements.";
|
||||
|
||||
nvimWebDevicons.enable = mkEnableOption "dev icons. Required for certain plugins [nvim-web-devicons].";
|
||||
|
||||
scrollBar.enable = mkEnableOption "scrollbar [scrollbar.nvim]";
|
||||
|
||||
smoothScroll.enable = mkEnableOption "smooth scrolling [cinnamon-nvim]";
|
||||
|
|
Loading…
Add table
Reference in a new issue