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.
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
: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