sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

setsyntax : Set options specific for the syntax group under cursor

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

created by
Tom Link
script type
This plugin sets options/variables according to the syntax under the
cursor. It was originally created in response to
and to solve a similar problem. While this plugin solves that other
related problem it doesn't seem to work properly for tex files.


g:setsyntax_options            (default: {})
    This variable is a dictionary of dictionaries of dictionaries.
      let g:setsyntax_options['tex'] = {'^texMathZone': {'&l:tw': 0}}

:SetSyntax SYNTAX,... VAR VALUE ...
:SetSyntax /REGEXP/ VAR VALUE ...
    Set syntax-specific options for the current buffer. When using a
    REGEXP, the syntax names have to be already defined, i.e. you can use
    the REGEXP only after the syntax file was loaded.
    VAR must be a variable name (see |:let| and |:let-&| for details).
    I.e., if you want to set a option, e.g. spelllang, don't use

        SetSyntax /^texMath/ spelllang ""

    but instead use:

      SetSyntax /^texMath/ &l:spelllang ""
    VALUE actually is an expression that will be evaluated when setting
    the variable.
    NOTE: Blanks in VALUE must be escaped with a backslash. See the help
    page on <f-args> for details.

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.

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

Also available via git

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
setsyntax.vba.gz 0.3 2007-11-21 7.0 Tom Link - SetSyntax command
- Require tlib >= 0.21, hookcursormoved >= 0.7
- Look-up should be slightly faster now
setsyntax.vba.gz 0.2 2007-11-18 7.0 Tom Link - Defined viki regions
setsyntax.vba.gz 0.1 2007-11-18 7.0 Tom Link Initial upload
ip used for rating:

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.
SourceForge.net Logo