Neovim C++ Mac 配置

NEOVIM COC and C++

https://ianding.io/2019/07/29/configure-coc-nvim-for-c-c++-development/

https://www.jianshu.com/p/249850f2cc64

ccls macbook使用的坑

需要重新编译以下ccls,并且采用brew的llvm,否则会有些误导性的错误such as:

 invalid operands to binary expression ostream and ostringstream

https://github.com/MaskRay/ccls/issues/396

  brew install llvm
  git clone --depth=1 --recursive https://github.com/MaskRay/ccls
  cd ccls
  cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm/8.0.0_1/ # note the version number here, it depends
  cmake --build Release --target install

增加linter

Google CPP Linter 我使用的是上述linter。

然后配置neovim 文件

autocmd BufWritePre *.cpp !cpplint %

自定义skeleton

https://www.geeksforgeeks.org/creating-a-c-template-in-vim-in-linux/

Snippets plugin

https://github.com/SirVer/ultisnips

小知识

g++ == gcc -xc++ -lstdc++ -shared-libgcc
Avatar
Marco Huang
Yet Another Engineer
comments powered by Disqus