]> git.madduck.net Git - etc/vim.git/blob - autoload/asyncomplete/utils.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/asyncomplete/' content from commit 016590d2
[etc/vim.git] / autoload / asyncomplete / utils.vim
1 " Find a nearest to a `path` parent directory `directoryname` by traversing the
2 " filesystem upwards
3 function! asyncomplete#utils#find_nearest_parent_directory(path, directoryname) abort
4     let l:relative_path = finddir(a:directoryname, a:path . ';')
5
6     if !empty(l:relative_path)
7         return fnamemodify(l:relative_path, ':p')
8     else
9         return ''
10     endif
11 endfunction
12
13 if exists('*matchstrpos')
14     function! asyncomplete#utils#matchstrpos(expr, pattern) abort
15         return matchstrpos(a:expr, a:pattern)
16     endfunction
17 else
18     function! asyncomplete#utils#matchstrpos(expr, pattern) abort
19         return [matchstr(a:expr, a:pattern), match(a:expr, a:pattern), matchend(a:expr, a:pattern)]
20     endfunction
21 endif