  For $k\geq 1$ an integer and $x\geq 1$ a real number, let $\pi_k(x)$ be the
number of integers smaller than $x$ having exactly $k$ distinct prime divisors.
Building on recent work of Matom\"aki and Radziwi\l\l, we investigate the
asymptotic behavior of $\pi_k(x+h)-\pi_k(x)$ for almost all $x$, when $h$ is
very small. We obtain optimal results for $k\asymp\log_2 x$ and close to
optimal results for $5\leq k\leq\log_2 x$. Our method also applies to
$y$-friable integers in almost all intervals $[x,x+h]$ when $\frac{\log x}{\log
y}\leq (\log x)^{1/6-\varepsilon}$.
