Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [filetype-c++]

The tag has no usage guidance.

0
votes
0answers
21 views

How to setup ALE with clang?

I'm trying to setup ALE with clang but apparently clang has no idea about my source files - it cannot find included files for a start. How can I tell ALE/clang were are all my sources? If you ...
1
vote
1answer
26 views

C++: different auto-indentation for function protoypes versus continuation lines

I have the following options setup for C++ and Python development in vim: autocmd BufEnter *.cpp setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=80 noexpandtab cindent cinoptions=:0,l1,t0,g0,(...
0
votes
1answer
78 views

How to change Operator highlight color in Vim?

I just switched to iTerm2 on macOS and found some of its options go to Vim as well. That's the case for fonts, I was able to select a Vim font that I like from iTerm options. It seems iTerm color ...
0
votes
2answers
108 views

Is there a way to open header file in c?

I'm trying to configure vim for programming in C. I currently use YouCompleteMe and Syntastic for programming auto-completion and syntax-checking. But I came up with a problem. I cannot jump to a ...
4
votes
0answers
39 views

Can vim-ale emit an error when it fails to parse compiler output?

Ale does not always indicate an error when compilation fails. AFAICT, the reason is that ALE's parser can't find a reference to the current file in the compiler's error messages. This is because ...
0
votes
2answers
91 views

Competitive coding template in vim macro

I want to have a vim register that pastes : #include <iostream> #include <string> #define 1e9 + 7 typedef long long ll; using namespace std; int main(int argc, char ** argv){ return 0;} ...
3
votes
2answers
703 views

Compiling and running multiple c++ files from vim

I am writing a lot of c++ in vim. I am looking for a way to compile and run the current project including all .cpp-Files in the directory that I am currently in. There are already several threads ...
0
votes
1answer
1k views

Alternatives to ctags: are rtags, uctags or other alternatives better?

The problem: I've used ctags with C++ code for a while, but that has no knowledge of the code. If there are many subclasses that overwrite a certain virtual function, then on a Ctrl-] I may end up in ...
0
votes
0answers
50 views

Install c-scope with VIM 8's package manage

I am upgrading to only using VIM 8's package manager. How can c-support be installed in this way?
0
votes
1answer
182 views

different colour schemas depends how file is opened [closed]

this is my first steps in vim and I've started this from a config generated by vim-bootstrap service for neovim and c++ specific development. so I'm currently studying enabled plugins. could ...
2
votes
0answers
98 views

Fuzzy Find C++ function definition

I am looking for a way to fuzzy find C++ function/method definition in NeoVim. A function definition can look like this: bool Cls::func() { bool func() { bool Cls::func(unsigned some, bool argument)...
0
votes
1answer
243 views

Folding doesn't work for C/C++

I've been having a ridiculously hard time getting C/C++ code folding to work with set foldmethod=syntax. To debug my issue I've stripped down my vimrc to only this: set foldmethod=syntax syntax on ...
1
vote
1answer
81 views

Get list of files using glob in command mode

With the following command, I'd like to glob for all .cpp files so that I can compile and run simple programs: autocmd FileType cpp nnoremap <buffer><silent><localleader>cr :execute ...
0
votes
1answer
189 views

How can I highlight WinAPI functions in C++?

How can I add syntax highlight for windows.h C/C++ apis and types? All I've found is a tiny winapi syntax file here.
1
vote
0answers
244 views

vim c++ clang_complete doesn't work for std::cin.get()

I'm using vim to do c++ projects on Mac OS X. To auto complete, I use this plugin: clang_complete For most of cases, such as members of user-defined classes, members of namespaces, it works very ...
1
vote
1answer
138 views

folding, curly bracket under the function name

I have these two functions void function_one(){ return; } void function_two() { return; } when I use zM to fold the functions I get +-- 3 lines: void function_one(){-- void ...
0
votes
1answer
119 views

Remove colon from keyword in C++ file?

: is set as keyword (set iskeyword) for C++ source file by default, is there a way to just disable that in my .vimrc file instead of doing set iskeyword-=: every time? It seems the plug-in set the ...
1
vote
1answer
364 views

YouCompleteMe C++ semantic completion does not work for . operator

For the majority of Semantic triggers in C++ YCM works fine, but I've been unable to make it work for the . operator on a type. (For example, for a vector type I'd like to have the list of its ...
6
votes
2answers
1k views

Jumping to start/end of function definition in C++

Is there an easy way to jump to the beginning or end of the function your cursor is currently inside? It doesn't seem like sentence/paragraph/section have useful syntax aware meanings when editing C++....
13
votes
5answers
1k views

Quick search, limited to a C++ function

I work on a rather large C++ project. One of the more frustrating aspects of its organization is very large functions placed inside ridiculously large files. I often want to search for any instance ...
2
votes
1answer
3k views

How to disable YouCompleteMe's error checking?

I have recently installed YouCompleteMe and can't figure out how to disable its error checking feature. I am developing in C++ and wanted to use Neomake as my checker.
1
vote
0answers
217 views

How do I fix indentation after multiline c++ initialization list?

When I have a long constructor that forces me to put initialization list items on separate lines, my indentations look like this after gg=G. Really_Long_Class_Name::Really_Long_Class_Name(int _arg1, ...
10
votes
2answers
403 views

Vim, ctags and overloading

Is there a way to make vim jump to the right matching definition automatically in case of multiple definitions. Our C++ code heavily uses function overloading and vim's handling of ctags does not ...
9
votes
1answer
578 views

Vim syntax highlighting of numeric literals with single-quote digit separators

C++14 provided us with the option of using single quotes to separate the digits of large numeric literals. This breaks Vim's syntax highlighting. For example, consider the following C++14 program: #...
10
votes
1answer
747 views

How do I align C++ comments to be compliant with Google styling?

Any way to get Vim to format my comments to comply with Google cpplint? Top section is not compliant, to comply 5 changes are required. keep this comment at the same level Add a space after // add ...
7
votes
2answers
2k views

How do I add skeleton text to new vim files?

I use Vim for writing C++, and I have quite a few #include<> statements, comments, etc. that I must include in each new file I create. I've added autocmd BufNewFile *.cpp r C:\(full file path ...
10
votes
1answer
5k views

Why doesn't YouCompleteMe complete function paramters?

I'd like to use YouCompleteMe with C++ semantic completion, but after hours of trying, I can't find why it doesn't work as expected. Everything seems to be working but I can't complete function ...
4
votes
1answer
444 views

Indenting c/c++ using lisp indentation style

I want to write c++ code in vim using lisp indentation style (closing curly braces on the same line as last statement) but I can't figure out how to configure indentation to use that style. Is there ...
0
votes
2answers
42 views

Define new command that works only outside c++ comments

When I am coding in c++, I want vim to expand ( into ()<++> and place the cursor in the parenthesis. I do this by putting the following line in one of the files loaded at startup: inoremap ( ...
3
votes
1answer
2k views

syntastic C++14 support

I tried this solution using instead of C++11 C++14, but it doesn't work, I still get for this line: auto number(0); that: 'auto' type specifier is incompatible with C++98 with syntastic. Why ...
5
votes
1answer
506 views

Search and replace, but ignore text in quotes

As a poor-mans refactoring, I'd like to do a search and replace, but omit strings that are in double quotes (C/C++ quoting rules). For example cout << "Some variable " << variable <<...
3
votes
1answer
74 views

Using the % command in c++

The % command is quite nice, and I use it to copy/delete whole loops, functions and classes. In c++ though, you need to add a ; after your class declaration, so trying to motion over a whole class ...
1
vote
1answer
1k views

Navigation with Tagbar

I'm using Tagbar (with C++) and I would like to understand if and how it is possible to navigate the code as follow: Find all references of a variable or methods (where the variable or method is used/...
5
votes
2answers
537 views

Vim `cpp` Syntax highlighter prematurely ends macros mid-word

NOTE: This question is a "manual migration" from here: https://superuser.com/q/875751/199803 My Vim syntax highlighter for ft=cpp is prematurely ending some macros mid-line. For example: (The ...
11
votes
4answers
12k views

Can I jump to a function declaration or definition in a multiple C++ source files project?

Can I jump to a function declaration or definition in a multiple C++ source files project? Lets say I have a header file foo.hpp: int bar(); and a source file foo.cpp: #include "foo.hpp" int bar() ...
9
votes
2answers
1k views

Automatically creating functions out of function prototypes from header files

Intro When programming in C and C++ you usually split your function prototypes and actual functions into a .h/.hpp and .c/.cpp file. Sadly it's very tedious to transfer the function prototypes from ...
29
votes
3answers
26k views

How to get intelligent C++ auto-completion

Some editors (such as visual studio on windows) do C++ autocompletion which understand C++. For example, given: #include <vector> int main(void) { std::vector<int> v; v.i In visual ...