https://github.com/pulkomandy/c.vim Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} pulkomandy / c.vim * Sponsor Sponsor pulkomandy/c.vim * Notifications * Star 5 * Fork 0 Improved C syntax highlighting for vim WTFPL License 5 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code * Clone HTTPS GitHub CLI [https://github.com/p] Use Git or checkout with SVN using the web URL. [gh repo clone pulkom] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @pulkomandy pulkomandy Add screenshots showing C++ code ... cb82de8 Aug 14, 2021 Add screenshots showing C++ code cb82de8 Git stats * 6 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time LICENSE.txt Initial import. Aug 14, 2021 README.md Add screenshots showing C++ code Aug 14, 2021 c.vim Fix detection of C style casts, add detection of "new" Aug 14, 2021 cpp.vim Fix detection of C style casts, add detection of "new" Aug 14, 2021 disabled.png Initial import Aug 14, 2021 enabled.png Initial import Aug 14, 2021 with.cpp.png Add screenshots showing C++ code Aug 14, 2021 without.cpp.png Add screenshots showing C++ code Aug 14, 2021 View code Improved vim syntax highlighting for vim What it is What it does How to use it How does it look README.md Improved vim syntax highlighting for vim What it is For a very long time I was not quite happy with the syntax highlighting in vim for C code. That was until I met JC, a colleague who had developped a much better syntax file which I quickly adopted and installed on all my machines. Unfortunately his work was based on an older vim version from 1998. Today with the latest vim update, syntax was not working anymore. So I finally took a deeper look about how this works, and extracted the needed bits to make this a separate file that can be added to the existing syntax, without having to redo everything. What it does The main change is to detect and highlight types. The following cases are detected: * Variable declarations * Functions return type * Function parameters (in declaration and definition) * C-style casts (not C++ ones yet, TODO) * C++ "new" operator Another change is colorizing the parentheses of if, while, and for in the same color as the keyword (but this overrides rainbow parentheses so I'm not sure if it should be kept this way). Ideally, other parts of the highlighting will be left unchanged, but this part is not working perfectly yet. How to use it Put c.vim and cpp.vim in your vim after/syntax/ directory. That's all. This script uses the standard colors for highlighting (mainly cType) so you keep all your colorscheme and customizations when you install it. How does it look Here is a side by side comparison, with and without c.vim: [enabled] [disabled] Of course it also works in C++ (and in non-dark mode): [with] [without] About Improved C syntax highlighting for vim Resources Readme License WTFPL License Releases No releases published Sponsor this project * liberapay liberapay.com/pulkomandy Packages 0 No packages published Languages * Vim script 100.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.