sponsor Vim development Vim logo Vim Book Ad

cSyntaxAfter : Operator highlighting for C-like languages and more

 script karma  Rating 18/10, Downloaded by 1000    Comments, bugs, improvements  Vim wiki

created by
Sergey Vlasov
 
script type
syntax
 
description
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.

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

There are two ways to enable the plugin:

  1. If you want to use CSyntaxAfter highlighting as is, put this into your
  .vimrc:

     autocmd! FileType c,cpp,java,php call CSyntaxAfter()

  2. If you also want to extend the highlighting or add other C-like languages
  support (Java, Go etc), create a corresponding <filetype>.vim file in
  .vim/after/syntax/ and call CSyntaxAfter() from there instead.

  WARNING: For same file type use either option (1.) or (2.), basically avoid calling
  CSyntaxAfter() more than once.

  For example, to distinguish "++" and "--" operator from "+" and "-" in C and C++,
  remove "c" and "cpp" from autocmd above and instead create .vim/after/syntax/c.vim
  with (cpp syntax is based on c):

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

     syntax match longOperators "++\|--"
     hi longOperators guifg=green guibg=red
 
install details
1. Extract to ~/.vim/
2. Put this into your .vimrc:
    autocmd! FileType c,cpp,java,php 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.3.zip 0.3 2015-03-10 7.0 Sergey Vlasov Documentation updated.
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: 54.144.5.65

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