Is it possible to define mappings that only get active when a certain
spelllang is set?
E.g. I want to set the following mapping, but only if I use
inoremap oe ö
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
You can use a conditionnal mapping:
inoremap <expr> oe ( &spelllang == "de" ) ? "ö" : "oe"
<expr> specified Vim knows that when it sees
oe as an input it should execute the rest of the mapping as a vimscript expression and map
oe to the result of this expression.
Here the expression is a conditionnal operator: if
&spelllang == "de" is true then return
ö otherwise return