Questions tagged [filetype-c++]
The filetype-c++ tag has no usage guidance.
62
questions
0
votes
3answers
81 views
How can i compile cpp using vim
I want to be able to compile c++ code from within vim without running a new terminal and calling the compiler. **How can I do it ** please
0
votes
1answer
37 views
How do I make Clang Completer Auto-Complete/Auto Show options
I have recently moved to vim and was looking into specific auto-completion plugins and tools to use for C/C++ (after YCM did not work for me). I found and installed Clang Completer and it works like a ...
2
votes
3answers
1k views
Competitive Programming Vimrc is too long
I am preparing for the Egyptian Olympiad in Informatics and I prefer vim to be my code editor, but my problem is my vimrc, I think it is a bit long to type at the beginning of an onsite competition, ...
0
votes
0answers
35 views
Jumping to matching angle brackets in heavily templated C++ code
By heavily templated I just mean it's easy to have something like this, which is just a trivial example I just made up:
#include <type_traits>
class a {};
bool operator<(a,a) { return true; };...
2
votes
1answer
58 views
Understanding indenting rules for C++ files
Why is the following C++ source file indented like this,
#include <vector>
int main() {
std::vector<std::vector<int>> v{
{1,2},
{1,1},
{1,2}
};...
0
votes
0answers
63 views
Making clangd LSP recognizing GNU-specific headers
I have coc.nvim installed for autocompletion in vim. I usually include bits/stdc++.h(GNU-specific) in my files for competitive programming.
I use the g++ compiler so I have no trouble there, but since ...
1
vote
0answers
31 views
automatic popup in vim with clang_complete plugin
I want to use Vim to program in clang (*.c and *.cpp).
At the moment I am trying to use the clang-complete plugin and I like the autocompletion but I have to use the <C-n> or <C-p> ...
1
vote
1answer
107 views
Issue running file from within NeoVim
I had the following remap
autocmd filetype cpp nnoremap <F5> :w <bar> silent !g++ -ulimit -Wall -Wno-unused-result -std=c++11 -O2 % -o %:r && %:r<CR>
When I run this in ...
0
votes
0answers
34 views
Installing clang_complete Errors
I tried to add the clang_complete plugin to my vim.
https://github.com/xavierd/clang_complete
After I added it, I get a large error page before I can open any C++ file. The autocomplete still does ...
1
vote
2answers
24 views
Autoindent unordered lists that start with a hyphen in cpp files
The context
I've the following options in my vimrc
set formatoptions=cnroqj
set textwidth=80
When editing tex files, lines whose content is longer than &textwidth is
splitted and formatted as ...
0
votes
0answers
60 views
Make vim commands be executed once a job on a terminal buffer has finished
The context
I've the following mapping in ~/.vim/ftplugin/cpp/mappings.vim. What this mapping does is to compile an arbitrary C++ file and open two windows (a) and (b). (a) shows the output of the ...
0
votes
0answers
24 views
How to use bash aliases in ftplugin files? [duplicate]
I want to be able to compile and run C++ files directly from inside vim. I have a custom compilation alias gmm defined in ~/.bash_aliases. I do not want to copy it over to my ~/.vim/ftplugin/cpp.vim ...
1
vote
0answers
17 views
Adding an header when checking an HPP file on the fly
I often use HPP files when separating a template header from its implementation. In this scheme an
#include"impl.hpp"
is inserted in the .h (the header) file after all relevant definitions. As such, ...
2
votes
1answer
80 views
How to change in gvim GTK file browser the default file mask wildcard (glob)?
In gvim the command :browse confirm e launches a GTK file browser. The default file mask in this window depends on the filetype from which the browse window is invoked. I would like to change that ...
1
vote
0answers
49 views
How to correctly add syntax highlighting to all c typedef [duplicate]
I saw that it's possible to manually add types to highlight, according to this post: https://stackoverflow.com/questions/20149478/how-can-i-teach-vim-about-additional-c-language-types-for-syntax-...
1
vote
0answers
16 views
How to jump to or list a tag exclusively defined in a header?
I have a .h and a .cpp with declarations and definitions, and I'd like to be able to :tselect only the declarations, in order to see all the functions I've got that match a pattern.
some_file.h:
...
1
vote
0answers
458 views
Autocompletion doesn't work when using ALE + deoplete
From my init.vim (I've checked that it doesn't work even with a minimal configuration):
call plug#begin()
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'dense-analysis/ale'
Plug '...
0
votes
0answers
30 views
Auto-insert C++ comment only on <shift+enter>
The comment auto-insert feature is often very helpful and otherwise very annoying, depending on the kind of comment I am writing. Is it possible to bind the auto-insertion of // exclusively to <...
1
vote
1answer
676 views
Plugin to display a smarter method tag list
Note this may be a duplicate, but I couldn't really find an answer.
From a C++ perspective:
With universal ctags on, doing a C-] on top of a method call presents you with a tag list matching the ...
1
vote
1answer
1k views
Autocompletion plugin for c/c++ with specific header path?
Is there a plugin which autocompletes C/C++ code from specific headers given in a specific path (i.e. /path/)?
If I include some headers from that path, I would get autocompletion from given header.
2
votes
2answers
271 views
Format / Indent c++ as you type inside expressions
In visual studio, that code :
for(int x=0;x<10;x++)
{}
becomes that code :
for (int x = 0; x < 10; x++)
{
}
as soon as you hit enter.
I was wondering, is it possible, and if so, how can I ...
1
vote
3answers
287 views
Changing < to " but leave << alone in Vim
I have a .cpp file in which I would like to change all less-than symbols to double quotes but maintain any instances of double-greater-than symbols, i.e. change < to " while leaving all occurrences ...
1
vote
1answer
32 views
How to clear multi lines in command zone
I'm working with vim + some plugins to code c++.
Sometimes, because of some bug or some executing sequence issue, the command zone will show me two or three lines as below:
As you can see, I got two ...
1
vote
1answer
37 views
Rearrange c++ const and reference specifiers
I'm trying to convert
const std::string &s
to
std::string const & s
and can't seem to get it quite right. This is the regex I'm using:
%s/const \(.\{-}\) &/\1 const &
and the ...
-1
votes
1answer
218 views
Insert C/C++ loops and statements templates automatically [closed]
How do I insert C/C++-type loops and statements templates automatically in Vim?
1
vote
0answers
2k 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
112 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,(...
1
vote
1answer
737 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
1k 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
81 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
282 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
2k 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 ...
1
vote
1answer
2k 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
1answer
300 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 ...
1
vote
0answers
224 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
602 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
361 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
320 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
464 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 ...
2
votes
2answers
470 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
230 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
555 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
3k 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
2k 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 ...
5
votes
1answer
5k 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.
2
votes
0answers
339 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, ...
11
votes
3answers
1k 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
953 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
1k 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 ...
9
votes
3answers
3k 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 ...