mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
plugins/new-file-template: init module
This commit is contained in:
parent
773186d93d
commit
6f4df2e8aa
5 changed files with 85 additions and 1 deletions
|
@ -628,9 +628,15 @@
|
|||
};
|
||||
|
||||
plugin-nvim-nio = {
|
||||
# (required nvim-dap-ui)
|
||||
# (required by nvim-dap-ui)
|
||||
url = "github:nvim-neotest/nvim-nio";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-new-file-template-nvim = {
|
||||
# (required by new-file-template.nvim)
|
||||
url = "github:otavioschwanck/new-file-template.nvim";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
./ccc
|
||||
./gestures
|
||||
./motion
|
||||
./new-file-template
|
||||
./telescope
|
||||
./icon-picker
|
||||
./images
|
||||
|
|
23
modules/plugins/utility/new-file-template/config.nix
Normal file
23
modules/plugins/utility/new-file-template/config.nix
Normal 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})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/new-file-template/default.nix
Normal file
6
modules/plugins/utility/new-file-template/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./new-file-template.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
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";
|
||||
};
|
||||
|
||||
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 = [ \".*\" ]; }";
|
||||
};
|
||||
|
||||
suffixAsFiletype = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Use suffix of filename rather than vim.bo.filetype as filetype";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue