{ config, lib, pkgs, inputs, ... }:

let
  inherit (lib) mkEnableOption mkIf readFile;
in
{
  home-manager.users.moritz.programs.nixvim = lib.mkIf config.my.programs.himalaya.enable {
    extraPlugins = with pkgs.vimPlugins; [
      # himalaya-vim
      inputs.himalaya-vim.packages.${pkgs.system}.default
    ];
    extraConfigLuaPost = ''
      vim.g.himalaya_folder_picker = "telescope";
    '';
    autoCmd = [
      {
        command = "set modifiable";
        event = [ "FileType" ];
        pattern = [ "himalaya-email-listing" ];
      }
    ];
  };
}
