it_is_a_literature it_is_a_literature - 1 year ago 50
PHP Question

Why firefox can't open to parse my php in vim?

A simple php file was edited in /var/www/html/tmp/test.php.

echo "test";

To open it in firefox with firefox.

enter image description here

F12 was mapped to execute firefox to parse php file in the /etc/vim/vimrc.

nmap <F12>f :!firefox ''<CR>

Now to vim /var/www/html/tmp/test.php and press F12.

An ncredible reaction happened.

1.firefox was not called at all. was open to react,wrong result.

enter image description here

Answer Source

I can see at least a couple of things wrong.

One, the mapping you wrote is <F12>f which would be F12 and then the letter F.

Two, % expands the relative path to the file, in this case /var/www/html/tmp/test.php as you're executing vim from the home directory. The expansion you're looking for is actually %:t

:help expand