]> Sergey Matveev's repositories - dotfiles.git/blob - vim/.vim/plugin/zshfe.vim
af3540bb7b6377acdb1d92fc978f2ae00bd68e72
[dotfiles.git] / vim / .vim / plugin / zshfe.vim
1 " zsh file completion caller
2 " Maintainer: Sergey Matveev <stargrave@stargrave.org>
3 " License: GNU General Public License version 3 of the License or later
4
5 if exists("*<SID>zshfe") | finish | endif
6 if !exists("g:zshfe_path") | let g:zshfe_path=expand("~/.vim/plugin/zshfe.zsh") | endif
7
8 function! s:zshfe(query, opencmd)
9     silent let result = systemlist(g:zshfe_path . " " . a:query)
10     if len(result) == 0 | return | endif
11     exec a:opencmd . " " . result[0][:-2]
12 endfunction
13
14 command! -nargs=1 Fe call s:zshfe(<f-args>, "edit")
15 command! -nargs=1 Fsp call s:zshfe(<f-args>, "split")
16 command! -nargs=1 Fvs call s:zshfe(<f-args>, "vsplit")
17
18 nmap <Leader>e :Fe 
19 nmap <Leader><space> :Fsp 
20 nmap <Leader>v :Fvs