sponsor Vim development Vim logo Vim Book Ad

cSyntaxAfter : Operator highlighting for C-like languages and more

 script karma  Rating 60/31, Downloaded by 3113  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.

Screenshots: https://imgur.com/a/R6tTqc2

There are two ways to enable the plugin:

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

     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()

     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.4.zip 0.4 2016-10-10 7.4 Sergey Vlasov Fix: no spell checking in comments.
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:

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.