I'm trying to pass a command to 'vim-tmux-runner' on each file save with au
bellow.
autocmd FileWritePost,BufWritePost *.py :VtrSendCommandToRunner python manage.py test <afile>:p:h:t
Where:
:VtrSendCommandToRunner
sends a command to shell in another tmux panepython manage.py test
is the actual command being sent to shell<afile>:p:h:t
and at the end of the command I add a variable that should be expanded to the name of the folder that my file was just saved in.
On each save my shell command tells me that there is no such file as <afile>:p:h:t
so as I understand vim did not expand those variables.
Before I added :VtrSendCommandToRunner
(originally my Ex command started with :!
) my Ex command was expanded correctly.
I tried to rewrite that Ex command in couple other ways but I can't get anything to work.
Some versions of Ex command that I tried(all failed me):
<afile>:p:h:t
%:p:h:t
expand(%:p:h:t)
How can I get vim to expand %
to a file name then?
execute()
. – Tumbler41 Apr 25 '18 at 18:27expand()
. – Christian Brabandt Apr 25 '18 at 18:30'%:p:h:t'
. I can't getexecute
to work. – Tumbler41 Apr 27 '18 at 15:37