This commit is contained in:
poz 2024-08-07 17:11:33 +02:00 committed by GitHub
commit d7351f0021
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 96 additions and 4 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://github.com/jacekpoz): [jacekpoz](https://jacekpoz.pl):
- 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://github.com/jacekpoz): [jacekpoz](https://jacekpoz.pl):
- 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

@ -62,14 +62,17 @@ 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://github.com/jacekpoz): [jacekpoz](https://jacekpoz.pl):
[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`.

View file

@ -628,9 +628,15 @@
}; };
plugin-nvim-nio = { plugin-nvim-nio = {
# (required nvim-dap-ui) # (required by 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

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

View file

@ -0,0 +1,23 @@
{
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

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

View file

@ -0,0 +1,53 @@
{
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.
To add custom templates add a directory containing `lua/templates/*.lua` to `vim.additionalRuntimePaths`.
More documentation on the templates available at https://github.com/otavioschwanck/new-file-template.nvim?tab=readme-ov-file#creating-new-templates
'';
};
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 templates for specific filetypes (only disables default templates, user templates will still work)";
};
disableSpecific = mkOption {
type = attrsOf (listOf str);
default = {};
description = "Disable specific regexp for the default templates. Example: { ruby = [ \".*\" ]; }";
example = "{ ruby = [\".*\"]; }";
};
suffixAsFiletype = mkOption {
type = bool;
default = false;
description = "Use suffix of filename rather than vim.bo.filetype as filetype";
};
};
};
}