sponsor Vim development Vim logo Vim Book Ad

cSyntaxAfter : Operator highlighting for C-like languages and more

 script karma  Rating 17/9, Downloaded by 880    Comments, bugs, improvements  Vim wiki

created by
Sergey Vlasov
script type
This plugin was initially created for codeblock_dark color theme (vimscript #3266) to highlight operators (+ - / * = <> () and others) in C-like languages. Why it's needed? Well, by default vim doesn't do that. After switching from Code::Block to vim I got really missed it.

Then the plugin grew into something bigger. I started to use it to unify overal syntax highlighting for C-like languages.

before http://www.vlasov.me/cSyntaxAfter-without.png
after http://www.vlasov.me/cSyntaxAfter-with.png

It's possible to extend the plugin tu support other C-like languages (Java, Go etc).
For example for Object-C first check you don't have "objc" in autocmd in vimrc.
Then create new objc.vim file in <cSyntaxAfter_path>/after/syntax/ and add:

    if exists("*CSyntaxAfter")
       call CSyntaxAfter()

Then add new rules to syntax highligting, for example to highlight [ ] brackets
as operator and not constant add:

    syntax match _Operator display "[\[\]]"
    hi link _Operator Operator
install details
1. Extract to ~/.vim/
2. Put this into your .vimrc:
    autocmd! BufRead,BufNewFile,BufEnter *.{c,cpp,h,javascript} call CSyntaxAfter()

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
cSyntaxAfter-0.2.zip 0.2 2012-04-02 6.0 Sergey Vlasov Clean up
cSyntaxAfter.zip 0.1 2010-10-05 7.0 Sergey Vlasov 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