Compare commits

...

12 Commits

Author SHA1 Message Date
raf 4e347ab2b3
Merge 7d077f43f7 into 7b719d0044 2024-06-24 14:01:14 -04:00
raf 7b719d0044
Merge pull request #313 from NotAShelf/ts-error-translator
languages/ts: add `ts-error-translator.nvim` as an extension plugin
2024-06-24 17:40:06 +00:00
NotAShelf ba803c8684
docs: update release notes
Mention ts-error-translator's addition to the module system
2024-06-24 20:07:17 +03:00
NotAShelf f00ecd4eb9
languages/ts: add `ts-error-translator.nvim` as an extension plugin 2024-06-24 20:05:57 +03:00
raf 35c7327f81
Merge pull request #314 from diniamo/rustfmt
languages/rust: add format
2024-06-24 17:05:13 +00:00
diniamo 8a0cddd9bb languages/rust: add format 2024-06-24 19:02:04 +02:00
raf 923481640e
Merge pull request #306 from diniamo/fix-theme-dag
modules/theme: fix dag location
2024-06-24 16:29:53 +00:00
diniamo d6cd853520 modules/theme: fix dag location 2024-06-16 13:46:20 +02:00
NotAShelf 7d077f43f7
neovim/global: begin adding `vim.diagnostics.config()` options 2024-05-17 19:03:05 +03:00
NotAShelf cb57d3d417
plugins/ui: re-organize imports 2024-05-17 19:02:37 +03:00
NotAShelf 754c29cb7c
neovim/global: add ui/icons 2024-05-17 18:25:26 +03:00
NotAShelf 0e84e4ebed
modules/plugins: move plugins/ui to neovim/global/ui 2024-05-17 18:25:25 +03:00
14 changed files with 334 additions and 76 deletions

View File

@ -15,15 +15,27 @@ Release notes for release 0.7
[](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from
`anything` to a `submodule` for better type checking.
- Fix null `vim.lsp.mappings` generating an error and not being filtered out.
- Add basic transparency support for `oxocarbon` theme by setting the
highlight group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and
optionally `NvimTreeNormal` to `none`.
- Add basic transparency support for `oxocarbon` theme by setting the highlight
group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally
`NvimTreeNormal` to `none`.
[horriblename](https://github.com/horriblename):
- Fix broken treesitter-context keybinds in visual mode
- Depcrecate use of `__empty` to define empty tables in lua. Empty attrset are
no longer filtered and thus should be used instead.
- Deprecate use of `__empty` to define empty tables in lua. Empty attrset are no
longer filtered and thus should be used instead.
[jacekpoz](https://github.com/jacekpoz):
- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
- Fix Emac typo
[diniamo](https://github.com/diniamo):
- Move the `theme` dag entry to before `luaScript`.
- Add rustfmt as the default formatter for Rust
[NotAShelf](https://github.com/notashelf)
@ -39,13 +51,12 @@ Release notes for release 0.7
added once the [credo](https://github.com/rrrene/credo) linter has been added
to nixpkgs. A pull request is currently open.
- Remove vim-tidal and friends
- Remove vim-tidal and friends.
- Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed
blending issues in component separators.
[jacekpoz](https://github.com/jacekpoz):
- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
- Fix Emac typo
- Add
[ts-error-translator.nvim](https://github.com/dmmulroy/ts-error-translator.nvim)
extension of the TS language module, under
`vim.languages.ts.extensions.ts-error-translator`

View File

@ -1597,6 +1597,22 @@
"type": "github"
}
},
"plugin-ts-error-translator": {
"flake": false,
"locked": {
"lastModified": 1712269172,
"narHash": "sha256-NJ0qfKvkwZ/0GolAeATlQLyQ7nGN6Z6q3uRqI+73wPk=",
"owner": "dmmulroy",
"repo": "ts-error-translator.nvim",
"rev": "11ae55b28bde02663b5f983f59b0e3fd9c4e845b",
"type": "github"
},
"original": {
"owner": "dmmulroy",
"repo": "ts-error-translator.nvim",
"type": "github"
}
},
"plugin-vim-dirtytalk": {
"flake": false,
"locked": {
@ -1840,6 +1856,7 @@
"plugin-toggleterm-nvim": "plugin-toggleterm-nvim",
"plugin-tokyonight": "plugin-tokyonight",
"plugin-trouble": "plugin-trouble",
"plugin-ts-error-translator": "plugin-ts-error-translator",
"plugin-vim-dirtytalk": "plugin-vim-dirtytalk",
"plugin-vim-fugitive": "plugin-vim-fugitive",
"plugin-vim-illuminate": "plugin-vim-illuminate",

View File

@ -183,6 +183,11 @@
flake = false;
};
plugin-ts-error-translator = {
url = "github:dmmulroy/ts-error-translator.nvim";
flake = false;
};
# Copying/Registers
plugin-registers = {
url = "github:tversteeg/registers.nvim";

View File

@ -10,6 +10,7 @@
# Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: ./neovim + "/${p}") [
"global"
"init"
"mappings"
];

View 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]
];
}

View 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
'';
};
};
};
}

