There is a weight space decomposition for all finite-dimensional Lie algebras $L$ over a field $K$ of characteristic zero, which later is used for the root space decomposition in the semisimple case. For this, let $H$ be a Lie subalgebra of $L$, and consider the restriction of the adjoint representation to $H$, i.e., ${\rm ad}:H\rightarrow \mathfrak{gl}(L)$, and define the generalized eigenspace
$$
L_{\lambda}(h)=\{ x\in L\mid (ad(h)-\lambda id)^nx=0 \text{ for some } n\},
$$
for $h\in H$. If $K$ is algebraically closed, the Jordan decomposition of $ad(h)$ gives
$$
L=L_0(h)\oplus \bigoplus_{i=1}^p L_{\lambda_i}(h),
$$
where $0,\lambda_1,\ldots ,\lambda_p$ are the distinct eigenvalues of $ad(h)$.
Now for each function $\alpha:H\rightarrow K$ let
$$
L_{\alpha}=\bigcap_{h\in H}L_{\alpha(h)}(h).
$$
Then the result is:
Theorem: Let $K$ be algebraically closed and $H\subseteq L$ be a nilpotent subalgebra. Then we have the weight space decomposition
$$
L=\bigoplus_{\alpha:H\rightarrow K}L_{\alpha},
$$
such that $H\subseteq L_0$, $[L_{\alpha},L_{\beta}]\subseteq L_{\alpha+\beta}$, and
$[H,L_{\alpha}]\subseteq L_{\alpha}$.