Giter VIP home page Giter VIP logo

modern-cpp-font-lock's Introduction

License GPL 3 MELPA Build Status

Donate Paypal

Syntax highlighting support for "Modern C++" - until C++20 and Technical Specification. This package aims to provide a simple highlight of the C++ language without dependency.

It is recommended to use it in addition with the c++-mode major mode for extra highlighting (user defined types, functions, etc.) and indentation.

Preview

With modern-c++-font-lock-mode:

Using GNU Emacs 27.0.50 and CC Mode version 5.33.2.

Installation

Melpa

modern-cpp-font-lock is available on the major package.el community maintained repo - MELPA.

You can install it with the following command:

M-x package-install [RET] modern-cpp-font-lock [RET]

In your init Emacs file add:

(add-hook 'c++-mode-hook #'modern-c++-font-lock-mode)

or:

(modern-c++-font-lock-global-mode t)

use-package

In your init Emacs file add:

(use-package modern-cpp-font-lock
  :ensure t)

Manual

Global setup

Download modern-cpp-font-lock.el into a directory of your load-path. Place the following lines in a suitable init file:

(require 'modern-cpp-font-lock)
(modern-c++-font-lock-global-mode t)

modern-c++-font-lock-mode will be activated for buffers using the c++-mode major-mode.

Local

For the current buffer, the minor-mode can be turned on/off via the command:

M-x modern-c++-font-lock-mode [RET]

Configuration

C++ Language

You can modify the following lists to recognize more words or set it to nil to partially disable font locking:

  • modern-c++-attributes - [[deprecated]], [[noreturn]], etc.
  • modern-c++-keywords - if, constexpr, noexcept, etc.
  • modern-c++-operators - ...
  • modern-c++-preprocessors - #define, __LINE__, __cplusplus, etc.
  • modern-c++-types - bool, char, double, etc.

Set to t (default value) to enable the following options or otherwise to nil:

  • modern-c++-literal-boolean - false, true
  • modern-c++-literal-integer - 0b101010, 18446744073709550592LLU, 0XdeadBABEu, etc.
  • modern-c++-literal-null-pointer - nullptr
  • modern-c++-literal-string - R"xyz()")xyz", L"hello\ngoodbye", "abcd", etc.

C++ standard library

Set to t (default value) to enable the following font lock options. Otherwise use nil:

  • modern-c++-stl-cstdint - Define the header <cstdint>

Mode line

When modern-c++-font-lock-mode is activated, mc++fl is displayed.

The Wiki is available: https://github.com/ludwigpacifici/modern-cpp-font-lock/wiki

Testing

Font-lock keywords are tested with the faceup package of Anders Lindgren.

Feedback

If you find a bug, please check if you can reproduce with c++-mode only. If it is the case, send your bug upstream to CC Mode

Do not hesitate to ask questions or share suggestions.

Happy coding!

Lud

modern-cpp-font-lock's People

Contributors

ludwigpacifici avatar mola-t avatar

Watchers

James Cloos avatar 太阳 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.