<p>I found the problem, a build database, based on the project, had to be generated for <a href="https://clangd.llvm.org/installation.html" rel="nofollow noreferrer">Clangd</a> language server to do it's work. To do it, I used <a href="https://github.com/rizsotto/Bear" rel="nofollow noreferrer">Bear</a>, a tool that intercepts the build commands and generates a compilation database for clang tooling (compile_commands.json). I also made a video:
<a href="https://youtu.be/lC5USwFM6EQ" rel="nofollow noreferrer">https://youtu.be/lC5USwFM6EQ</a> (English),
<a href="https://www.youtube.com/watch?v=5tkgqzxic-Q" rel="nofollow noreferrer">https://www.youtube.com/watch?v=5tkgqzxic-Q</a> (Spanish) explaining how I did the installation and configuration. I hope this helps other developers.</p>

CC BY-SA 4.0
2022-08-31T19:19:13.820Z
2022-09-01T19:38:06.830Z
2022-09-01T19:38:06.830Z
Bitcoin_1o1
<p>I suspect this is a problem with your plugin rather than Vim. Try disabling the plugin and see if you have the same issue. I have no problems opening and editing all Bitcoin Core source code files including <code>wallet/coinselection.h</code> with Vim.</p>
<p>I'm not a Vim guru by any means (hopefully someone who is will answer) but for recommendations on using Vim generally (not Bitcoin Core specific) <a href="https://github.com/amix/vimrc" rel="nofollow noreferrer">vimrc</a> is a popular Vim configuration and this <a href="https://changelog.com/podcast/450" rel="nofollow noreferrer">Changelog podcast</a> contained a number of tips for using Vim including links to the guests' dot files.</p>
<p>You'll want to make use of <a href="https://vi.stackexchange.com/questions/625/how-do-i-use-vim-as-a-diff-tool">vimdiff</a> for reviewing pull requests. As Jon Atack says in this <a href="https://jonatack.github.io/articles/how-to-review-pull-requests-in-bitcoin-core" rel="nofollow noreferrer">doc</a>:</p>
<blockquote>
<p>While the build and tests are running, begin reviewing each commit separately in your local environment using a diff tool like gitk, meld, meld for macOS, GNU ediff for Emacs, vimdiff or vim-diffconflicts for Vim, opendiff on macOS, or diffoscope</p>
</blockquote>
<p>There is also a Vi/Vim <a href="https://vi.stackexchange.com/">StackExchange</a>.</p>

CC BY-SA 4.0
2022-08-27T19:34:18.633Z
Thx, I'm very familiar with Vim configuration. I do can open Bitcoin source files, but I want autocopletion, goto definition and member list help. Do you use tab completion and goto definition when you edit bitcoin source files? Do you use any plugin?
Bitcoin_1o1
CC BY-SA 4.0
2022-08-28T22:23:09.120Z
@Bitcoin_1o1: I use ctags, cscope for goto definitions but personally I don't use autocompletion (excluding basic find and replace) or member list help. As I said I'm no Vim guru so there may be plugins for those. https://stackoverflow.com/questions/563616/vim-and-ctags-tips-and-tricks
Michael Folkson
CC BY-SA 4.0
2022-08-28T23:00:33.910Z
You say "But when I try to open bitcoin source code files I get too many errors" in your question?
Michael Folkson
CC BY-SA 4.0
2022-08-30T00:57:45.967Z
thanks, I managed to make it work, I'm going to make a video so other people who work with Vim can do the configuration. Best!
Bitcoin_1o1
CC BY-SA 4.0
2022-08-30T08:56:48.463Z
Cool, post the link here. I'll watch it :)
Michael Folkson
CC BY-SA 4.0
2022-08-27T18:40:41.907Z
2022-08-28T22:36:42.357Z
2022-08-28T22:36:42.357Z
Michael Folkson
<p>I use Vim for editing, 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 source code files I get too many errors, like:</p>
<p><code>Too many errors emitted, stopping now</code>
<code>'wallet/coinselection.h' file not found</code>
<code>Unknown type name 'OutputGroup'</code>
Etc.</p>
<p>Is there a best practice to work with the source code in Vim, or at least some general recommendations you can share?</p>
<p>Thanks!</p>

<bitcoin-core-development><c++><source-code>
How can I configure Vim to work with bitcoin core C++ source code and have Intellisense like functionality?
Bitcoin_1o1
# How can I configure Vim to work with bitcoin core C++ source code and have Intellisense like functionality?

(Asked by: username_0 on 2022-08-25)

I use Vim for editing, 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 source code files I get too many errors, like:

`Too many errors emitted, stopping now`
`'wallet/coinselection.h' file not found`
`Unknown type name 'OutputGroup'`
Etc.

Is there a best practice to work with the source code in Vim, or at least some general recommendations you can share?

Thanks!

**Tags:** bitcoin-core-development, c++, source-code


---

## 2 answers

### Answer by username_0 on 2022-08-31. Score: 1 | Accepted answer

I found the problem, a build database, based on the project, had to be generated for [Clangd](https://clangd.llvm.org/installation.html) language server to do it's work. To do it, I used [Bear](https://github.com/rizsotto/Bear), a tool that intercepts the build commands and generates a compilation database for clang tooling (compile\_commands.json). I also made a video:
<https://youtu.be/lC5USwFM6EQ> (English),
<https://www.youtube.com/watch?v=5tkgqzxic-Q> (Spanish) explaining how I did the installation and configuration. I hope this helps other developers.


---

### Answer by username_1 on 2022-08-27. Score: 0

I suspect this is a problem with your plugin rather than Vim. Try disabling the plugin and see if you have the same issue. I have no problems opening and editing all Bitcoin Core source code files including `wallet/coinselection.h` with Vim.

I'm not a Vim guru by any means (hopefully someone who is will answer) but for recommendations on using Vim generally (not Bitcoin Core specific) [vimrc](https://github.com/amix/vimrc) is a popular Vim configuration and this [Changelog podcast](https://changelog.com/podcast/450) contained a number of tips for using Vim including links to the guests' dot files.

You'll want to make use of [vimdiff](https://vi.stackexchange.com/questions/625/how-do-i-use-vim-as-a-diff-tool) for reviewing pull requests. As Jon Atack says in this [doc](https://jonatack.github.io/articles/how-to-review-pull-requests-in-bitcoin-core):

> While the build and tests are running, begin reviewing each commit separately in your local environment using a diff tool like gitk, meld, meld for macOS, GNU ediff for Emacs, vimdiff or vim-diffconflicts for Vim, opendiff on macOS, or diffoscope

There is also a Vi/Vim [StackExchange](https://vi.stackexchange.com/).

> **Comments:**
> **username_0**: Thx, I'm very familiar with Vim configuration. I do can open Bitcoin source files, but I want autocopletion, goto definition and member list help. Do you use tab completion and goto definition when you edit bitcoin source files? Do you use any plugin?  
> **username_1**: @username_0: I use ctags, cscope for goto definitions but personally I don't use autocompletion (excluding basic find and replace) or member list help. As I said I'm no Vim guru so there may be plugins for those. https://stackoverflow.com/questions/563616/vim-and-ctags-tips-and-tricks  
> **username_1**: You say "But when I try to open bitcoin source code files I get too many errors" in your question?  
> **username_0**: thanks, I managed to make it work, I'm going to make a video so other people who work with Vim can do the configuration. Best!  
> **username_1**: Cool, post the link here. I'll watch it :)  

---

