Counting permutations of binary string where all ones within some distance? Given a binary string consisting of $O$ ones and $Z$ zeros, I'd like to count the number of permutations of that string where all of the ones are within a window (consecutive positions) of length $L$.
For example, with 5 ones and 6 zeros, there are 81 permutations where the ones are all within $l=7$ consecutive positions (I did this enumerating and counting them).
I think that using inclusion-exclusion is the way to solve this, but to be honest I understand the gist of the technique but usually struggle to understand what to count and how to count them to get the alternating I-E terms.
I tried to adapt an answer from an earlier question here - it is quite similar, except instead of a straight partitioning of a permutation, it's partitioning with offsets of only 1 per partition, but to no avail.
This seems like it should be quite simple, I'd appreciate some frustration relief.

You don’t need an inclusion-exclusion argument. Let me use $n_0$ and $n_1$ for the numbers of zeroes and ones, respectively, and let $n=n_0+n_1$. Let $\ell$ be the length of the window; I’ll assume that $n_1\le\ell\le n$. 
For $n_1\le k\le\ell$ we can count the number of strings in which the actual window occupied by the ones has length $k$. If the first $1$ is at position $i$, the last is at position $i+k-1$. We must have $i+k-1\le n$, so $1\le i\le n+1-k$, meaning that there are $n+1-k$ possible starting points for the ones. There are $k-2$ positions between the first and last ones, and $n_1-2$ of them must be occupied by ones, so there are $\binom{k-2}{n_1-2}$ ways to place the interior ones. Thus, there are
$$(n+1-k)\binom{k-2}{n_1-k}$$
strings in which the actual window occupied by the ones has length $k$, and there are altogether
$$\sum_{k=n_1}^\ell(n+1-k)\binom{k-2}{n_1-2}$$
acceptable strings.

With your example of $n_0=6,n_1=5$, and $\ell=7$ this becomes $$7\binom33+6\binom43+5\binom53=7+24+50=81\;.$$

Finally,
$$\begin{align*}
\sum_{k=n_1}^\ell(n+1-k)\binom{k-2}{n_1-2}&=n\sum_{k=n_1}^\ell\binom{k-2}{n_1-2}-\sum_{k=n_1}^\ell(k-1)\binom{k-2}{n_1-2}\\
&=n\sum_{k=n_1-2}^{\ell-2}\binom{k}{n_1-2}-\sum_{k=n_1-2}^{\ell-2}(k+1)\binom{k}{n_1-2}\\
&=n\binom{\ell-1}{n_1-1}-(n_1-1)\sum_{k=n_1-2}^{\ell-2}\binom{k+1}{n_1-1}\\
&=n\binom{\ell-1}{n_1-1}-(n_1-1)\sum_{k=n_1-1}^{\ell-1}\binom{k}{n_1-1}\\
&=n\binom{\ell-1}{n_1-1}-(n_1-1)\binom{\ell}{n_1}\;.\tag{1}
\end{align*}$$

In your example this is $$11\binom64-4\binom75=165-84=81\;.$$

The expression $(1)$ can be manipulated in various ways; for instance,
$$\begin{align*}
n\binom{\ell-1}{n_1-1}-(n_1-1)\binom{\ell}{n_1}&=n\binom{\ell-1}{n_1-1}-(n_1-1)\left(\binom{\ell-1}{n_1-1}+\binom{\ell-1}{n_1}\right)\\
&=(n_0+1)\binom{\ell-1}{n_1-1}-(n_1-1)\binom{\ell-1}{n_1}\;.
\end{align*}$$
