All Projects → justmao945 → Vim Clang

justmao945 / Vim Clang

Licence: isc
Clang completion plugin for vim

Projects that are alternatives of or similar to Vim Clang

clang-tool
Simple and powerful standalone project for clang-based tools using libtooling (e.g. refactoring, auto-completion, etc.)
Stars: ✭ 35 (-89.55%)
Mutual labels:  clang, code-completion
Easyclangcomplete
💥 Robust C/C++ code completion for Sublime Text 3
Stars: ✭ 537 (+60.3%)
Mutual labels:  clang, code-completion
Format.cmake
💅 Stylize your code! Automatic clang-format and cmake-format targets for CMake.
Stars: ✭ 94 (-71.94%)
Mutual labels:  clang
Libobjc2
Objective-C runtime library intended for use with Clang.
Stars: ✭ 290 (-13.43%)
Mutual labels:  clang
Coroutine
C++ 20 Coroutines in Action (Helpers + Test Code Examples)
Stars: ✭ 262 (-21.79%)
Mutual labels:  clang
Cattle
🐺 Platform to Run and Share Code. It Supports PHP, Python, Ruby, Java, Go, Rust, C and C++.
Stars: ✭ 40 (-88.06%)
Mutual labels:  clang
Clangwarnings.com
A list of Clang warnings and their descriptions.
Stars: ✭ 276 (-17.61%)
Mutual labels:  clang
SameTypeClangPlugin
自定义检查规范的 Clang 插件
Stars: ✭ 47 (-85.97%)
Mutual labels:  clang
Dcd
The D Completion Daemon is an auto-complete program for the D programming language
Stars: ✭ 310 (-7.46%)
Mutual labels:  code-completion
Olifant
A simple programming language targeting LLVM
Stars: ✭ 58 (-82.69%)
Mutual labels:  clang
Clang Power Tools
Bringing clang-tidy magic to Visual Studio C++ developers.
Stars: ✭ 285 (-14.93%)
Mutual labels:  clang
reflective-rapidjson
Code generator for serializing/deserializing C++ objects to/from JSON using Clang and RapidJSON
Stars: ✭ 26 (-92.24%)
Mutual labels:  clang
clang-format-editor
Clang-Format Editor is a tool that helps you find the best Clang-Format Style for your C++, C#, Java, JavaScript, and Objective-C code.
Stars: ✭ 15 (-95.52%)
Mutual labels:  clang
Avbuild
ffmpeg花式编译. build tool for all platforms: iOS, android, raspberry pi, win32, uwp, linux, macOS etc.
Stars: ✭ 285 (-14.93%)
Mutual labels:  clang
llvm-svn
Arch Linux PKGBUILD for LLVM, Clang et al. (latest SVN code)
Stars: ✭ 18 (-94.63%)
Mutual labels:  clang
Clangd
clangd language server
Stars: ✭ 293 (-12.54%)
Mutual labels:  clang
llvm-project-prepo
Fork of LLVM with modifications to support a program repository
Stars: ✭ 27 (-91.94%)
Mutual labels:  clang
CSwift
C Module for Swift, Swift Script and Dynamic Library Call;Swift中直接调用C语言源程序的展示程序
Stars: ✭ 46 (-86.27%)
Mutual labels:  clang
Boomerang
Boomerang Decompiler - Fighting the code-rot :)
Stars: ✭ 265 (-20.9%)
Mutual labels:  clang
Clangkit
ClangKit provides an Objective-C frontend to LibClang. Source tokenization, diagnostics and fix-its are actually implemented.
Stars: ✭ 330 (-1.49%)
Mutual labels:  clang

vim-clang

Gitter

Use of clang to parse and complete C/C++ source files.

C source

Installation

  • Require executable clang installed.
  • Putting the content of plugin/ into ~/.vim/plugin works.
  • Using a plugin manager, like pathogen.vim, is recommended. Installation via pathogen is done by cd ~/.vim/bundle; git clone https://github.com/justmao945/vim-clang.git.

Why

I was a user of clang_complete and it's really a good job, but someday I found that I must write another plugin to overcome some drawbacks of it.

vim-clang VS Rip-Rip/clang_complete

  1. User options can be set for different file types in vim-clang.

     let g:clang_c_options = '-std=gnu11'
     let g:clang_cpp_options = '-std=c++11 -stdlib=libc++'
    
  2. vim-clang is faster than clang_complete (not using libclang). vim-clang does not support libclang now, and I don't think it's a good idea to use cindex.py(python binding for clang) directly. If you use clang_complete with libclang and open many C/C++ source files, you'll find that VIM eats up hundreds of MB RAM...

    • vim-clang caches output of clang and reuses if the completion point is not changed and without errors.
    • vim-clang only runs clang once to get completions and diagnostics.
  3. vim-clang is more friendly than clang_complete.

    • vim-clang uses the preview window to show prototypes for C/C++ sources. Generally, C++ source has many overload functions and most of completions are very complex, which is not good to put this into OmniComplete popup menu.
    • vim-clang uses a split window to show the caret diagnostics from clang. clang_complete uses quickfix window to show diagnostics without caret, but that's not the best choice... Because the caret diagnostics of clang including many useful infomation.
  4. vim-clang supports relative include path in .clang configuration file.

     proj/
     |-- .clang
     |-- include/
         |-- main.h
     |-- src/
         |-- main.c
     |-- test/
         |-- main_test.c
     
     $ cat .clang
     -I.
    
  5. Better PCH support. vim-clang will find stdafx.h.pch automatically.

vim-clang VS Valloric/YouCompleteMe

YouCompleteMe is more powerful than vim-clang, that has a well designed client-server architecture to deal the memory problem in clang_complete.

Features

Asynchronized mode [new]

  • Now vim-clang supports to call clang executable asynchronously that it won't block vim during the completion. This is very useful if your project is large and the machine is not very powerful to parse them in tens of milliseconds. In synchronized mode you'll find that's too 'slow' to wait the completion...

  • This mode is implemented by starting another vim process to notify the finish of the completion, so +clientserver option is required to compile the vim(generally added).

  • GVIM is required to use this mode, seems given --servername ??? to vim is not working.

  • Job control is used to run clang when in neovim, which is really very nice! Thank you syswow.

Compile commands [new]

  • Use cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 to generate compile_commands.json

  • To use the compile commands database in vim-clang, set the g:clang_compilation_database variable in your vimrc to your cmake build path.

      let g:clang_compilation_database = './build'
    

Neomake integration [new]

  • vim-clang now adds the compilation arguments parsed from .clang and .clang.ow to Neomake configuration variables. This means that the include search paths (-I) that are in the .clang files will be passed down to the clang and gcc makers from Neomake without overriding your configuration.
  • vim-clang will also set the directory from where the maker will run, which is the directory where the first .clang or .clang.ow is.

The variables that are affected are:

  • g:neomake_cpp_clang_maker
  • g:neomake_cpp_gcc_maker
  • g:neomake_c_clang_maker
  • g:neomake_c_gcc_maker

Options and Commands

:h clang.txt

OS requirement

Tested on

  • Ubuntu 14.04
  • Mac OS X 10.10
  • Windows 7
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].