  Let $\Bbbk$ be an algebraically closed field of characteristic 0. We study
some cohomological properties of Lie subalgebras of the Witt algebra $W =
\operatorname{Der}(\Bbbk[t,t^{-1}])$ and the one-sided Witt algebra $W_{\geq
-1} = \operatorname{Der}(\Bbbk[t])$. In the first part of the paper, we
consider finite codimension subalgebras of $W_{\geq -1}$. We compute
derivations and one-dimensional extensions of such subalgebras. These
correspond to $\operatorname{Ext}_{U(L)}^1(M,L)$, where $L$ is a subalgebra of
$W_{\geq -1}$ and $M$ is a one-dimensional representation of $L$. We find that
these subalgebras exhibit a kind of rigidity: their derivations and extensions
are controlled by the full one-sided Witt algebra. As an application of these
computations, we prove that any isomorphism between finite codimension
subalgebras of $W_{\geq -1}$ extends to an automorphism of $W_{\geq -1}$.
  The second part of the paper is devoted to explaining the observed rigidity.
We define a notion of "completely non-split extension" and prove that $W_{\geq
-1}$ is the universal completely non-split extension of any of its subalgebras
of finite codimension. In some sense, this means that even when studying
subalgebras of $W_{\geq -1}$ as abstract Lie algebras, they remember that they
are contained in $W_{\geq -1}$. We also consider subalgebras of infinite
codimension, explaining the similarities and differences between the finite and
infinite codimension situations.
  Almost all of the results above are also true for subalgebras of the Witt
algebra. We summarise results for $W$ at the end of the paper.
