Compare commits

..

No commits in common. "95705bc43b68d422eda690e342b001919d762bd5" and "ff9a93d3edefda6e74552b916cf7da9e6be4684a" have entirely different histories.

11 changed files with 68 additions and 141 deletions

View file

@ -83,7 +83,7 @@ Release notes for release 0.5
- Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule` - Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`
[jacekpoz](https://jacekpoz.pl): [jacekpoz](https://github.com/jacekpoz):
- Fixed scrollOffset not being used - Fixed scrollOffset not being used

View file

@ -62,7 +62,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
- Added rose-pine theme. - Added rose-pine theme.
[jacekpoz](https://jacekpoz.pl): [jacekpoz](https://github.com/jacekpoz):
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated. - Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.

View file

@ -63,17 +63,14 @@ configuration formats.
recommended to go through rustacean.nvim's README to take a closer look at its recommended to go through rustacean.nvim's README to take a closer look at its
features and usage features and usage
[jacekpoz](https://jacekpoz.pl): [jacekpoz](https://github.com/jacekpoz):
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp [ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
- Add [ocaml-lsp] support - Add [ocaml-lsp] support
- Fix "Emac" typo - Fix "Emac" typo
- Add [new-file-template.nvim] to automatically fill new file contents using templates.
[diniamo](https://github.com/diniamo): [diniamo](https://github.com/diniamo):
- Move the `theme` dag entry to before `luaScript`. - Move the `theme` dag entry to before `luaScript`.
@ -144,10 +141,10 @@ configuration formats.
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available - Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available
under `vim.filetree.neo-tree`, similar to nvimtree. under `vim.filetree.neo-tree`, similar to nvimtree.
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim - Add `print-nvf-config` & `print-nvf-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
using neovimConfig or `programs.nvf.enable`. using neovimConfig or `programs.nvf.enable`.
- `nvf-print-config` will display your `init.lua`, in full. - `print-nvf-config` will display your `init.lua`, in full.
- `nvf-print-config-path` will display the path to _a clone_ of your - `print-nvf-config-path` will display the path to _a clone_ of your
`init.lua`. This is not the path used by the Neovim wrapper, but an `init.lua`. This is not the path used by the Neovim wrapper, but an
identical clone. identical clone.

View file

@ -69,11 +69,11 @@
}, },
"mnw": { "mnw": {
"locked": { "locked": {
"lastModified": 1722191188, "lastModified": 1721440413,
"narHash": "sha256-YF//iMALbrd2Ni9aju7w8NniH16Qz6RFTRD6md5UkDc=", "narHash": "sha256-PF/FbgCUZ6mQrKp28G2YoVDlSThBy8AxIT9d2Ju3kTY=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "mnw", "repo": "mnw",
"rev": "c7b289f3f5a31b6e744be37d83fc231816621231", "rev": "4ea225024677e7c3a96080af8624fd3aa5dfa1b6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -129,11 +129,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1722141560, "lastModified": 1721016451,
"narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", "narHash": "sha256-Cypl9ORr5UjtBsbjXMTJRepTe362yNVrPrntUvHiTaw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", "rev": "a14c5d651cee9ed70f9cd9e83f323f1e531002db",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -628,15 +628,9 @@
}; };
plugin-nvim-nio = { plugin-nvim-nio = {
# (required by nvim-dap-ui) # (required nvim-dap-ui)
url = "github:nvim-neotest/nvim-nio"; url = "github:nvim-neotest/nvim-nio";
flake = false; flake = false;
}; };
plugin-new-file-template-nvim = {
# (required by new-file-template.nvim)
url = "github:otavioschwanck/new-file-template.nvim";
flake = false;
};
}; };
} }

View file

@ -7,9 +7,11 @@ inputs: {
extraModules ? [], extraModules ? [],
}: let }: let
inherit (pkgs) vimPlugins; inherit (pkgs) vimPlugins;
inherit (pkgs.vimUtils) buildVimPlugin;
inherit (lib.strings) isString toString; inherit (lib.strings) isString toString;
inherit (lib.lists) filter map concatLists; inherit (lib.lists) filter map concatLists;
inherit (lib.attrsets) recursiveUpdate; inherit (lib.attrsets) recursiveUpdate getAttr;
inherit (lib.asserts) assertMsg;
# import modules.nix with `check`, `pkgs` and `lib` as arguments # import modules.nix with `check`, `pkgs` and `lib` as arguments
# check can be disabled while calling this file is called # check can be disabled while calling this file is called
@ -31,21 +33,12 @@ inputs: {
# build a vim plugin with the given name and arguments # build a vim plugin with the given name and arguments
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug # if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
# instead # instead
buildPlug = attrs: let buildPlug = {pname, ...} @ attrs: let
src = inputs."plugin-${attrs.pname}"; src = getAttr ("plugin-" + pname) inputs;
in in
pkgs.stdenvNoCC.mkDerivation ({ pkgs.stdenvNoCC.mkDerivation ({
version = src.shortRev or src.shortDirtyRev or "dirty";
inherit src; inherit src;
version = src.shortRev or src.shortDirtyRev or "dirty";
nativeBuildInputs = with pkgs.vimUtils; [
vimCommandCheckHook
vimGenDocHook
neovimRequireCheckHook
];
passthru.vimPlugin = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -57,27 +50,41 @@ inputs: {
} }
// attrs); // attrs);
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); noBuildPlug = {pname, ...} @ attrs: let
input = getAttr ("plugin-" + pname) inputs;
in
{
version = input.shortRev or input.shortDirtyRev or "dirty";
outPath = getAttr ("plugin-" + pname) inputs;
}
// attrs;
pluginBuilders = { buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
flutter-tools-patched =
buildPlug
{
pname = "flutter-tools";
patches = [../patches/flutter-tools.patch];
};
};
buildConfigPlugins = plugins: buildConfigPlugins = plugins:
map map
( (plug: (
plug: if (isString plug)
if (isString plug) then
then pluginBuilders.${plug} or (buildPlug {pname = plug;}) (
else plug if (plug == "nvim-treesitter")
) then (buildTreesitterPlug vimOptions.treesitter.grammars)
(filter (f: f != null) plugins); else if (plug == "flutter-tools-patched")
then
(
buildPlug
{
pname = "flutter-tools";
patches = [../patches/flutter-tools.patch];
}
)
else noBuildPlug {pname = plug;}
)
else plug
))
(filter
(f: f != null)
plugins);
# built (or "normalized") plugins that are modified # built (or "normalized") plugins that are modified
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins; builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
@ -107,11 +114,20 @@ inputs: {
inherit extraLuaPackages extraPython3Packages; inherit extraLuaPackages extraPython3Packages;
}; };
dummyInit = pkgs.writeText "nvf-init.lua" vimOptions.builtLuaConfigRC;
# Additional helper scripts for printing and displaying nvf configuration # Additional helper scripts for printing and displaying nvf configuration
# in your commandline. # in your commandline.
printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}"; printConfig = pkgs.writers.writeDashBin "print-nvf-config" ''
printConfigPath = pkgs.writers.writeDashBin "nvf-print-config-path" "echo -n ${dummyInit}"; cat << EOF
${vimOptions.builtLuaConfigRC}
EOF
'';
printConfigPath = pkgs.writers.writeDashBin "print-nvf-config-path" ''
realpath ${pkgs.writeTextFile {
name = "nvf-init.lua";
text = vimOptions.builtLuaConfigRC;
}}
'';
in { in {
inherit (module) options config; inherit (module) options config;
inherit (module._module.args) pkgs; inherit (module._module.args) pkgs;
@ -121,7 +137,7 @@ in {
neovim = pkgs.symlinkJoin { neovim = pkgs.symlinkJoin {
name = "nvf-with-helpers"; name = "nvf-with-helpers";
paths = [neovim-wrapped printConfig printConfigPath]; paths = [neovim-wrapped printConfig printConfigPath];
postBuild = "echo Helpers added"; postBuild = "echo helpers added";
meta = { meta = {
description = "Wrapped version of Neovim with additional helper scripts"; description = "Wrapped version of Neovim with additional helper scripts";

View file

@ -4,7 +4,6 @@
./ccc ./ccc
./gestures ./gestures
./motion ./motion
./new-file-template
./telescope ./telescope
./icon-picker ./icon-picker
./images ./images

View file

@ -1,23 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.utility.new-file-template;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"new-file-template-nvim"
];
pluginRC.new-file-template = entryAnywhere ''
require('new-file-template').setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -1,6 +0,0 @@
{
imports = [
./config.nix
./new-file-template.nix
];
}

View file

@ -1,54 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkOption;
inherit (lib.types) attrsOf bool listOf str;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.new-file-template = {
enable = mkOption {
type = bool;
default = false;
description = ''
new-file-template.nvim: Automatically insert a template on new files in neovim.
::: {.note}
For custom templates add a directory containing `lua/templates/*.lua`
to `vim.additionalRuntimePaths`.
:::
[custom-template-docs]: https://github.com/otavioschwanck/new-file-template.nvim?tab=readme-ov-file#creating-new-templates
More documentation on the templates available at [custom-template-docs]
'';
};
setupOpts = mkPluginSetupOption "nvim-file-template.nvim" {
disableInsert = mkOption {
type = bool;
default = false;
description = "Enter insert mode after inserting the template";
};
disableAutocmd = mkOption {
type = bool;
default = false;
description = "Disable the autocmd that creates the template";
};
disableFiletype = mkOption {
type = listOf str;
default = [];
description = "Disable default templates for specific filetypes";
};
disableSpecific = mkOption {
type = attrsOf (listOf str);
default = {};
description = "Disable specific regexp for the default templates.";
example = "{ ruby = [\".*\"]; }";
};
suffixAsFiletype = mkOption {
type = bool;
default = false;
description = "Use suffix of filename rather than `vim.bo.filetype` as filetype";
};
};
};
}

View file

@ -155,7 +155,11 @@ in {
-- The following list is generated from `vim.additionalRuntimePaths` -- The following list is generated from `vim.additionalRuntimePaths`
-- and is used to append additional runtime paths to the -- and is used to append additional runtime paths to the
-- `runtimepath` option. -- `runtimepath` option.
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths}) local additionalRuntimePaths = ${listToLuaTable cfg.additionalRuntimePaths};
for _, path in ipairs(additionalRuntimePaths) do
vim.opt.runtimepath:append(path)
end
''} ''}
${optionalString cfg.disableDefaultRuntimePaths '' ${optionalString cfg.disableDefaultRuntimePaths ''