Skip to content

Commit

Permalink
Merge pull request #23 from thawk/master
Browse files Browse the repository at this point in the history
import include path from &path
  • Loading branch information
justmao945 committed Nov 2, 2014
2 parents 7a3f57c + c33be75 commit aa874d5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugin/clang.vim
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ if !exists('g:clang_vim_exec')
endif
endif

if !exists('g:clang_use_path')
let g:clang_use_path = 1
endif

" Init on c/c++ files
au FileType c,cpp call <SID>ClangCompleteInit(0)
"}}}
Expand Down Expand Up @@ -721,6 +725,21 @@ func! s:ClangCompleteInit(force)
endfor
endif

" parse include path from &path
if g:clang_use_path
let l:dirs = map(split(&path, '\\\@<![, ]'), 'substitute(v:val, ''\\\([, ]\)'', ''\1'', ''g'')')
for l:dir in l:dirs
if len(l:dir) == 0 || !isdirectory(l:dir)
continue
endif

" Add only absolute paths
if matchstr(l:dir, '\s*/') != ''
let b:clang_options .= ' -I ' . shellescape(l:dir)
endif
endfor
endif

" backup options without PCH support
let b:clang_options_noPCH = b:clang_options

Expand Down

0 comments on commit aa874d5

Please sign in to comment.