I'm making a command that runs tests and opens coverage report for the currently opened file.
nnoremap cov :!vendor/phpunit/phpunit/phpunit --coverage-html \ /tmp/coverage/ test/ && google-chrome /tmp/coverage/<CR>
How do I put the contents of filename register (
%) into the bash command I want to execute?
nnoremap cov :!vendor/phpunit/phpunit/phpunit --coverage-html \ /tmp/coverage/ test/ && google-chrome /tmp/coverage/FILENAME_GOES_HERE<CR>
Also a closer try:
function CoverageHtml(filename) execute '!vendor/phpunit/phpunit/phpunit' '--coverage-html' '/tmp/coverage/' 'test/' let f = "/tmp/coverage" + a:filename execute '!google-chrome' f endfunction function CoverageHtmlInit() "fails in the next line. let fn = :echo @% return CoverageHtml(fn) endfunction nnoremap cov :call CoverageHtmlInit()