bfrg / vim-cpp-modern Goto Github PK
View Code? Open in Web Editor NEWExtended Vim syntax highlighting for C and C++ (C++11/14/17/20/23)
Extended Vim syntax highlighting for C and C++ (C++11/14/17/20/23)
Love the script, fixes the issues I was having with collisions in local variable names and user-defined types I was getting with vim-cpp-enhanced-highlight (because of additional highlighting I didn't want to use anyways).
Coming over from vim-cpp-enhanced-highlight I noticed I was missing the ability to disable highlighting of (user-defined) functions. It was pretty easy to bring back, perhaps others like that option as well. Since you stripped out the STL functions, it would obviously disable highlighting of all functions in vim-cpp-modern.
c.vim
" Highlight function names
if !exists('g:cpp_no_function_highlight')
syn match cCustomParen transparent "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
endif
cpp.vim
" Highlight function names
if !exists('g:cpp_no_function_highlight')
syn match cCustomParen transparent "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@="
endif
.vimrc
let g:cpp_no_function_highlight = 1
Hi bfrg,
I've found this plug works well on Linux with files named with ".C" and ".H", but on mac it doesn't work for these files, may I ask how can I fix it?
For example I've had a class like this:
class A
{
public:
A() = default;
private:
int _privateVar1 = 0;
int _privateVar2 = 0;
}
How can I mark all the variables beginning with "_" as member variable?
It seems this option has disappeared. It does work when I add it back in myself in the cpp.vim file.
It would be nice to have this feature where custom types like mytype_t
could be highlighted. This is a common pattern in C and helps easily identify non-built in types.
typedef struct {
...
} custom_t;
int
myfunc(custom_t* a)
{
...
}
Is it possible to have this feature with this package? I am willing to help where I can, although i'm not experienced with vimscript.
hi is possible.
maybe it might sound stupid but is it possible to add modulessupport like keywords import export.
Will this also make clangd recognize those as well ?
salim
I would like to make use of these syntax files at work, but to bring files into the company I would need a licence declaration in the repro. Any chance an open source licence could be added?
... as can be checked at https://github.com/bfrg/vim-cpp-modern/blob/master/after/syntax/cpp.vim#L1249 & https://en.cppreference.com/w/cpp/regex/regex_replace etc.
Although commenting out cppSTLfunction helps avoiding "too colorful" highlighting, there are still a lot of possibilities for extraneous highlights, e.g. the cppSTLtype "path".
Would it be possible to add a flag to only highlight names that are prefixed by their namespace (that would probably need to use a syntax match)? Or perhaps extra points if the "using" directive is configurable, e.g. the user can note in their vimrc "treat fs
as the std::filesystem
namespace, so highlight fs::path
but not path
"?
Thanks.
Calling your plugin before justinmk/vim-syntax-extra will overwrite some highlighting of the latter.
Plug 'bfrg/vim-cpp-modern'
Plug 'justinmk/vim-syntax-extra'
Plug 'justinmk/vim-syntax-extra'
Plug 'bfrg/vim-cpp-modern'
The same issue was with octol/vim-cpp-enhanced-highlight
I dunno'... maybe I'm just too dumb to use this plugin. I'm definitely a vim newbie, but I got nerdtree working with no sweat at all.
Anyway, I only want C syntax coloring, and I think I want it to load automatically. After installation (using git) I open one of my source files using vim filename.c
. But all I get is some generic highlighting (which existed before I installed vim-cpp-modern).
The README is no help, and after looking at some of the other issues I got no help from that.
How do you start this... how do you get vim-cpp-modern to apply syntax coloring appropriate to C source code? Simple instructions, please (I'm retarded, OK).
cpp_no_cpp20 would disable cpp20 highlight, but let cpp_no_cpp20 = 1
in vimrc, it doesn't work
Since coroutines have made it in the C++20 standard, could the respective keywords be added as optional syntax highlighting (like done with concepts)?
is keyword highlight complete for c++17, could not find from_chars at least
Hi guys,
I use both plug and git clone to install this plug, but neither works for me, the highlight doesn't change after I restart vim, I'm not sure if I mistook something in the process, I got stuck for all day long lol
Hey there!
I noticed that standard library function templates std::ref
and std::cref
are not highlighted.
Introduced in c++11 as helper functions for std::reference_wrapper (which is highlighted): https://en.cppreference.com/w/cpp/utility/functional/ref
entity.AddComponent<TagComponent>();
is not highlighted
wether WebSocket
or Web_socket
i think its reasonable to highlight identifier with capital letter as type.
var in #define var (int)1.0
is highlighted like a function.
C++23 introduced the new size suffix z
or Z
. More information can be found on the cppreference page on Integer literals, under "Syntax". Currently size-suffixed integer literals are not highlighted. Any chance that this could please be added to this plugin?
Hello, I know this is not an issue or a bug but I really loved the colorscheme displayed on the screenshot and I cannot find it anywhere online. Is it custom?
Can you help me configure my vim colors the same way?
Thanks in advance.
Hey there!
In the current version this plugin supports c++20 features like concepts, but if I try and write keywords associated with them, they are not highlighted.
Specifically: concept
, requires
.
There may be more, but I'm only starting c++20.
So, shouldn't they be highlighted?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.