]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/pack/stargrave/start/zshfe/plugin/zshfe.vim
Move to vim9script
[dotfiles.git] / vim / .vim / pack / stargrave / start / zshfe / plugin / zshfe.vim
index d85d531e07fb230ade35bc5a07d46d6613ee4fee..cb05d99e930bf5d390446f5b1866e2a01e54c379 100644 (file)
@@ -1,21 +1,17 @@
-" zsh file completion caller
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
+vim9script
 
-if exists("*<SID>zshfe") | finish | endif
+# zsh file completion caller
+# Maintainer: Sergey Matveev <stargrave@stargrave.org>
+# License: GNU General Public License version 3 of the License or later
+
+if exists("*zshfe#Do") | finish | endif
 if !exists("g:zshfe_path")
-    let g:zshfe_path=expand("<sfile>:p:h") . "/zshfe.zsh"
+    g:zshfe_path = expand("<sfile>:p:h") .. "/zshfe.zsh"
 endif
 
-function! s:zshfe(query, opencmd)
-    silent let result = systemlist(g:zshfe_path . " " . a:query)
-    if len(result) == 0 | return | endif
-    exec a:opencmd . " " . result[0][:-2]
-endfunction
-
-command! -nargs=1 Fe call s:zshfe(<f-args>, "edit")
-command! -nargs=1 Fsp call s:zshfe(<f-args>, "split")
-command! -nargs=1 Fvs call s:zshfe(<f-args>, "vsplit")
+command! -nargs=1 Fe call zshfe#Do(<f-args>, "edit")
+command! -nargs=1 Fsp call zshfe#Do(<f-args>, "split")
+command! -nargs=1 Fvs call zshfe#Do(<f-args>, "vsplit")
 
 nmap <Leader>e :Fe 
 nmap <Leader><space> :Fsp