xaizek / vim-inccomplete (License: Vim) (since 2018-12-07)
Vim plugin for #include directive completion in C family of languages.
Commit 2dc46daed1c7d895cb3e225649957b307067da85

Use custom sets of exts depending on situation
In C buffers: .h
In C++ buffers on "-completion: .h and .hpp
In C++ buffers on <-completion: .h, .hpp and no extension
Author: xaizek
Author date (UTC): 2019-04-19 10:13
Committer name: xaizek
Committer date (UTC): 2019-04-19 10:13
Parent(s): ff258993f688ab515d9e2b100f8577a636911d7c
Signing key: 99DC5E4DB05F6BE2
Tree: 03304241e7bec6e46fdf998474e1575cdbd774b9
File Lines added Lines deleted
plugin/inccomplete.vim 18 4
File plugin/inccomplete.vim changed (mode: 100644) (index 62c1598..7a63c14)
1 1 " Name: inccomplete " Name: inccomplete
2 2 " Author: xaizek <xaizek@posteo.net> " Author: xaizek <xaizek@posteo.net>
3 " Version: 1.8.50
3 " Version: 1.8.51
4 4 " License: Same terms as Vim itself (see :help license) " License: Same terms as Vim itself (see :help license)
5 5 " "
6 6 " See :help inccomplete for documentation. " See :help inccomplete for documentation.
 
... ... function! s:ICFindIncludes(user, pathlst)
428 428 if empty(a:pathlst) if empty(a:pathlst)
429 429 return [] return []
430 430 endif endif
431 let l:exts = '\('.escape(join(s:ICGetExtensions(a:user), '\|'), '.').'\)'
431 432 if !a:user if !a:user
432 433 if empty(g:inccomplete_findcmd) if empty(g:inccomplete_findcmd)
433 let l:regex = '.*[/\\][-_a-z0-9]\+\(\.hpp\|\.h\)\?$'
434 let l:regex = '.*[/\\][-_a-z0-9]\+'.l:exts.'$'
434 435 else else
435 let l:regex = '.*[/\\][-_a-z0-9]+\(\.hpp\|\.h\)?$'
436 let l:regex = '.*[/\\][-_a-z0-9]+'.l:exts.'$'
436 437 endif endif
437 438 else else
438 let l:regex = '.*\(\.hpp\|\.h\)$'
439 let l:regex = '.*'.l:exts.'$'
439 440 endif endif
440 441
441 442 " execute find " execute find
 
... ... function! s:ICFindIncludes(user, pathlst)
502 503 return l:result return l:result
503 504 endfunction endfunction
504 505
506 " retrieves set of extensions acceptable for completion
507 function s:ICGetExtensions(user)
508 if s:ICIsCxxBuffer()
509 return a:user ? ['.hpp', '.h'] : ['.hpp', '.h', '']
510 endif
511 return ['.h']
512 endfunction
513
514 " checks whether current buffer is of C++ kind
515 function s:ICIsCxxBuffer()
516 return index(split(&l:filetype, '\.'), 'cpp') != -1
517 endfunction
518
505 519 " retrieves include directories from b:clang_user_options and " retrieves include directories from b:clang_user_options and
506 520 " g:clang_user_options " g:clang_user_options
507 521 " possible values of which: " possible values of which:
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vim-inccomplete

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vim-inccomplete

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master