View 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";
};
};
}

View 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";
};
};
};
}

View File

@ -4,17 +4,33 @@
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString;
inherit (lib.lists) isList optionals;
inherit (lib.types) bool package str listOf either;
inherit (lib.types) bool package str listOf either enum;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.rust;
defaultFormat = "rustfmt";
formats = {
rustfmt = {
package = pkgs.rustfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.rustfmt.with({
command = "${cfg.format.package}/bin/rustfmt",
})
)
'';
};
};
in {
options.vim.languages.rust = {
enable = mkEnableOption "Rust language support";
@ -49,6 +65,22 @@ in {
};
};
format = {
enable = mkEnableOption "Rust formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
description = "Rust formatter to use";
type = enum (attrNames formats);
default = defaultFormat;
};
package = mkOption {
description = "Rust formatter package";
type = package;
default = formats.${cfg.format.type}.package;
};
};
dap = {
enable = mkOption {
description = "Rust Debug Adapter support";
@ -86,6 +118,11 @@ in {
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
})
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
vim = {
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];

View File

@ -9,10 +9,11 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.meta) getExe;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.types) enum either listOf package str bool;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.ts;
@ -32,6 +33,7 @@
}
'';
};
denols = {
package = pkgs.deno;
lspConfig = ''
@ -143,6 +145,24 @@ in {
inherit defaultDiagnosticsProvider;
};
};
extensions = {
ts-error-translator = {
enable = mkEnableOption ''
Typescript error translation with
[ts-error-translator.nvim](github.com/dmmulroy/ts-error-translator.nvim)
'';
setupOpts = mkPluginSetupOption "ts-error-translator" {
# This is the default configuration behaviour.
auto_override_publish_diagnostics = mkOption {
description = "Automatically override the publish_diagnostics handler";
type = bool;
default = true;
};
};
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -169,5 +189,12 @@ in {
inherit diagnosticsProviders;
};
})
(mkIf cfg.extensions."ts-error-translator".enable {
vim.startPlugins = ["ts-error-translator"];
vim.luaConfigRC.ts-error-translator = entryAnywhere ''
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
'';
})
]);
}

View File

@ -45,10 +45,12 @@ in {
config = mkIf cfg.enable {
vim = {
startPlugins = [cfg.name];
luaConfigRC = {
themeSetup = entryBefore ["theme"] cfg.extraConfig;
theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;});
};
configRC.theme = entryBefore ["luaScript"] ''
lua << EOF
${cfg.extraConfig}
${supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;})}
EOF
'';
};
};
}

View File

@ -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";
};
};
}

View File

@ -1,5 +0,0 @@
{
imports = [
./borders.nix
];
}

View File

@ -1,12 +1,11 @@
{
imports = [
./noice
./modes
./notifications
./smartcolumn
./breadcrumbs
./colorizer
./illuminate
./breadcrumbs
./borders
./modes
./noice
./notifications
./smartcolumn
];
}