mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-24 12:45:24 +02:00
nvim-autopairs: init plugin
Also disabled Nix for treesitter temporarily, it's broken right now
This commit is contained in:
parent
080c8af710
commit
0d51b37154
6 changed files with 92 additions and 26 deletions
|
@ -14,6 +14,7 @@
|
|||
./utils/goyo.nix
|
||||
./utils/endwise.nix
|
||||
./utils/telescope.nix
|
||||
./utils/nvim-autopairs.nix
|
||||
|
||||
./languages/treesitter.nix
|
||||
./languages/nix.nix
|
||||
|
|
|
@ -17,7 +17,8 @@ in
|
|||
|
||||
disabledLanguages = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
# Nix is out of date right now! Try not to use it :D
|
||||
default = [ "nix" ];
|
||||
description = "A list of languages to disable";
|
||||
};
|
||||
|
||||
|
|
|
@ -152,10 +152,11 @@ in
|
|||
hint_sign = notNull cfg.signs.hint;
|
||||
infor_sign = notNull cfg.signs.info;
|
||||
|
||||
error_header = notNull cfg.headers.error;
|
||||
warn_header = notNull cfg.headers.warning;
|
||||
hint_header = notNull cfg.headers.hint;
|
||||
infor_header = notNull cfg.headers.info;
|
||||
# TODO Fix this!
|
||||
# error_header = notNull cfg.headers.error;
|
||||
# warn_header = notNull cfg.headers.warning;
|
||||
# hint_header = notNull cfg.headers.hint;
|
||||
# infor_header = notNull cfg.headers.info;
|
||||
|
||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||
|
||||
|
|
59
plugins/utils/nvim-autopairs.nix
Normal file
59
plugins/utils/nvim-autopairs.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.nixvim.plugins.nvim-autopairs;
|
||||
helpers = import ../helpers.nix { lib = lib; };
|
||||
in
|
||||
{
|
||||
options.programs.nixvim.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 {
|
||||
programs.nixvim = {
|
||||
extraPlugins = [ pkgs.vimPlugins.nvim-autopairs ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-autopairs').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue