{
  programs.nixvim = {
    config = {
      # System clipboard support, needs xclip/wl-clipboard
      clipboard = {
        providers = {
          wl-copy.enable = true; # Wayland
          xsel.enable = true; # For X11
        };
        register = "unnamedplus";
      };
      globals.mapleader = " ";
      opts = {
        number = true; # Show line numbers
        relativenumber = true; # Show relative line numbers
        shiftwidth = 2; # Tab width should be 2

        # Always show the signcolumn, otherwise text would be shifted when displaying error icons
        signcolumn = "yes";

        # Enable mouse
        mouse = "a";

        # Search
        ignorecase = true;
        smartcase = true;

        # Save undo history
        undofile = true;

        # Global substitution by default
        gdefault = true;

        # Start scrolling when the cursor is X lines away from the top/bottom
        scrolloff = 8;

        # Enable 24-bit RGB color in the TUI
        termguicolors = true;

        # Wrap long lines at a character in 'breakat'
        linebreak = true;

        smartindent = true;

        # Remove EOB
        fillchars = {
          eob = " ";
        };
      };
    };
  };
}