2

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!

2 Answers 2

0
+50

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 is a popular Vim configuration and this Changelog podcast contained a number of tips for using Vim including links to the guests' dot files.

You'll want to make use of vimdiff for reviewing pull requests. As Jon Atack says in this doc:

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.

5
  • 1
    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? Aug 27, 2022 at 19:34
  • @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. stackoverflow.com/questions/563616/… Aug 28, 2022 at 22:23
  • You say "But when I try to open bitcoin source code files I get too many errors" in your question? Aug 28, 2022 at 23:00
  • 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! Aug 30, 2022 at 0:57
  • Cool, post the link here. I'll watch it :) Aug 30, 2022 at 8:56
0

I found the problem, a build database, based on the project, had to be generated for Clangd language server to do it's work. To do it, I used 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.