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

Sort directories in front of files
Author: xaizek
Author date (UTC): 2019-04-19 10:01
Committer name: xaizek
Committer date (UTC): 2019-04-19 10:01
Parent(s): 5cc060406d7786cee5bef969e840b1ca43f9e153
Signing key: 99DC5E4DB05F6BE2
Tree: 6bd9825b6ef34e2e8916ef790fc23fd9779cf937
File Lines added Lines deleted
plugin/inccomplete.vim 12 3
File plugin/inccomplete.vim changed (mode: 100644) (index c588fbb..1e1ce74)
1 1 " Name: inccomplete " Name: inccomplete
2 2 " Author: xaizek <xaizek@posteo.net> " Author: xaizek <xaizek@posteo.net>
3 " Version: 1.8.48
3 " Version: 1.8.49
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)
196 196 continue continue
197 197 endif endif
198 198
199 if isdirectory(l:increc[0].'/'.l:increc[1])
199 let l:isdir = isdirectory(l:increc[0].'/'.l:increc[1])
200 if l:isdir
200 201 let l:slashidx = strridx(l:increc[1], l:sl2) let l:slashidx = strridx(l:increc[1], l:sl2)
201 202 if l:increc[1][l:slashidx + 1] == '.' if l:increc[1][l:slashidx + 1] == '.'
202 203 continue continue
 
... ... function! ICComplete(findstart, base)
209 210 let l:slash = '' let l:slash = ''
210 211 endif endif
211 212
213 " XXX: set 'kind' to 'd'/'f' to indicate directory/file?
212 214 let l:item = { let l:item = {
213 215 \ 'word': l:increc[1].l:strend, \ 'word': l:increc[1].l:strend,
214 216 \ 'abbr': l:increc[1].l:slash, \ 'abbr': l:increc[1].l:slash,
215 217 \ 'menu': s:ICModifyPath(l:increc[0]), \ 'menu': s:ICModifyPath(l:increc[0]),
216 \ 'dup': 0
218 \ 'dup': 0,
219 \ 'dir': l:isdir
217 220 \} \}
218 221 call add(l:comlst, l:item) call add(l:comlst, l:item)
219 222 endfor endfor
 
... ... function s:SortList(lst)
239 242 endif endif
240 243 endfunction endfunction
241 244 function s:IgnoreCaseComparer(i1, i2) function s:IgnoreCaseComparer(i1, i2)
245 if a:i1['dir'] != a:i2['dir']
246 return a:i1['dir'] ? -1 : 1
247 endif
242 248 return a:i1['abbr'] == a:i2['abbr'] ? 0 : return a:i1['abbr'] == a:i2['abbr'] ? 0 :
243 249 \ (a:i1['abbr'] > a:i2['abbr'] ? 1 : -1) \ (a:i1['abbr'] > a:i2['abbr'] ? 1 : -1)
244 250 endfunction endfunction
245 251 function s:Comparer(i1, i2) function s:Comparer(i1, i2)
252 if a:i1['dir'] != a:i2['dir']
253 return a:i1['dir'] ? -1 : 1
254 endif
246 255 return a:i1['abbr'] ==# a:i2['abbr'] ? 0 : return a:i1['abbr'] ==# a:i2['abbr'] ? 0 :
247 256 \ (a:i1['abbr'] ># a:i2['abbr'] ? 1 : -1) \ (a:i1['abbr'] ># a:i2['abbr'] ? 1 : -1)
248 257 endfunction endfunction
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