When I go to command mode and type
:!mycommand %
I get my command executed on the current file (% is expanded to the current
%
Get the name of the current file http://vim.wikia.com/wiki/Get_the_name_of_the_current_file
Set_working_directory_to_the_current_file http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file