All Projects → deoplete-plugins → Deoplete Clang

deoplete-plugins / Deoplete Clang

Licence: mit
deoplete.nvim source for C/C++/Obj-C/Obj-C++ with clang-python3

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
cpp
1120 projects
objc
23 projects

Projects that are alternatives of or similar to Deoplete Clang

Instant.nvim
collaborative editing in Neovim using built-in capabilities
Stars: ✭ 178 (-4.3%)
Mutual labels:  neovim, neovim-plugin
Vim Clap
👏 Modern performant fuzzy picker for Vim and NeoVim
Stars: ✭ 1,802 (+868.82%)
Mutual labels:  neovim, neovim-plugin
Nvim Bqf
Better quickfix window in Neovim, polish old quickfix window.
Stars: ✭ 120 (-35.48%)
Mutual labels:  neovim, neovim-plugin
Neovim Fuzzy
Fuzzy file finding for neovim
Stars: ✭ 103 (-44.62%)
Mutual labels:  neovim, neovim-plugin
Acid.nvim
Asynchronous Clojure Interactive Development
Stars: ✭ 147 (-20.97%)
Mutual labels:  neovim, neovim-plugin
Toast.vim
🍞 Toast! A colorful, medium-contrast color scheme with full Vim and Neovim support and automatic light and dark variants. Easy to read without frying your retinae.
Stars: ✭ 108 (-41.94%)
Mutual labels:  neovim, neovim-plugin
Animate.vim
A Vim Window Animation Library
Stars: ✭ 173 (-6.99%)
Mutual labels:  neovim, neovim-plugin
Wishlist
A public catalogue of Lua plugins Neovim users would like to see exist
Stars: ✭ 74 (-60.22%)
Mutual labels:  neovim, neovim-plugin
Dstep
A tool for converting C and Objective-C headers to D modules
Stars: ✭ 177 (-4.84%)
Mutual labels:  clang, libclang
Nvim Lsputils
Better defaults for nvim-lsp actions
Stars: ✭ 142 (-23.66%)
Mutual labels:  neovim, neovim-plugin
Asyncrun.vim
🚀 Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Stars: ✭ 1,332 (+616.13%)
Mutual labels:  neovim, neovim-plugin
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (-12.37%)
Mutual labels:  neovim, neovim-plugin
Sniprun
A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
Stars: ✭ 93 (-50%)
Mutual labels:  neovim, neovim-plugin
Nvim Treesitter Context
Show code context
Stars: ✭ 113 (-39.25%)
Mutual labels:  neovim, neovim-plugin
Todoist.nvim
A todoist extension for neovim
Stars: ✭ 84 (-54.84%)
Mutual labels:  neovim, neovim-plugin
Neotags.nvim
Tag highlight in neovim
Stars: ✭ 124 (-33.33%)
Mutual labels:  neovim, neovim-plugin
Irony Mode
A C/C++ minor mode for Emacs powered by libclang
Stars: ✭ 851 (+357.53%)
Mutual labels:  clang, libclang
Nvim Hlslens
Hlsearch Lens for Neovim
Stars: ✭ 55 (-70.43%)
Mutual labels:  neovim, neovim-plugin
Vem Tabline
A lightweight Vim/Neovim plugin to display buffers and tabs in the tabline
Stars: ✭ 129 (-30.65%)
Mutual labels:  neovim, neovim-plugin
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+1036.56%)
Mutual labels:  neovim, neovim-plugin

deoplete-clang

Status
Ubuntu 14.04 Build Status

C/C++/Objective-C/Objective-C++ source for deoplete.nvim

Overview

Deoplete-clang offers asynchronous completion of code written in C, C++, Objective-C and Objective-C++ inside of Neovim. It is built upon the following tools:

deoplete

Shougo/deoplete.nvim

The dark powered asynchronous completion framework for Neovim. It offers a fast, fully asynchronous, nonblocking user interface, customizable sources for each languages, and more. The Next generation of word completion.

libclang-python3

zchee/libclang-python3

A Python 3 port of the official clang compiler bindings for Python. The original author is @Anteru, I forked it and follow the latest of llvm clang.

Requirements

Neovim and neovim/python-client

https://github.com/neovim/neovim https://github.com/neovim/python-client

deoplete.nvim

https://github.com/Shougo/deoplete.nvim

libclang shared object (dynamic library)

http://llvm.org https://github.com/apple/swift-clang

How to install

Install Neovim

See the Neovim wiki.

Install the neovim/python-client

Neovim remote client for Python. See https://github.com/neovim/python-client

pip2 install --upgrade neovim
pip3 install --upgrade neovim

Install libclang and clang headers

For GNU/Linux, e.g. apt family,

apt-get install clang

For macOS, use Homebrew:

brew install llvm --with-clang

This has not been tested, it is recommended to build from source. See http://clang.llvm.org/get_started.html or try the build-llvm script. You will need cmake, ninja or Xcode.

Build llvm for OS X

Install deoplete and deoplete-clang

" dein.vim (fastest)
call dein#add('Shougo/deoplete.nvim')
call dein#add('zchee/deoplete-clang')
" NeoBundle
NeoBundle 'Shougo/deoplete.nvim'
NeoBundle 'zchee/deoplete-clang'
" vim-plug
Plug 'Shougo/deoplete.nvim'
Plug 'zchee/deoplete-clang'

Available Settings

