this is what i wanted to do:
function! Spell(lang) if a:lang == "off" set nospell else set spell set spelllang=a:lang endif endfunction
unfortunately this does not work ;( this assigns the string a:lang to spelllang.
:let (and some other commands like
:call) are basically the only ex commands that expect variables. Almost all other ex commands do not expect such things and therefore take it literally. Therefore you have to use
:exe "set spelllang=".a:lang or even better, use
:let &spelllang=a:lang (see