Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 108183a

Browse files
committed
Optionally highlight C++11 attributes
1 parent 332a858 commit 108183a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ The syntax files provide highlighting of:
66
- Common ANSI C keywords
77
- C++ Standard Library namespaces, types, helper types, helper template
88
variables, constants
9-
- Latest C++20 language features like Coroutines or Concepts
9+
- C++ attributes
10+
- Latest C++20 language features like coroutines and concepts
1011
- Function declarations/definitions and function calls (basically all words
1112
followed by an opening parenthesis)
1213
- Optionally a simpler (less colorful) highlighting of standard C and C++
@@ -32,6 +33,9 @@ modifications:
3233
" Disable function highlighting (affects both C and C++ files)
3334
let g:cpp_no_function_highlight = 1
3435
36+
" Enable highlighting of C++ attributes
37+
let g:cpp_attributes_highlight = 1
38+
3539
" Put all standard C and C++ keywords under Vim's highlight group 'Statement'
3640
" (affects both C and C++ files)
3741
let g:cpp_simple_highlight = 1

‎after/syntax/cpp.vim‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@
44
" Original Author: Jon Haggblad <https://github.com/octol>
55
" Maintainer: bfrg <https://github.com/bfrg>
66
" Website: https://github.com/bfrg/vim-cpp-modern
7-
" Last Change: Oct 4, 2020
7+
" Last Change: Oct 8, 2020
88
"
99
" This syntax file is based on:
1010
" https://github.com/octol/vim-cpp-enhanced-highlight
11-
" http://www.vim.org/scripts/script.php?script_id=4293
1211
" ==============================================================================
1312

13+
" C++ attributes {{{1
14+
if get(g:, 'cpp_attributes_highlight', 0)
15+
syntax region cppAttribute matchgroup=cppAttributeBrackets start='\[\[' end=']]' contains=cString
16+
hi def link cppAttribute Macro
17+
hi def link cppAttributeBrackets Identifier
18+
endif
19+
20+
1421
" Standard library {{{1
1522
syntax keyword cppSTLdefine
1623
\ MB_CUR_MAX MB_LEN_MAX WCHAR_MAX WCHAR_MIN WEOF __STDC_UTF_16__ __STDC_UTF_32__

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /