mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 09:18:38 +02:00
This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition. The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix. For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
59 lines
1.5 KiB
Nix
59 lines
1.5 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.plugins.nvim-autopairs;
|
|
helpers = import ../helpers.nix { lib = lib; };
|
|
in
|
|
{
|
|
options.plugins.nvim-autopairs = {
|
|
enable = mkEnableOption "Enable nvim-autopairs";
|
|
|
|
pairs = mkOption {
|
|
type = types.nullOr (types.attrsOf types.str);
|
|
default = null;
|
|
description = "Characters to pair up";
|
|
};
|
|
|
|
disabledFiletypes = mkOption {
|
|
type = types.nullOr (types.listOf types.str);
|
|
default = null;
|
|
description = "Disabled filetypes";
|
|
};
|
|
|
|
breakLineFiletypes = mkOption {
|
|
type = types.nullOr (types.listOf types.str);
|
|
default = null;
|
|
description = "Filetypes to break lines on";
|
|
};
|
|
|
|
htmlFiletypes = mkOption {
|
|
type = types.nullOr (types.listOf types.str);
|
|
default = null;
|
|
description = "Filetypes to treat as HTML";
|
|
};
|
|
|
|
ignoredNextChar = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = "Regexp to ignore if it matches the next character";
|
|
};
|
|
};
|
|
|
|
config =
|
|
let
|
|
options = {
|
|
pairs_map = cfg.pairs;
|
|
disable_filetype = cfg.disabledFiletypes;
|
|
break_line_filetype = cfg.breakLineFiletypes;
|
|
html_break_line_filetype = cfg.htmlFiletypes;
|
|
ignored_next_char = cfg.ignoredNextChar;
|
|
};
|
|
in
|
|
mkIf cfg.enable {
|
|
extraPlugins = [ pkgs.vimPlugins.nvim-autopairs ];
|
|
|
|
extraConfigLua = ''
|
|
require('nvim-autopairs').setup(${helpers.toLuaObject options})
|
|
'';
|
|
};
|
|
}
|