Gabirel / Hack-SpaceVim

🚀 Tell you how to hack SpaceVim. Be useful. Try Discussions!
MIT License
475 stars 68 forks source link

IDE for C/C++ developer #19

Open Gabirel opened 7 years ago

Gabirel commented 7 years ago

Teach you how to make SpaceVim become a IDE for C/C++

HanielF commented 7 years ago

so?

Gabirel commented 7 years ago

I've been lazy recently. If you really need this, I could finish this in this week. Probably.

Gabirel commented 5 years ago

Vim + YCM (Still Updating under this comment)

Tested on a medium project successfully, which has over 10 thousand lines of source code.

YES! Please Use YCM since YCM is so easy and smooth to use.

Basic Setup

  1. Enable YCM Add this to your ~/.SpaceVim.d/init.vim

    let g:spacevim_enable_ycm = 1

PS: If you want to enable YCM in ~/.SpaceVim.d/init.toml, please use bootstrap-function

  1. Configure your project with .ycm_extra_config.py

With Conan - set FLAGS manually

  1. Enable YCM with conan Here's the simple case: (Using cmake at the same time) ycm is for generating .ycm_extra_config.py and conan_ycm_flags.json
[requires]
OpenSSL/1.0.2o@conan/stable

[generators]
cmake
ycm
  1. Generate flags and config file Execute the below code when configuring the project for cmake

    conan install ..

  2. Copy and link flags and config file for YCM to your root directory of the project Make sure that you have .ycm_extra_config.py and conan_ycm_flags.json in your root directory of the project

  3. That's it!! Enjoy YCM and SpaceVim.

Use compiledb

TODO

PS: Here's are my config for YCM. Use it at your own risk.

let g:spacevim_enable_ycm = 1
let g:spacevim_custom_plugins = [
    \ ['rdnetto/YCM-Generator'],
    \ ]
let g:ycm_error_symbol = '✗'
let g:ycm_complete_in_comments = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
let g:ycm_confirm_extra_conf = 0
let g:ycm_seed_identifiers_with_syntax = 0
let g:ycm_semantic_triggers =  {
  \   'c' : ['->', '.'],
  \   'cpp,objcpp' : ['->', '.', '::'],
  \   'php' : ['->', '::'],
  \   'cs,java,javascript,typescript,d,python,perl6,scala,vb,elixir,go' : ['.'],
  \   'ruby' : ['.', '::'],
  \   'lua' : ['.', ':'],
  \ }