Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.60 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # I usually get french and english emails, and would like to auto-detect the language
  2. # to set the spellchecker when answering.
  3. # (I use mutt and vim)
  4. # In .muttrc:
  5. set editor = 'bash ~/bin/spelledit.sh'
  6. # and my ~/bin/spelledit.sh
  7. vim + -c "setlocal spell spelllang=$([ `cat $1 | aspell -l en list | sort -u | wc -l` -lt `cat $1 | aspell -l fr list | sort -u | wc -l` ] && echo "en" || echo "fr") encoding=utf-8" $1
  8. # Yes, this is dirty: I call aspell twice on the file,
  9. # counting the number of bad words in french and english,
  10. # and set spelllang to the lang with the less bad words
  11. #
  12. # Any suggestion welcome !