You are not logged in.

#1 2010-05-30 09:44:08

choubi
Member
Registered: 2009-10-08
Posts: 15

help with vim script

Hi,

I'd like vim to set the spelllang variable automatically depending on the recipient of the email I'm about to write.  The plan was to do something like the following:

if (grep -q address ~/.vim/foreign_language_speakers)
  setlocal spell spelllang=foreign_language

where ~/.vim/foreign_language_speakers is a text file with the e-mail addresses people I communicate with in whatever language and the variable address is obtained from the "To" line in the e-mail.  I understand grep within a vim script doesn't work exactely as in bash.  I tried redefining the grepprg variable to grep -q &> /dev/null and the do

let bolean = grep address ~/.vim/foreign_language_speakers

and then the if statement, but no luck.  vim tells me grep is not a variable.  Clearly there's somethiing I haven't understood about assigning variables in vim scripts.  I also tried vimgrep but have the same problem assigning the boolean result to a variable.

Any help appreciated

regards

Offline

Board footer

Powered by FluxBB