Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions syntax/cpp.vim
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,6 +50,12 @@ if !exists("cpp_no_cpp14")
syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppChronoLiteralsDecimal display "\(\<0\|\<[1-9]\d*\)\(h\|min\|s\|ms\|us\|ns\)\>"
syn match cppChronoLiteralsFloat display "\<\d\+\.\d*[eE]\=[\-+]\=\d\+\(h\|min\|s\|ms\|us\|ns\)\>"
syn match cppChronoLiteralsFloat display "\.\d\+\([eE][\-+]\=\d\+\)\=\(h\|min\|s\|ms\|us\|ns\)\>"
syn match cppChronoLiteralsBinary display "\<0b[01]\('\=[01]\+\)*\(h\|min\|s\|ms\|us\|ns\)\>"
syn match cppChronoLiteralsHexa display "\<0x\x\('\=\x\+\)*\(h\|min\|s\|ms\|us\|ns\)\>"
syn match cppChronoLiteralsOctal display "\<0\o\+\(h\|min\|s\|ms\|us\|ns\)\>" contains=cOctalZero
Copy link
Contributor

@rhysdrhysdFeb 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we determine to highlight them, how about adding them to existing number highlights as below?

synmatchcppNumberdisplay"\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\|h\|min\|s\|ms\|us\|ns\)\>"

syn case match
endif

Expand All@@ -71,6 +77,11 @@ hi def link cppConstant Constant
hi def link cppRawStringDelimiter Delimiter
hi def link cppRawString String
hi def link cppNumber Number
hi def link cppChronoLiteralsDecimal Number
hi def link cppChronoLiteralsFloat Number
hi def link cppChronoLiteralsBinary Number
hi def link cppChronoLiteralsHexa Number
hi def link cppChronoLiteralsOctal Number

let b:current_syntax = "cpp"

Expand Down