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

Optimize '#include <|' case as most useful
This is done by caching results of such completion.
Yes, I do know it will stay in the memory, and that it's bad, but
it works extremely fast!
Author: xaizek
Author date (UTC): 2012-04-15 18:31
Committer name: xaizek
Committer date (UTC): 2012-04-15 18:31
Parent(s): f1ecca04beb330252e2f39116eb56cfbb3e397ce
Signing key:
Tree: 84d36f1da6b01caf5ec3d394a64322a05c5bf334
File Lines added Lines deleted
plugin/inccomplete.vim 18 7
File plugin/inccomplete.vim changed (mode: 100644) (index 1cc0fe2..dad8c07)
1 1 " Name: inccomplete " Name: inccomplete
2 2 " Author: xaizek <xaizek@gmail.com> " Author: xaizek <xaizek@gmail.com>
3 " Version: 1.6.27
3 " Version: 1.6.28
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! ICComplete(findstart, base)
101 101 return eval(s:oldomnifuncs[l:curbuf]. return eval(s:oldomnifuncs[l:curbuf].
102 102 \ "(".a:findstart.",'".a:base."')") \ "(".a:findstart.",'".a:base."')")
103 103 else else
104 let l:pos = match(getline('.'), '<\|"')
105 let l:bracket = getline('.')[l:pos : l:pos]
106
107 if empty(a:base) && l:bracket == '<' && exists('s:fullCached')
108 return s:fullCached
109 endif
110
104 111 let l:old_cwd = getcwd() let l:old_cwd = getcwd()
105 112 lcd %:p:h lcd %:p:h
106 113
107 114 " get list of all candidates and reduce it to those starts with a:base " get list of all candidates and reduce it to those starts with a:base
108 let l:pos = match(getline('.'), '<\|"')
109 let l:bracket = getline('.')[l:pos : l:pos]
110 115 let l:inclst = s:ICGetList(l:bracket == '"', a:base) let l:inclst = s:ICGetList(l:bracket == '"', a:base)
111 116 let l:inclst = s:ICFilterIncLst(l:bracket == '"', l:inclst, a:base) let l:inclst = s:ICFilterIncLst(l:bracket == '"', l:inclst, a:base)
112 117
 
... ... function! ICComplete(findstart, base)
129 134 endif endif
130 135
131 136 if isdirectory(l:increc[0].'/'.l:increc[1]) if isdirectory(l:increc[0].'/'.l:increc[1])
132 let l:bracket = ''
137 let l:strend = ''
133 138 let l:slash = l:sl2 let l:slash = l:sl2
134 139 else else
135 let l:bracket = l:closebracket
140 let l:strend = l:closebracket
136 141 let l:slash = '' let l:slash = ''
137 142 endif endif
138 143
139 144 let l:item = { let l:item = {
140 \ 'word': l:increc[1].l:bracket,
145 \ 'word': l:increc[1].l:strend,
141 146 \ 'abbr': l:increc[1].l:slash, \ 'abbr': l:increc[1].l:slash,
142 147 \ 'menu': s:ICModifyPath(l:increc[0]), \ 'menu': s:ICModifyPath(l:increc[0]),
143 148 \ 'dup': 0 \ 'dup': 0
 
... ... function! ICComplete(findstart, base)
147 152
148 153 execute 'lcd' l:old_cwd execute 'lcd' l:old_cwd
149 154
150 return s:SortList(l:comlst)
155 let l:result = s:SortList(l:comlst)
156
157 if empty(a:base) && l:bracket == '<'
158 let s:fullCached = l:result
159 endif
160
161 return l:result
151 162 endif endif
152 163 endfunction endfunction
153 164
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