mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-20 18:38:12 +00:00
Compare commits
1 commit
182c53ada9
...
daf06d580b
Author | SHA1 | Date | |
---|---|---|---|
daf06d580b |
8 changed files with 40 additions and 96 deletions
|
@ -63,24 +63,6 @@ Note that we are looking to add more alternatives in the future like
|
||||||
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||||
everyone.
|
everyone.
|
||||||
|
|
||||||
### `type` based modules removed {#sec-type-based-modules-removed}
|
|
||||||
|
|
||||||
As part of the autocompletion rewrite, modules that used to use a `type` option
|
|
||||||
have been replaced by per-plugin modules instead. Since both modules only had
|
|
||||||
one type, you can simply change
|
|
||||||
|
|
||||||
- `vim.autocomplete.*` -> `vim.autocomplete.nvim-cmp.*`
|
|
||||||
- `vim.autopairs.enable` -> `vim.autopairs.nvim-autopairs.enable`
|
|
||||||
|
|
||||||
### `nixpkgs-fmt` removed in favor of `nixfmt` {#sec-nixpkgs-fmt-deprecation}
|
|
||||||
|
|
||||||
`nixpkgs-fmt` has been archived for a while, and it's finally being removed in
|
|
||||||
favor of nixfmt (more information can be found
|
|
||||||
[here](https://github.com/nix-community/nixpkgs-fmt?tab=readme-ov-file#nixpkgs-fmt---nix-code-formatter-for-nixpkgs).
|
|
||||||
|
|
||||||
To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
|
||||||
`nixfmt`.
|
|
||||||
|
|
||||||
## Changelog {#sec-release-0.7-changelog}
|
## Changelog {#sec-release-0.7-changelog}
|
||||||
|
|
||||||
[ItsSorae](https://github.com/ItsSorae):
|
[ItsSorae](https://github.com/ItsSorae):
|
||||||
|
@ -230,7 +212,8 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
`vim.languages.ts.extensions.ts-error-translator` to aid with Typescript
|
`vim.languages.ts.extensions.ts-error-translator` to aid with Typescript
|
||||||
development.
|
development.
|
||||||
|
|
||||||
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available under `vim.filetree.neo-tree`, similar to nvimtree.
|
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available
|
||||||
|
under `vim.filetree.neo-tree`, similar to nvimtree.
|
||||||
|
|
||||||
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
|
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
|
||||||
closure. Both of those scripts have been automatically added to your PATH upon
|
closure. Both of those scripts have been automatically added to your PATH upon
|
||||||
|
@ -279,7 +262,6 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
ccc
|
ccc
|
||||||
- Fixed typo in Otter's setupOpts
|
|
||||||
- Add Neorg support under `vim.notes.neorg`
|
- Add Neorg support under `vim.notes.neorg`
|
||||||
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||||
`vim.languages.kotlin`
|
`vim.languages.kotlin`
|
||||||
|
@ -296,7 +278,3 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
- Add LSP support for Scala via
|
- Add LSP support for Scala via
|
||||||
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
||||||
|
|
||||||
[nezia1](https://github.com/nezia1):
|
|
||||||
|
|
||||||
- Add [biome](https://github.com/biomejs/biome) support for Typescript, CSS and Svelte. Enable them via [](#opt-vim.languages.ts.format.type), [](#opt-vim.languages.css.format.type) and [](#opt-vim.languages.svelte.format.type) respectively.
|
|
||||||
- Replace [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) with [nixfmt](https://github.com/NixOS/nixfmt) (nixfmt-rfc-style).
|
|
||||||
|
|
|
@ -31,11 +31,6 @@ in {
|
||||||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||||
'')
|
'')
|
||||||
(mkRemovedOptionModule ["vim" "autocomplete" "sources"] ''
|
|
||||||
vim.autocomplete.sources has been removed in favor of per-plugin modules.
|
|
||||||
You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources
|
|
||||||
instead.
|
|
||||||
'')
|
|
||||||
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||||
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||||
'')
|
'')
|
||||||
|
|
|
@ -6,13 +6,17 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
|
||||||
cfg = config.vim.autocomplete.nvim-cmp;
|
cfg = config.vim.autocomplete.nvim-cmp;
|
||||||
luasnipEnable = config.vim.snippets.luasnip.enable;
|
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||||
inherit (cfg) mappings;
|
|
||||||
|
self = import ./nvim-cmp.nix {inherit lib config;};
|
||||||
|
mappingDefinitions = self.options.vim.autocomplete.nvim-cmp.mappings;
|
||||||
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
@ -41,20 +45,39 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
|
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
|
||||||
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
|
local luasnip = require("luasnip")
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
cmp.setup(${toLuaObject cfg.setupOpts})
|
cmp.setup(${toLuaObject cfg.setupOpts})
|
||||||
'');
|
'');
|
||||||
|
|
||||||
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
|
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
|
||||||
autocomplete.nvim-cmp.setupOpts.mapping = {
|
autocomplete.nvim-cmp.setupOpts.mapping = {
|
||||||
${mappings.complete} = mkLuaInline "cmp.mapping.complete()";
|
${mappings.complete.value} = mkLuaInline "cmp.mapping.complete()";
|
||||||
${mappings.close} = mkLuaInline "cmp.mapping.abort()";
|
${mappings.close.value} = mkLuaInline "cmp.mapping.abort()";
|
||||||
${mappings.scrollDocsUp} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
${mappings.scrollDocsUp.value} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
||||||
${mappings.scrollDocsDown} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
${mappings.scrollDocsDown.value} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
||||||
${mappings.confirm} = mkLuaInline "cmp.mapping.confirm({ select = true })";
|
|
||||||
|
|
||||||
${mappings.next} = mkLuaInline ''
|
${mappings.confirm.value} = mkLuaInline ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
${
|
||||||
|
if luasnipEnable
|
||||||
|
then ''
|
||||||
|
if luasnip.expandable() then
|
||||||
|
luasnip.expand()
|
||||||
|
else
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else "cmp.confirm({ select = true })"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
'';
|
||||||
|
|
||||||
|
${mappings.next.value} = mkLuaInline ''
|
||||||
cmp.mapping(function(fallback)
|
cmp.mapping(function(fallback)
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
@ -75,7 +98,7 @@ in {
|
||||||
end)
|
end)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
${mappings.previous} = mkLuaInline ''
|
${mappings.previous.value} = mkLuaInline ''
|
||||||
cmp.mapping(function(fallback)
|
cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
|
|
|
@ -63,18 +63,6 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
|
||||||
package = pkgs.biome;
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.css = {
|
options.vim.languages.css = {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib) concatStringsSep;
|
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
@ -63,10 +62,10 @@
|
||||||
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
|
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
|
||||||
},
|
},
|
||||||
''}
|
''}
|
||||||
${optionalString (cfg.format.type == "nixfmt")
|
${optionalString (cfg.format.type == "nixpkgs-fmt")
|
||||||
''
|
''
|
||||||
formatting = {
|
formatting = {
|
||||||
command = {"${cfg.format.package}/bin/nixfmt"},
|
command = {"${cfg.format.package}/bin/nixpkgs-fmt"},
|
||||||
},
|
},
|
||||||
''}
|
''}
|
||||||
},
|
},
|
||||||
|
@ -91,19 +90,10 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nixfmt = {
|
nixpkgs-fmt = {
|
||||||
package = pkgs.nixfmt-rfc-style;
|
package = pkgs.nixpkgs-fmt;
|
||||||
nullConfig = ''
|
# Never need to use null-ls for nixpkgs-fmt
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.nixfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/nixfmt"
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs-fmt = null; # removed
|
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||||
|
@ -185,12 +175,6 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = cfg.format.type != "nixpkgs-fmt";
|
|
||||||
message = "nixpkgs-fmt has been archived upstream. Please use one of the following instead: ${concatStringsSep ", " (attrNames formats)}";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
vim.pluginRC.nix = ''
|
vim.pluginRC.nix = ''
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "nix",
|
pattern = "nix",
|
||||||
|
|
|
@ -48,18 +48,6 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
|
||||||
package = pkgs.biome;
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
|
|
|
@ -95,18 +95,6 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
|
||||||
package = pkgs.biome;
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
|
|
|
@ -32,7 +32,7 @@ in {
|
||||||
|
|
||||||
pluginRC.otter-nvim = entryAnywhere ''
|
pluginRC.otter-nvim = entryAnywhere ''
|
||||||
-- Enable otter diagnostics viewer
|
-- Enable otter diagnostics viewer
|
||||||
require("otter").setup(${toLuaObject cfg.otter-nvim.setupOpts})
|
require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue