mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Compare commits
11 commits
d57a83ee39
...
1162be7c95
Author | SHA1 | Date | |
---|---|---|---|
|
1162be7c95 | ||
95705bc43b | |||
|
de20ff2c51 | ||
|
fd65c83956 | ||
ff9a93d3ed | |||
d88b1129e5 | |||
|
f7db34b197 | ||
|
de19f0249a | ||
|
5c9746aa30 | ||
|
32eb9c3de6 | ||
|
d3cd9809b2 |
17 changed files with 163 additions and 80 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ configuration formats.
|
||||||
longer filtered and thus should be used instead.
|
longer filtered and thus should be used instead.
|
||||||
- Add dap-go for better dap configurations
|
- Add dap-go for better dap configurations
|
||||||
- Make noice.nvim customizable
|
- Make noice.nvim customizable
|
||||||
|
- Standardize border style options and add custom borders
|
||||||
|
|
||||||
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
||||||
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
||||||
|
@ -62,14 +63,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`.
|
||||||
|
@ -140,10 +144,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 `print-nvf-config` & `print-nvf-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
|
||||||
using neovimConfig or `programs.nvf.enable`.
|
using neovimConfig or `programs.nvf.enable`.
|
||||||
- `print-nvf-config` will display your `init.lua`, in full.
|
- `nvf-print-config` will display your `init.lua`, in full.
|
||||||
- `print-nvf-config-path` will display the path to _a clone_ of your
|
- `nvf-print-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.
|
||||||
|
|
|
@ -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;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
typesCustom = import ./custom.nix {inherit lib;};
|
typesCustom = import ./custom.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
inherit (typesCustom) anythingConcatLists char;
|
inherit (typesCustom) anythingConcatLists char;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||||
in {
|
in {
|
||||||
inherit extraPluginType fromInputs pluginType;
|
inherit extraPluginType fromInputs pluginType;
|
||||||
|
|
||||||
|
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
|
||||||
|
|
||||||
pluginsOpt = {
|
pluginsOpt = {
|
||||||
description,
|
description,
|
||||||
example,
|
example,
|
||||||
|
|
|
@ -7,11 +7,9 @@ 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 getAttr;
|
inherit (lib.attrsets) recursiveUpdate;
|
||||||
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
|
||||||
|
@ -33,12 +31,21 @@ 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 = {pname, ...} @ attrs: let
|
buildPlug = attrs: let
|
||||||
src = getAttr ("plugin-" + pname) inputs;
|
src = inputs."plugin-${attrs.pname}";
|
||||||
in
|
in
|
||||||
pkgs.stdenvNoCC.mkDerivation ({
|
pkgs.stdenvNoCC.mkDerivation ({
|
||||||
inherit src;
|
|
||||||
version = src.shortRev or src.shortDirtyRev or "dirty";
|
version = src.shortRev or src.shortDirtyRev or "dirty";
|
||||||
|
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs.vimUtils; [
|
||||||
|
vimCommandCheckHook
|
||||||
|
vimGenDocHook
|
||||||
|
neovimRequireCheckHook
|
||||||
|
];
|
||||||
|
passthru.vimPlugin = true;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
|
@ -50,41 +57,27 @@ inputs: {
|
||||||
}
|
}
|
||||||
// attrs);
|
// attrs);
|
||||||
|
|
||||||
noBuildPlug = {pname, ...} @ attrs: let
|
|
||||||
input = getAttr ("plugin-" + pname) inputs;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
version = input.shortRev or input.shortDirtyRev or "dirty";
|
|
||||||
outPath = getAttr ("plugin-" + pname) inputs;
|
|
||||||
}
|
|
||||||
// attrs;
|
|
||||||
|
|
||||||
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
||||||
|
|
||||||
|
pluginBuilders = {
|
||||||
|
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: (
|
(
|
||||||
if (isString plug)
|
plug:
|
||||||
then
|
if (isString plug)
|
||||||
(
|
then pluginBuilders.${plug} or (buildPlug {pname = plug;})
|
||||||
if (plug == "nvim-treesitter")
|
else plug
|
||||||
then (buildTreesitterPlug vimOptions.treesitter.grammars)
|
)
|
||||||
else if (plug == "flutter-tools-patched")
|
(filter (f: f != null) plugins);
|
||||||
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;
|
||||||
|
@ -114,20 +107,11 @@ 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 "print-nvf-config" ''
|
printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}";
|
||||||
cat << EOF
|
printConfigPath = pkgs.writers.writeDashBin "nvf-print-config-path" "echo -n ${dummyInit}";
|
||||||
${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;
|
||||||
|
@ -137,7 +121,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";
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
in {
|
in {
|
||||||
|
@ -22,7 +23,7 @@ in {
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString config.vim.ui.borders.enable ''
|
optionalString config.vim.ui.borders.enable ''
|
||||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ in {
|
||||||
|
|
||||||
pluginRC.code-action-menu = entryAnywhere ''
|
pluginRC.code-action-menu = entryAnywhere ''
|
||||||
-- border configuration
|
-- border configuration
|
||||||
vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}'
|
vim.g.code_action_menu_window_border = ${toLuaObject config.vim.ui.borders.plugins.code-action-menu.style}
|
||||||
|
|
||||||
-- show individual sections of the code action menu
|
-- show individual sections of the code action menu
|
||||||
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
||||||
|
|
|
@ -4,31 +4,34 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.nvim.types) borderType;
|
||||||
inherit (lib.types) enum;
|
|
||||||
|
|
||||||
cfg = config.vim.ui.borders;
|
cfg = config.vim.ui.borders;
|
||||||
|
|
||||||
defaultStyles = ["none" "single" "double" "rounded"];
|
|
||||||
in {
|
in {
|
||||||
options.vim.ui.borders = {
|
options.vim.ui.borders = {
|
||||||
enable = mkEnableOption "visible borders for most windows";
|
enable = mkEnableOption "visible borders for most windows";
|
||||||
|
|
||||||
globalStyle = mkOption {
|
globalStyle = mkOption {
|
||||||
type = enum defaultStyles;
|
type = borderType;
|
||||||
default = "rounded";
|
default = "rounded";
|
||||||
description = ''
|
description = ''
|
||||||
The global border style to use.
|
The global border style to use.
|
||||||
|
|
||||||
|
If a list is given, it should have a length of eight or any divisor of
|
||||||
|
eight. The array will specify the eight chars building up the border in
|
||||||
|
a clockwise fashion starting with the top-left corner. You can specify
|
||||||
|
a different highlight group for each character by passing a
|
||||||
|
[char, "YourHighlightGroup"] instead
|
||||||
'';
|
'';
|
||||||
|
example = ["╔" "═" "╗" "║" "╝" "═" "╚" "║"];
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: make per-plugin borders configurable
|
|
||||||
plugins = let
|
plugins = let
|
||||||
mkPluginStyleOption = name: {
|
mkPluginStyleOption = name: {
|
||||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||||
|
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
type = borderType;
|
||||||
default = cfg.globalStyle;
|
default = cfg.globalStyle;
|
||||||
description = "The border style to use for the ${name} plugin";
|
description = "The border style to use for the ${name} plugin";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) nullOr listOf enum bool str int;
|
inherit (lib.types) nullOr listOf enum bool str int either;
|
||||||
inherit (lib.modules) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||||
mkSimpleIconOption = default:
|
mkSimpleIconOption = default:
|
||||||
mkOption {
|
mkOption {
|
||||||
inherit default;
|
inherit default;
|
||||||
|
@ -212,8 +212,7 @@ in {
|
||||||
# position = {}
|
# position = {}
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = enum ["single" "rounded" "double" "solid" "none"];
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use";
|
description = "border style to use";
|
||||||
};
|
};
|
||||||
|
@ -236,8 +235,7 @@ in {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use for the left section of Navbuddy UI";
|
description = "border style to use for the left section of Navbuddy UI";
|
||||||
};
|
};
|
||||||
|
@ -254,8 +252,7 @@ in {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use for the middle section of Navbuddy UI";
|
description = "border style to use for the middle section of Navbuddy UI";
|
||||||
};
|
};
|
||||||
|
@ -265,8 +262,7 @@ in {
|
||||||
# there is no size option for the right section, it fills the remaining space
|
# there is no size option for the right section, it fills the remaining space
|
||||||
right = {
|
right = {
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use for the right section of Navbuddy UI";
|
description = "border style to use for the right section of Navbuddy UI";
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ in {
|
||||||
|
|
||||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
||||||
window = {
|
window = {
|
||||||
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
|
||||||
},
|
},
|
||||||
''}
|
''}
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
./ccc
|
./ccc
|
||||||
./gestures
|
./gestures
|
||||||
./motion
|
./motion
|
||||||
|
./new-file-template
|
||||||
./telescope
|
./telescope
|
||||||
./icon-picker
|
./icon-picker
|
||||||
./images
|
./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,54 @@
|
||||||
|
{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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.strings) toUpper;
|
inherit (lib.strings) toUpper;
|
||||||
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
|
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline borderType;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -453,7 +453,7 @@ in {
|
||||||
};
|
};
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
description = "Border style of the notification window";
|
description = "Border style of the notification window";
|
||||||
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
type = borderType;
|
||||||
default =
|
default =
|
||||||
if config.vim.ui.borders.enable
|
if config.vim.ui.borders.enable
|
||||||
then config.vim.ui.borders.globalStyle
|
then config.vim.ui.borders.globalStyle
|
||||||
|
|
Loading…
Reference in a new issue