vim - how to use environment variable in autocommand -
win7x32 gvim 7.4
i want call batch file in response vimleave event.
if autocommand looks this:
au vimleave * !c:\users\sauron\vimfiles\cleansession.cmd
it works expected.
want replace 'c:\users\sauron' '~' or '$home' or similar, have not gotten work. have tried:
au vimleave * !$home\vimfiles\cleansession.cmd au vimleave * !%home%\vimfiles\cleansession.cmd au vimleave * !~\vimfiles\cleansession.cmd
the '%' expanded containing file's name.
$home doesn't expanded. have tried quoting path, , not.
overlooking?
--
exec 'au vimleave * !' . fnameescape($home . '/vimfiles/cleansession.cmd')
welcome wonderful world of vim command mode syntax. :)
Comments
Post a Comment