sponsor Vim development Vim logo Vim Book Ad

linglang : Dynamically switch languages/settings in multi-lingual documents

 script karma  Rating 0/0, Downloaded by 1454  Comments, bugs, improvements  Vim wiki

created by
Tom Link
 
script type
utility
 
description
The command |:Linglang| installs a buffer-local autocommand that checks
the current line's language. I.e. enabling linglang for the current
buffer won't affect other buffers. If the language of the line under the
cursor changes, a user-defined action (e.g., set spelllang) will be
executed.

:Linglang[!] [LANGS ...]
    Toggle linglang support for the current buffer.
    With [!], suppress message.

Currently supported:
- English
- German (latin1, utf8)

In order to add a new language, you'll have to come up with some good
words/regexps to identify it.

Language data is stored in .../autoload/linglang/LANGUAGE.ENCODING
The fileformat is simple:

- one word per line (these will be matched against word borders)
- arbitrary regular expressions: /REGEXP/
 
install details
Edit the vba file and type:

    :so %

See :help vimball for details. If you have difficulties or use vim 7.0,
please make sure, you have the current version of vimball
(vimscript #1502) installed or update your runtime.

This script requires hookcursormoved (vimscript #2037) to be installed.


Also available via git
http://github.com/tomtom/linglang_vim
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
linglang.vba.gz 0.2 2008-07-13 7.0 Tom Link - Language patterns are stored in .../autoload/linglang/LANGUAGE.ENCODING
- Respect encoding
- Removed variables: g:linglang_words, g:linglang_patterns, g:linglang_filetypes
linglang.vba.gz 0.1 2008-07-11 7.0 Tom Link Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github