> Then you filter it.
>
> In any case what you write doesn't make sense to me because you usually
> call functions this way:
>
> command -nargs=1 -complete=file Archive :call Archive(<f-args>)
>
Yes mark. This is my func
function! Archive(folderOrfilePath)
" Verify existence of 7zip or Win rar"
let pathOf7z = "c:\\Program\ Files\\7-Zip\\7z.exe"
let pathOfWinrar = "c:\\program\ files\\WinRar\\WinRar.exe"
if ( filereadable(pathOf7z) )
let s:pathToArchiverTool = pathOf7z
""pathOf7z
elseif ( filereadable(pathOf7z) )
let s:pathToArchiverTool = pathOfWinrar
else
call EchoAndWait("Neither 7zip and Winrar are installed on your
computer.",2000)
return 0
endif
" name of folder or file we want to archive
let folderOrFileName=fnamemodify(a:folderOrfilePath, ":t")
"
let folderOrFileUnixPath=fnamemodify(a:folderOrfilePath, ":p:gs?\\?
\/?")
" echo "Unix path:".folderOrFileUnixPath
" move to the parent dir
let pathToMoveTo = join(split(folderOrFileUnixPath, "/")
[0:-2],"/")."/"
exe "cd ".pathToMoveTo
if ( isdirectory( a:folderOrfilePath) )
let archiveName = strftime("%Y_%m_%d__%H_%M_
%S")."_".folderOrFileName
if ( s:pathToArchiverTool == pathOf7z )
let cmd = "!\"".s:pathToArchiverTool."\" a ".archiveName.".7z -r
".folderOrFileName."\\"
"exe "".cmd
echo cmd
else
endif
else
endif
endfunction
command! -nargs=1 ARCHIV call Archive(<args>)
This func aims to archive one folder or file with sevenzip or winrar.
I would like to call this func with the same way that FuzzyFinder
works.
Not like that :ARCHIVE "c:/mydirToArchive"
But with a proposal list like omnifunc do in FuzzyFinder.
I would just type:
:ARCHIVDIR then...
a list appears to search dir or file into my system like FufFile do.
c:/program files
c:/users
c:/temp
.......
and then I can auto complete until finding the good dir and launch my
func ARCHIV on it.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment