Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VI to recognize C++11 keywords [duplicate]

Tags:

c++

vi

c++11

Possible Duplicate:
Is there a C++11 syntax file for vim?

How can i update my VI settings for it to recognize (and highlight appropriately) new keywords that came about with the new standard.

For example:

enter image description here

like image 577
James Leonard Avatar asked Aug 19 '12 19:08

James Leonard


People also ask

What are keywords in C++ class 11?

Keywords (also known as reserved words) have special meaning to the C++ compiler and are always written or typed in short(lower) cases. Keywords are words that the language uses for a special purpose, such as void, int, public, etc. It can't be used for a variable name or function name.

What is identifier in C++ with example?

Identifiers are the unique names given to variables, classes, functions, or other entities by the programmer. For example, int money; double accountBalance; Here, money and accountBalance are identifiers.

What is using command in C++?

​The using keyword is used to: Bring a specific member from the namespace into the current scope. Bring all members from the namespace into​ the current scope. Bring a base class method ​or variable into the current class's scope.

Can keywords be used as identifiers in C++?

You cannot use keywords as identifiers; they are reserved for special use.


1 Answers

Someone already wrote some syntax files for C++11: http://www.vim.org/scripts/script.php?script_id=3797. It even makes initializer lists and lambdas work fine without vim thinking the curlies are errors.

I remember I had to manually add some missing keywords to it, but that's not terribly complicated (just grep the file for the other keywords and add new ones). My current setup is up on GitHub. If you are using vundle you can install it with Bundle 'rmartinho/vim-cpp11'.

like image 88
R. Martinho Fernandes Avatar answered Sep 24 '22 02:09

R. Martinho Fernandes