{ config, lib, ... }:

let
  cfg = config.subs.neovim;
in
{
  options.subs.neovim.enable = lib.mkOption {
    default = false;
    type = lib.types.bool;
  };

  config = lib.mkIf cfg.enable {
    programs.neovim = {
      enable = true;
      defaultEditor = true;
      viAlias = true;
      vimAlias = true;
      vimdiffAlias = true;
    };

    home.file = {
      ".config/nvim/init.lua".source = ../../config/nvim/init.lua;
      ".config/nvim/after" = { source = ../../config/nvim/after; recursive = true; };
      ".config/nvim/lsp" = { source = ../../config/nvim/lsp; recursive = true; };
      ".config/nvim/lua" = { source = ../../config/nvim/lua; recursive = true; };
      ".config/nvim/plugin" = { source = ../../config/nvim/plugin; recursive = true; };
    };
  };
}