Setting value Default Required
g:deoplete#sources#clang#libclang_path '' Yes
g:deoplete#sources#clang#clang_header '' Yes
g:deoplete#sources#clang#std See this section No
g:deoplete#sources#clang#flags See this section No
g:deoplete#sources#clang#sort_algo '' No
g:deoplete#sources#clang#clang_complete_database '' No
g:deoplete#sources#clang#include_default_arguments False No
g:deoplete#sources#clang#filter_availability_kinds [] No

g:deoplete#sources#clang#libclang_path

Required Yes
Type string
Default -
Example path/to/lib/libclang.so

The libclang shared object (dynamic library) file path. On GNU/Linux the file name is libclang.so. On macOS it is libclang.dylib. If you cannot find file libclang.so use libclang.so.1 instead. libclang.so is only availible if libclang-dev is installed.

If you have trouble locating the library you can use the find command,

# On GNU/Linux
[sudo] find / -name libclang.so
# On macOS
mdfind -name libclang.dylib

g:deoplete#sources#clang#clang_header

Required Yes
Type string
Default -
Example path/to/lib/clang

The clang built-in include header directory path; not clang-c, and not the required clang version. Deoplete-clang always use the latest clang version.

Example:

/opt/llvm/lib/clang
└── 3.9.0
    ├── include
    │   ├── Intrin.h
    │   ├── __clang_cuda_cmath.h
    │   ├── __clang_cuda_runtime_wrapper.h
    │   ├── __stddef_max_align_t.h
    │   ├── __wmmintrin_aes.h
    │   ├── __wmmintrin_pclmul.h
    │   ├── adxintrin.h
    │   ├── altivec.h
    │   ├── ammintrin.h
    │   ├── arm_acle.h
    │   ├── arm_neon.h
    .
    .
    .
    │   ├── stdalign.h
    │   ├── stdarg.h
    │   ├── stdatomic.h
    │   ├── stdbool.h
    │   ├── stddef.h
    │   ├── stdint.h
    .
    .
    .
    │   ├── xsavecintrin.h
    │   ├── xsaveintrin.h
    │   ├── xsaveoptintrin.h
    │   ├── xsavesintrin.h
    │   └── xtestintrin.h
    ├── lib
    │   └── darwin
    └── vtables_blacklist.txt

g:deoplete#sources#clang#std

Required No
Type dict
C Default c11
C++ Default c++1z
Objective-C Default c11
Objective-C++ Default c++1z
Example {'c': 'c11', 'cpp': 'c++1z', 'objc': 'c11', 'objcpp': 'c++1z'}

The standard version for each of the C family languages. By default, use the lastest version supported by clang.

g:deoplete#sources#clang#flags

Required No
Type list
C Default ['-x', 'c']
C++ Default ['-x', 'c++']
Objective-C Default ['-x', 'objective-c']
Objective-C++ Default ['-x', 'objective-c++']
Example ["-fblocks",]

C(XX)FLAGS for generating completions. Setting value other than default. Does not need -x c or similar.

If you want to know the default clang build flags your of your installation you can try

# C
echo | clang -v -E -x c -
# C++
echo | clang -v -E -x c++ -
# Objective-C
echo | clang -v -E -x objective-c -
# Objective-C++
echo | clang -v -E -x objective-c++ -

For example, on macOS the settings would correspond to:

let g:deoplete#sources#clang#flags = [
      \ "-cc1",
      \ "-triple", "x86_64-apple-macosx10.11.0",
      \ "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk",
      .
      .
      .
      \ "-fmax-type-align=16",
      \ ]

g:deoplete#sources#clang#sort_algo

Required No
Type string
Default ''
Example priority or alphabetical

The sorting algorithm for libclang completion results. Available values are priority or alphabetical.

The default ('') uses the deoplete.nvim sorting algorithm. priority sorts the way libclang determines priority, alphabetical sorts by alphabetical order.

g:deoplete#sources#clang#clang_complete_database

Required No
Type string
Default ''
Example /path/to/neovim/build

Support a clang JSON compilation database format specification; see http://clang.llvm.org/docs/JSONCompilationDatabase.html for more information.

The setting value must be an existing compile_commands.json directory. This setting is optional.

When this setting is used the compilation database file will take precedence over the g:deoplete#sources#clang#flags setting. Parsing the compilation database file will take some time, so please on use this setting if you really need to support a compilation database.

I'm planning the rewrite the parser in Go for faster parsing in the future.

g:deoplete#sources#clang#include_default_arguments

Required No
Type bool
Default False
Example True or False

Include default arguments in function signatures.

g:deoplete#sources#clang#filter_availability_kinds

Required No
Type list
Default []
Example ['NotAvailable', 'NotAccessible']

Filter candidates to exclude the listed availability kinds. An empty list will does not perform any filtering.

Availability kind strings include:

String Description
'Available' The entity is available
'Deprecated' The entity is available, but has been deprecated
'NotAvailable' The entity is not available, any use of it will be an error
'NotAccessible' The entity is available, but not accessible, any use of it will be an error

For example, using 'NotAccessible' would result in private class members being filtered out from the candidates when they are not accessible from the given context.

Project-specific settings

Deoplete-clang supports compiler-flags local to individual projects. It will search the current working directory for a .clang file; if no such file is found it will try searching the parent directory. The format of the .clang file is either

flags = <flags>

or

compilation_database = "<path to compilation_database>"

The former requires all compiler flags to be written on one line. For example: flags = -I/path/to/include1 -I/path/to/include2. The format of the latter requires the path (relative to the .clang file) to a clang JSON compilation database format specification as described here: http://clang.llvm.org/docs/JSONCompilationDatabase.html

FAQ

deoplete-clang does not support completion from header files

This is not supported. You should use the neoinclude plugin instead: https://github.com/Shougo/neoinclude.vim

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].