mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
Merge remote-tracking branch 'upstream/v0.6' into which-key-categories
This commit is contained in:
commit
a738083c2f
58 changed files with 524 additions and 320 deletions
70
lib/binds.nix
Normal file
70
lib/binds.nix
Normal file
|
@ -0,0 +1,70 @@
|
|||
{lib}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.types) nullOr str;
|
||||
inherit (lib.attrsets) isAttrs mapAttrs;
|
||||
|
||||
binds = rec {
|
||||
mkLuaBinding = key: action: desc:
|
||||
mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
lua = true;
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkExprBinding = key: action: desc:
|
||||
mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
lua = true;
|
||||
silent = true;
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkBinding = key: action: desc:
|
||||
mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkMappingOption = description: default:
|
||||
mkOption {
|
||||
type = nullOr str;
|
||||
inherit default description;
|
||||
};
|
||||
|
||||
# Utility function that takes two attrsets:
|
||||
# { someKey = "some_value" } and
|
||||
# { someKey = { description = "Some Description"; }; }
|
||||
# and merges them into
|
||||
# { someKey = { value = "some_value"; description = "Some Description"; }; }
|
||||
addDescriptionsToMappings = actualMappings: mappingDefinitions:
|
||||
mapAttrs (name: value: let
|
||||
isNested = isAttrs value;
|
||||
returnedValue =
|
||||
if isNested
|
||||
then addDescriptionsToMappings actualMappings."${name}" mappingDefinitions."${name}"
|
||||
else {
|
||||
inherit value;
|
||||
inherit (mappingDefinitions."${name}") description;
|
||||
};
|
||||
in
|
||||
returnedValue)
|
||||
actualMappings;
|
||||
|
||||
mkSetBinding = binding: action:
|
||||
mkBinding binding.value action binding.description;
|
||||
|
||||
mkSetExprBinding = binding: action:
|
||||
mkExprBinding binding.value action binding.description;
|
||||
|
||||
mkSetLuaBinding = binding: action:
|
||||
mkLuaBinding binding.value action binding.description;
|
||||
};
|
||||
in
|
||||
binds
|
|
@ -1,7 +1,9 @@
|
|||
{lib}: {
|
||||
dag = import ./dag.nix {inherit lib;};
|
||||
types = import ./types {inherit lib;};
|
||||
|
||||
binds = import ./binds.nix {inherit lib;};
|
||||
dag = import ./dag.nix {inherit lib;};
|
||||
languages = import ./languages.nix {inherit lib;};
|
||||
lua = import ./lua.nix {inherit lib;};
|
||||
vim = import ./vim.nix {inherit lib;};
|
||||
vim = import ./vim.nix;
|
||||
}
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
# Home Manager module
|
||||
packages: inputs: {
|
||||
pkgs,
|
||||
config,
|
||||
lib ? pkgs.lib,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.programs.neovim-flake;
|
||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||
set = neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [cfg.settings];
|
||||
};
|
||||
in {
|
||||
meta.maintainers = with maintainers; [NotAShelf];
|
||||
|
||||
options.programs.neovim-flake = {
|
||||
enable = mkEnableOption "A NeoVim IDE with a focus on configurability and extensibility.";
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
{
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
nix = true;
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = "Attribute set of neoflake preferences.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [set.neovim];
|
||||
};
|
||||
}
|
17
lib/nmd.nix
17
lib/nmd.nix
|
@ -1,17 +0,0 @@
|
|||
# Copied from nmd master: https://gitlab.com/rycee/nmd/-/blob/master/default.nix?ref_type=heads
|
||||
# Allows asciiDoc in options. It is easier to copy & keep updated then figure out how to pass the nmd input
|
||||
# along to user modules
|
||||
{
|
||||
# Indicates that the given text should be interpreted as AsciiDoc markup.
|
||||
asciiDoc = text: {
|
||||
_type = "asciiDoc";
|
||||
inherit text;
|
||||
};
|
||||
|
||||
# Indicates that the given text should be interpreted as AsciiDoc markup and
|
||||
# used in a literal context.
|
||||
literalAsciiDoc = text: {
|
||||
_type = "literalAsciiDoc";
|
||||
inherit text;
|
||||
};
|
||||
}
|
|
@ -98,6 +98,7 @@ with lib; let
|
|||
"vim-dirtytalk"
|
||||
"highlight-undo"
|
||||
"nvim-docs-view"
|
||||
"image-nvim"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginType = with types;
|
||||
|
@ -116,11 +117,13 @@ with lib; let
|
|||
type = pluginType;
|
||||
description = "Plugin Package.";
|
||||
};
|
||||
|
||||
after = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Setup this plugin after the following ones.";
|
||||
};
|
||||
|
||||
setup = mkOption {
|
||||
type = lines;
|
||||
default = "";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
let
|
||||
inherit (builtins) isInt isBool toJSON;
|
||||
in rec {
|
||||
# yes? no.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue