{ inputs, config, lib, pkgs, ... }:
{
  imports = [
    inputs.nixvim.homeModules.nixvim
  ];

  programs.nixvim = {
    enable = true;
    
    waylandSupport = true;
		
    # Basic options
    opts = {
			autoindent = true;
      clipboard = "unnamedplus";
      shiftwidth = 2;
      mousescroll = "ver:0,hor:0";
      
      expandtab = true;     # Always insert spaces, never hard tab characters
      tabstop = 2;          # Make hard tabs display as 2 columns (matches shiftwidth)
      softtabstop = 2;      # Backspace deletes 2 spaces at a time

      number = true;
      relativenumber = true;

      cursorline = true;          # Highlights the entire current line
      cursorlineopt = "both";     # Highlights both the line AND the line number

      termguicolors = true;
    };
    
    colorschemes.catppuccin = {
      enable = true;
      settings = {
        flavour = "mocha";
        term_colors = true;

        styles = {
          booleans = [ "bold" "italic" ];
          conditionals = [ "bold" ];
          functions = [ "bold" ];
          keywords = [ "italic" ];
        };
      };
    };
    
		keymaps = [
			{
				mode = "v";
				key = ">";
				action = ">gv";
				options.desc = "Indent and keep selection";
			}
			{
				mode = "v";
				key = "<";
				action = "<gv";
				options.desc = "Unindent and keep selection";
			}
		];
		
    plugins = {
      # Statusline at the bottom of the screen
      lualine.enable = true;
      # Tab bar at the top of the screen
      bufferline.enable = true;
      # File type icons used by many UI plugins (Dependency)
      web-devicons.enable = true;
      # Replaces the default cmdline, messages, and popupmenu with a nicer UI
      noice.enable = true;
      # Popup notification manager
      notify.enable = true;
      treesitter = {
        # Syntax parsing for accurate highlighting and code understanding
        enable = true;
        settings = {
          highlight.enable = true;
          indent.enable = true;
        };
      };
      # Shows the current function/class context pinned at the top of the buffer
      treesitter-context.enable = true;
      # Text objects based on treesitter nodes (e.g. select a function body)
      treesitter-textobjects.enable = true;
      # Auto-closes and renames HTML/JSX tags using treesitter
      ts-autotag.enable = true;
      # Adds indentation guide lines to every indent level
      indent-blankline = {
        enable = true;
        settings = {
          indent = {
            char = "│";
            tab_char = "│";   # Explicitly define the tab indent guide character
          };
          scope = {
            enabled = true;
          };
					whitespace = {
						remove_blankline_trail = false;
					};
        };
      };
      # Highlights and searches TODO/FIXME/HACK comments
      todo-comments.enable = true;
			nvim-autopairs = {
				enable = true;
				settings = {
					check_ts = true;   # Use treesitter to avoid pairing inside strings/comments
				};
			};
    };

    extraPlugins = with pkgs.vimPlugins; [
    ];

    # Additional Lua configuration
    extraConfigLua = ''
      -- Custom Lua config here
			vim.opt.cpoptions:append('I')
		'';
  };
}
