mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 14:45:58 +01:00
Compare commits
10 commits
1264faaf19
...
867781732d
Author | SHA1 | Date | |
---|---|---|---|
|
867781732d | ||
7d077f43f7 | |||
cb57d3d417 | |||
754c29cb7c | |||
0e84e4ebed | |||
f0f2c08e9f | |||
cfbed8ceb1 | |||
1ce25d7ca3 | |||
eefc7a9d1d | |||
74c94b8a54 |
13 changed files with 282 additions and 94 deletions
|
@ -47,7 +47,7 @@
|
||||||
nixosModules.neovim-flake has been deprecated.
|
nixosModules.neovim-flake has been deprecated.
|
||||||
Please use the nixosModules.nvf instead
|
Please use the nixosModules.nvf instead
|
||||||
''
|
''
|
||||||
self.nixosModules.neovim-flake;
|
self.nixosModules.nvf;
|
||||||
|
|
||||||
nvf = {
|
nvf = {
|
||||||
imports = [(import ./flake/modules/nixos.nix self.packages inputs)];
|
imports = [(import ./flake/modules/nixos.nix self.packages inputs)];
|
||||||
|
|
|
@ -25,7 +25,7 @@ inputs: {
|
||||||
# check can be disabled while calling this file is called
|
# check can be disabled while calling this file is called
|
||||||
# to avoid checking in all modules
|
# to avoid checking in all modules
|
||||||
nvimModules = import ./modules.nix {
|
nvimModules = import ./modules.nix {
|
||||||
inherit check pkgs;
|
inherit pkgs check;
|
||||||
lib = extendedLib;
|
lib = extendedLib;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
|
check ? true,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
check ? true,
|
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkDefault;
|
inherit (lib.modules) mkDefault;
|
||||||
inherit (lib.lists) concatLists;
|
inherit (lib.lists) concatLists;
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
# Contains configuration for core neovim features
|
# Contains configuration for core neovim features
|
||||||
# such as spellchecking, mappings, and the init script (init.vim).
|
# such as spellchecking, mappings, and the init script (init.vim).
|
||||||
neovim = map (p: ./neovim + "/${p}") [
|
neovim = map (p: ./neovim + "/${p}") [
|
||||||
|
"global"
|
||||||
"init"
|
"init"
|
||||||
"mappings"
|
"mappings"
|
||||||
];
|
];
|
||||||
|
|
12
modules/neovim/global/default.nix
Normal file
12
modules/neovim/global/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.lists) concatLists;
|
||||||
|
inherit (lib.filesystem) listFilesRecursive;
|
||||||
|
in {
|
||||||
|
imports = concatLists [
|
||||||
|
# Configuration options for Neovim UI
|
||||||
|
(listFilesRecursive ./ui)
|
||||||
|
|
||||||
|
# vim.diagnostics
|
||||||
|
[./diagnostics.nix]
|
||||||
|
];
|
||||||
|
}
|
115
modules/neovim/global/diagnostics.nix
Normal file
115
modules/neovim/global/diagnostics.nix
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) str bool enum either;
|
||||||
|
in {
|
||||||
|
options.vim.diagnostics = {
|
||||||
|
virtual_text = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to use virtual text for diagnostics.
|
||||||
|
|
||||||
|
If multiple diagnostics are set for a namespace, one
|
||||||
|
prefix per diagnostic + the last diagnostic message
|
||||||
|
are shown.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
update_in_insert = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to update diagnostics in insert mode.
|
||||||
|
|
||||||
|
This is useful for slow diagnostics sources, but can
|
||||||
|
also cause lag in insert mode.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
underline = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to underline diagnostics.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
severity_sort = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to sort diagnostics by severity.
|
||||||
|
|
||||||
|
This affects the order in which signs and
|
||||||
|
virtual text are displayed. When true, higher
|
||||||
|
severities are displayed before lower severities (e.g.
|
||||||
|
ERROR is displayed before WARN)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
float = {
|
||||||
|
focusable = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether the floating window is focusable.
|
||||||
|
When true, the floating window can be focused and
|
||||||
|
interacted with. When false, the floating window is
|
||||||
|
not focusable and will not receive input.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
border = mkOption {
|
||||||
|
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||||
|
default = config.vim.ui.border.globalStyle;
|
||||||
|
description = ''
|
||||||
|
The border style of the floating window.
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
- none
|
||||||
|
- single
|
||||||
|
- double
|
||||||
|
- rounded
|
||||||
|
- solid
|
||||||
|
- shadow
|
||||||
|
|
||||||
|
See `:h nvim_open_win` for the available border
|
||||||
|
styles and their definitions.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
source = mkOption {
|
||||||
|
type = either bool (enum ["always" "if_many"]);
|
||||||
|
default = "auto";
|
||||||
|
description = ''
|
||||||
|
The source of the floating window.
|
||||||
|
Possible values:
|
||||||
|
- auto: Use the same source as the diagnostics
|
||||||
|
window.
|
||||||
|
- window: Use the window source.
|
||||||
|
- buffer: Use the buffer source.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
prefix = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
description = ''
|
||||||
|
Prefix string for each diagnostic in the floating window
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
suffix = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
description = ''
|
||||||
|
Suffix string for each diagnostic in the floating window
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
51
modules/neovim/global/ui/borders.nix
Normal file
51
modules/neovim/global/ui/borders.nix
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.attrsets) mapAttrs;
|
||||||
|
inherit (lib.lists) optionals;
|
||||||
|
inherit (lib.types) enum;
|
||||||
|
|
||||||
|
cfg = config.vim.ui.borders;
|
||||||
|
|
||||||
|
# See `:h nvim_open_win` for the available border styles
|
||||||
|
# this list can be updated if additional styles are added.
|
||||||
|
defaultStyles = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||||
|
in {
|
||||||
|
options.vim.ui.borders = {
|
||||||
|
enable = mkEnableOption "visible borders for windows that support configurable borders";
|
||||||
|
|
||||||
|
# TODO: support configurable border elements with a lua table converted from a list of str
|
||||||
|
# e.g. [ "╔" "═" "╗" "║" "╝" "═" "╚" "║" ]
|
||||||
|
globalStyle = mkOption {
|
||||||
|
type = enum defaultStyles;
|
||||||
|
default = "single";
|
||||||
|
description = ''
|
||||||
|
The global border style to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins = let
|
||||||
|
mkPluginStyleOption = name: {
|
||||||
|
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||||
|
|
||||||
|
style = mkOption {
|
||||||
|
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
||||||
|
default = cfg.globalStyle;
|
||||||
|
description = "The border style to use for the ${name} plugin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mapAttrs (_: mkPluginStyleOption) {
|
||||||
|
# despite not having it listed in example configuration, which-key does support the rounded type
|
||||||
|
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
|
||||||
|
which-key = "which-key";
|
||||||
|
lspsaga = "lspsaga";
|
||||||
|
nvim-cmp = "nvim-cmp";
|
||||||
|
lsp-signature = "lsp-signature";
|
||||||
|
code-action-menu = "code-actions-menu";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
32
modules/neovim/global/ui/icons.nix
Normal file
32
modules/neovim/global/ui/icons.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) str;
|
||||||
|
in {
|
||||||
|
options.vim.ui.icons = {
|
||||||
|
diagnostics = {
|
||||||
|
ERROR = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
description = "The icon to use for error messages";
|
||||||
|
};
|
||||||
|
|
||||||
|
WARN = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
description = "The icon to use for warning messages";
|
||||||
|
};
|
||||||
|
|
||||||
|
INFO = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
description = "The icon to use for info messages";
|
||||||
|
};
|
||||||
|
|
||||||
|
HINT = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
description = "The icon to use for hint messages";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
|
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
@ -12,26 +13,36 @@ in {
|
||||||
config = mkIf cfg.null-ls.enable (mkMerge [
|
config = mkIf cfg.null-ls.enable (mkMerge [
|
||||||
{
|
{
|
||||||
vim = {
|
vim = {
|
||||||
|
startPlugins = [
|
||||||
|
"none-ls"
|
||||||
|
"plenary-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
|
# null-ls implies LSP already being set up
|
||||||
|
# since it will hook into LSPs to receive information
|
||||||
lsp.enable = true;
|
lsp.enable = true;
|
||||||
startPlugins = ["none-ls"];
|
|
||||||
|
|
||||||
luaConfigRC.null_ls-setup = entryAnywhere ''
|
luaConfigRC = {
|
||||||
local null_ls = require("null-ls")
|
# early setup for null-ls
|
||||||
local null_helpers = require("null-ls.helpers")
|
null_ls-setup = entryAnywhere ''
|
||||||
local null_methods = require("null-ls.methods")
|
local null_ls = require("null-ls")
|
||||||
local ls_sources = {}
|
local null_helpers = require("null-ls.helpers")
|
||||||
'';
|
local null_methods = require("null-ls.methods")
|
||||||
|
local ls_sources = {}
|
||||||
|
'';
|
||||||
|
|
||||||
luaConfigRC.null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
|
# null-ls setup
|
||||||
require('null-ls').setup({
|
null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
|
||||||
debug = false,
|
require('null-ls').setup({
|
||||||
diagnostics_format = "[#{m}] #{s} (#{c})",
|
debug = ${boolToString cfg.null-ls.debug},
|
||||||
debounce = 250,
|
diagnostics_format = "${cfg.null-ls.diagnostics_format}",
|
||||||
default_timeout = 5000,
|
debounce = ${toString cfg.null-ls.debounce},
|
||||||
sources = ls_sources,
|
default_timeout = ${toString cfg.null-ls.default_timeout},
|
||||||
on_attach = default_on_attach
|
sources = ls_sources,
|
||||||
})
|
on_attach = default_on_attach
|
||||||
'';
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) attrsOf str;
|
inherit (lib.types) attrsOf str int;
|
||||||
in {
|
in {
|
||||||
options.vim.lsp.null-ls = {
|
options.vim.lsp.null-ls = {
|
||||||
enable = mkEnableOption "null-ls, also enabled automatically";
|
enable = mkEnableOption "null-ls, also enabled automatically";
|
||||||
|
|
||||||
|
debug = mkEnableOption "debugging information for `null-ls";
|
||||||
|
|
||||||
|
diagnostics_format = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "[#{m}] #{s} (#{c})";
|
||||||
|
description = "Diagnostic output format for null-ls";
|
||||||
|
};
|
||||||
|
|
||||||
|
debounce = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 250;
|
||||||
|
description = "Default debounce";
|
||||||
|
};
|
||||||
|
|
||||||
|
default_timeout = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 5000;
|
||||||
|
description = "Default timeout value, in miliseconds";
|
||||||
|
};
|
||||||
|
|
||||||
sources = mkOption {
|
sources = mkOption {
|
||||||
description = "null-ls sources";
|
description = "null-ls sources";
|
||||||
type = attrsOf str;
|
type = attrsOf str;
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
|
||||||
inherit (lib.lists) optionals;
|
|
||||||
inherit (lib.types) enum;
|
|
||||||
|
|
||||||
cfg = config.vim.ui.borders;
|
|
||||||
|
|
||||||
defaultStyles = ["none" "single" "double" "rounded"];
|
|
||||||
in {
|
|
||||||
options.vim.ui.borders = {
|
|
||||||
enable = mkEnableOption "visible borders for most windows";
|
|
||||||
|
|
||||||
globalStyle = mkOption {
|
|
||||||
type = enum defaultStyles;
|
|
||||||
default = "rounded";
|
|
||||||
description = ''
|
|
||||||
The global border style to use.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: make per-plugin borders configurable
|
|
||||||
plugins = let
|
|
||||||
mkPluginStyleOption = name: {
|
|
||||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
|
||||||
|
|
||||||
style = mkOption {
|
|
||||||
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
|
||||||
default = cfg.globalStyle;
|
|
||||||
description = "The border style to use for the ${name} plugin";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
# despite not having it listed in example configuration, which-key does support the rounded type
|
|
||||||
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
|
|
||||||
which-key = mkPluginStyleOption "which-key";
|
|
||||||
lspsaga = mkPluginStyleOption "lspsaga";
|
|
||||||
nvim-cmp = mkPluginStyleOption "nvim-cmp";
|
|
||||||
lsp-signature = mkPluginStyleOption "lsp-signature";
|
|
||||||
code-action-menu = mkPluginStyleOption "code-actions-menu";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./borders.nix
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,12 +1,11 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./noice
|
./breadcrumbs
|
||||||
./modes
|
|
||||||
./notifications
|
|
||||||
./smartcolumn
|
|
||||||
./colorizer
|
./colorizer
|
||||||
./illuminate
|
./illuminate
|
||||||
./breadcrumbs
|
./modes
|
||||||
./borders
|
./noice
|
||||||
|
./notifications
|
||||||
|
./smartcolumn
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||||
inherit (lib.types) package bool str listOf attrsOf;
|
inherit (lib.types) package bool str listOf attrsOf;
|
||||||
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
inherit (lib.nvim.types) pluginsOpt extraPluginType;
|
||||||
in {
|
in {
|
||||||
|
@ -38,7 +38,7 @@ in {
|
||||||
|
|
||||||
startPlugins = pluginsOpt {
|
startPlugins = pluginsOpt {
|
||||||
default = ["plenary-nvim"];
|
default = ["plenary-nvim"];
|
||||||
example = literalExpression ''
|
example = ''
|
||||||
[pkgs.vimPlugins.telescope-nvim]
|
[pkgs.vimPlugins.telescope-nvim]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ in {
|
||||||
|
|
||||||
optPlugins = pluginsOpt {
|
optPlugins = pluginsOpt {
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression ''
|
example = ''
|
||||||
[pkgs.vimPlugins.vim-ghost]
|
[pkgs.vimPlugins.vim-ghost]
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -80,7 +80,8 @@ in {
|
||||||
your custom plugins using nvf's modified DAG library.
|
your custom plugins using nvf's modified DAG library.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
example = literalExpression ''
|
example = literalMD ''
|
||||||
|
```nix
|
||||||
with pkgs.vimPlugins; {
|
with pkgs.vimPlugins; {
|
||||||
aerial = {
|
aerial = {
|
||||||
package = aerial-nvim;
|
package = aerial-nvim;
|
||||||
|
@ -93,13 +94,14 @@ in {
|
||||||
after = ["aerial"]; # place harpoon configuration after aerial
|
after = ["aerial"]; # place harpoon configuration after aerial
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
```
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages = mkOption {
|
extraPackages = mkOption {
|
||||||
type = listOf package;
|
type = listOf package;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression ''[pkgs.fzf pkgs.ripgrep]'';
|
example = ''[pkgs.fzf pkgs.ripgrep]'';
|
||||||
description = ''
|
description = ''
|
||||||
List of additional packages to make available to the Neovim
|
List of additional packages to make available to the Neovim
|
||||||
wrapper.
|
wrapper.
|
||||||
|
@ -107,7 +109,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# this defaults to `true` in the wrapper
|
# this defaults to `true` in the wrapper
|
||||||
# and since we passs this value to the wrapper
|
# and since we pass this value to the wrapper
|
||||||
# with an inherit, it should be `true` here as well
|
# with an inherit, it should be `true` here as well
|
||||||
withRuby =
|
withRuby =
|
||||||
mkEnableOption ''
|
mkEnableOption ''
|
||||||
|
@ -118,29 +120,25 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
withNodeJs = mkEnableOption ''
|
withNodeJs = mkEnableOption ''
|
||||||
NodeJs support in the Neovim wrapper.
|
NodeJs support in the Neovim wrapper
|
||||||
'';
|
'';
|
||||||
|
|
||||||
luaPackages = mkOption {
|
luaPackages = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression ''["magick" "serpent"]'';
|
example = ''["magick" "serpent"]'';
|
||||||
description = ''
|
description = "List of lua packages to install";
|
||||||
List of lua packages to install.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
withPython3 = mkEnableOption ''
|
withPython3 = mkEnableOption ''
|
||||||
Python3 support in the Neovim wrapper.
|
Python3 support in the Neovim wrapper
|
||||||
'';
|
'';
|
||||||
|
|
||||||
python3Packages = mkOption {
|
python3Packages = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression ''["pynvim"]'';
|
example = ''["pynvim"]'';
|
||||||
description = ''
|
description = "List of python packages to install";
|
||||||
List of python packages to install.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue