Questions tagged [filetype-c++]

Questions about of the file type cpp.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

clangd No client with id 1

I am running Manjaro KDE and neovim version v0.9.5. I have a slightly modified version of this nvim config and I have downloaded the clangd language server. Everything was working fine and great, up ...
ChrisHusky's user avatar
0 votes
0 answers
14 views

Get Stuck When Opening a file with thousands of lines by LSP-enabled Vim on Windows MSYS2

I am trying to recreate the Vim environment on Windows MSYS2 with my Linux Vim settings. But I found that when the LSP (prabirshrestha/vim-lsp) is turned on, sometimes the file gets stuck when opening ...
aRedR's user avatar
  • 1
0 votes
1 answer
1k views

How to setup up LSP for C/C++ in Vim? [closed]

I would like: auto complete, navigation, refactoring using LSP in Vim not in Neovim. I would like some guide and example to setup .vimrc Can I find one?
Jumogehn's user avatar
  • 165
0 votes
0 answers
58 views

How do I get clangd to also recognise c++ includes?

I've installed clangd through mason, the lsp works when I open a cpp file. It finds includes from the C std library but when I include for instance it will just say 'fstream' file not found, same ...
TiesDO's user avatar
  • 1
5 votes
2 answers
81 views

Don't auto-extend c/c++ trailing comments

Edit this C++ excerpt: // line 1 int xxxxxxxx = 0; // line 2 int yyyyyyyy = 0; When the cursor is in line 1 and you hit o to insert a line below it, Vim conveniently starts the new line with another /...
Camille Goudeseune's user avatar
1 vote
1 answer
689 views

How do I configure plugins in AstroNvim?

I'm using AstroNvim. I've cloned the template based repo to ~/.config/nvim/lua/user. How do I configure clangd, for example, to use LLVM code style instead of Google's or to use 4 spaces tab ...
AnonNothing's user avatar
0 votes
2 answers
69 views

Vim package management

I have not kept up with vim in the last decade. I have had my setup and it worked well enough that I have not bothered touching my configuration in forever. BUT. I have the need to get back into some ...
Martin York's user avatar
  • 6,562
1 vote
1 answer
71 views

What is CTRL-W Tab doing?

By pure coincidence, I hit CTRL+w and then Tab while editing a C++ file, and what happened is that the window was horizontally split and the new window loaded the buffer where the word under the ...
Enlico's user avatar
  • 2,194
2 votes
1 answer
1k views

Insert Doxygen comments automatically

I use nvim with coc and clangd as the language server on a ubuntu 22.04 machine. I mainly use it to code in c++ when I code. What I want is to automatically generate doxygen style comments to describe ...
FalcoGer's user avatar
  • 149
0 votes
1 answer
715 views

How to use ALE with clangd and C++20

I want to write code like this in vim (vim 9.0) #include <iostream> #include <string> template <class T1, class T2> concept composable = requires(T1 lhs, T2 rhs) { lhs + rhs; }; ...
FalcoGer's user avatar
  • 149
3 votes
4 answers
608 views

Working with large Visual Studio oriented codebase

I have been using Vim for about 2 years on my personal C++ project on Ubuntu with great success. I build using g++ and make, as my build system. In vim, I can build the project without problem using :...
BobMorane's user avatar
1 vote
2 answers
150 views

How to properly indent inline c++ lambdas?

How can I change the behavior of smart indentation when I write a lambda function? This is what I get right now: auto t = std::thread([]{ std::cerr << "...
Cristiano's user avatar
  • 113
2 votes
3 answers
117 views

How to fold away C++ system headers in quickfix window?

If I make a mistake in a class in some C++ code, I'll typically get a ton of messages from the compiler about how hard it's tried to find something suitable in system header files. This floods the ...
sh1's user avatar
  • 143
1 vote
2 answers
1k views

How to add <bits/stdc++.h> header file in Clangd installed through Mason (Neovim lua)?

I want to add/expand the Clangd Language server, which I installed through Mason within Neovim, with the standard libraries that come with MinGW (I run windows 11). I'm trying to do CP, and for that I ...
cringeyburger's user avatar
2 votes
1 answer
163 views

How can I configure Vim to work with bitcoin core C++ code and have intellisense like functionality?

I installed Conquer Of Completion (COC) plugin and now I can edit C++ projects with Vim taking advantage of syntax highlighting, autocompletion, inline error messages, etc. But when I try to open ...
Bitcoin_1o1's user avatar
0 votes
1 answer
49 views

Syntastic won't recognize C++ WxWidgets headers [closed]

The library it is not recognizing is WxWidgets my ~/.vimrc File execute pathogen#infect() set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:...
Benn1x's user avatar
  • 1
-1 votes
1 answer
232 views

Vim is creating a .exe file when I run some C++ code. How do I save it to a specific directory?

I have some C++ source code that I am running. I have F9 and F10 mapped to the following in my vimrc file: autocmd filetype cpp nnoremap <F9> :w <bar> !g++ -std=c++14 % -o %:r -Wl,--stack,...
John Murthy's user avatar
1 vote
1 answer
1k views

Problem with coc-clangd

I use coc and coc-clangd for C/C++. When I want to use gtk I get this message: When I compile the file with command below, the process completes successfully. gcc `pkg-config --cflags gtk+-3.0` -o ...
Reza Hosseinzadeh's user avatar
0 votes
1 answer
703 views

Compile C++ in vim

I want to make a shortcut for compiling C++ file. I use :map <F5> :!g++ % -o app && ./app <CR>. How can I edit it to set output file's name, C++ file's name without .cpp instead of ...
Reza Hosseinzadeh's user avatar
0 votes
1 answer
38 views

how to delete character which inserted automatically

I have the following mapping in my vimrc inoremap < <><left> but this statement conflicts with iabbrev cout cout<< and in insert mode I get cout<<>> how to delete &...
Chintu sharma's user avatar
2 votes
1 answer
974 views

How to setup Vim LSP plugins to use clangd on a Visual C++ project (msbuild, cl.exe)?

How do you setup clangd as an lsp when using a project not built with clang? It's giving really basic lint errors like unknown type name 'uint8_t' because it's failing to process my precompiled ...
idbrii's user avatar
  • 651
0 votes
1 answer
211 views

manually set syntax highlighting works from command-line mode but not from .vimrc/init.vim

The gruvbox colorscheme and syntax highlighting for C++ doesn't highlight some elements such as: string vector I have this: So I decided to change the colors manually using in init.vim syn keyword ...
alexzander's user avatar
1 vote
1 answer
788 views

Problem with compiling/running a file in neovim

When I try to run a file with Neovim it shows me this: It doesn't allow me to type any input. How can I type some input using Neovim ? This is my script for compiling: g++ -static -DLOCAL -lm -s -x c+...
Alexandru Vasile's user avatar
0 votes
1 answer
762 views

Syntax highlighting not working in Vim when containerized in Docker

I am running an instance of Vim in a Docker container, with configuration mostly taken from here (up untill " Build debug and release targets...) As you can see on the pic, clangd-completer works ...
dgan's user avatar
  • 101
2 votes
3 answers
11k 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?
user avatar
0 votes
1 answer
1k 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 ...
programmer's user avatar
2 votes
3 answers
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, ...
Salman Elgamal's user avatar
1 vote
0 answers
199 views

Jumping to matching angle brackets in heavily templated C++ code

By heavily templated I mean it's easy to have something like this, which is a trivial example I made up: #include <type_traits> class a {}; bool operator<(a,a) { return true; }; bool b = std::...
Enlico's user avatar
  • 2,194
2 votes
1 answer
1k 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} };...
Enlico's user avatar
  • 2,194
1 vote
0 answers
173 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> ...
user avatar
1 vote
1 answer
305 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 ...
dinskid's user avatar
  • 13
0 votes
0 answers
142 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 ...
hyperbola-hyperbole's user avatar
1 vote
2 answers
54 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 ...
gfe's user avatar
  • 245
0 votes
0 answers
301 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 ...
gfe's user avatar
  • 245
0 votes
0 answers
27 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 ...
Gaurang Tandon's user avatar
1 vote
0 answers
25 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, ...
kabanus's user avatar
  • 163
2 votes
1 answer
148 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 ...
Janek_Kozicki's user avatar
1 vote
0 answers
100 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-...
mbl's user avatar
  • 319
1 vote
0 answers
55 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: ...
TankorSmash's user avatar
1 vote
0 answers
676 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 '...
11122345791216212837's user avatar
0 votes
0 answers
146 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 <...
Byron Hawkins's user avatar
1 vote
1 answer
1k 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 ...
John's user avatar
  • 113
1 vote
1 answer
3k 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.
MindLerp's user avatar
  • 113
2 votes
2 answers
919 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 ...
Telno's user avatar
  • 33
1 vote
3 answers
738 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 ...
Justin Waterhouse's user avatar
1 vote
1 answer
33 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 ...
Yves's user avatar
  • 1,013
1 vote
1 answer
39 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 ...
Jay Mueller's user avatar
-1 votes
1 answer
365 views

Insert C/C++ loops and statements templates automatically [closed]

How do I insert C/C++-type loops and statements templates automatically in Vim?
Geremia's user avatar
  • 956
3 votes
0 answers
3k 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 ...
Neaţu Ovidiu Gabriel's user avatar
1 vote
1 answer
202 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,(...
Cloud's user avatar
  • 223