mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
neovim/global: begin adding vim.diagnostics.config()
options
This commit is contained in:
parent
cb57d3d417
commit
7d077f43f7
4 changed files with 157 additions and 30 deletions
|
@ -1,6 +1,12 @@
|
||||||
{lib}: {
|
{lib, ...}: let
|
||||||
imports = lib.concatLists [
|
inherit (lib.lists) concatLists;
|
||||||
|
inherit (lib.filesystem) listFilesRecursive;
|
||||||
|
in {
|
||||||
|
imports = concatLists [
|
||||||
# Configuration options for Neovim UI
|
# Configuration options for Neovim UI
|
||||||
(lib.filesystem.listFilesRecursive ./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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -10,14 +10,18 @@
|
||||||
|
|
||||||
cfg = config.vim.ui.borders;
|
cfg = config.vim.ui.borders;
|
||||||
|
|
||||||
defaultStyles = ["none" "single" "double" "rounded"];
|
# 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 {
|
in {
|
||||||
options.vim.ui.borders = {
|
options.vim.ui.borders = {
|
||||||
enable = mkEnableOption "visible borders for most windows";
|
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 {
|
globalStyle = mkOption {
|
||||||
type = enum defaultStyles;
|
type = enum defaultStyles;
|
||||||
default = "rounded";
|
default = "single";
|
||||||
description = ''
|
description = ''
|
||||||
The global border style to use.
|
The global border style to use.
|
||||||
'';
|
'';
|
||||||
|
@ -37,11 +41,11 @@ in {
|
||||||
mapAttrs (_: mkPluginStyleOption) {
|
mapAttrs (_: mkPluginStyleOption) {
|
||||||
# despite not having it listed in example configuration, which-key does support the rounded type
|
# 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
|
# additionally, it supports a "shadow" type that is similar to none but is of higher contrast
|
||||||
which-key = mkPluginStyleOption "which-key";
|
which-key = "which-key";
|
||||||
lspsaga = mkPluginStyleOption "lspsaga";
|
lspsaga = "lspsaga";
|
||||||
nvim-cmp = mkPluginStyleOption "nvim-cmp";
|
nvim-cmp = "nvim-cmp";
|
||||||
lsp-signature = mkPluginStyleOption "lsp-signature";
|
lsp-signature = "lsp-signature";
|
||||||
code-action-menu = mkPluginStyleOption "code-actions-menu";
|
code-action-menu = "code-actions-menu";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
inherit (lib.types) str;
|
inherit (lib.types) str;
|
||||||
in {
|
in {
|
||||||
options.vim.ui.icons = {
|
options.vim.ui.icons = {
|
||||||
|
diagnostics = {
|
||||||
ERROR = mkOption {
|
ERROR = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = " ";
|
default = " ";
|
||||||
|
@ -27,4 +28,5 @@ in {
|
||||||
description = "The icon to use for hint messages";
|
description = "The icon to use for hint messages";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue