I have the following code in a vim file that it's auto sourced when editing php files. But I can't make it work.
"PHP config
if !exists("g:addPath")
let g:addPath = 1
let $PATH=$PATH.';C:\Program Files\Mozilla Firefox'
endif
function! MakeThisUrl()
let s:url='http://localhost/'
let s:url=s:url. expand('%')
return s:url
endfunction
function! MakeCustomUrl()
let s:url='http://localhost/'
let s:url=s:url. expand('%:p')
return s:url
endfunction
map <F9> :w<CR>:!firefox -new-tab MakeThisUrl()<CR>
map <F10> :!firefox -new-tab call MakeCustomUrl()
imap <F9> <Esc>:w<CR>:!firefox -new-tab MakeThisUrl()<CR><CR>
imap <F10> <Esc>:!firefox -new-tab call MakeCustomUrl()
The idea is to make vim to auto generate the proper URL, so I can test the code just by presing F9. However, I can't make it execute MakeThisUrl() and all I get its
:!firefox -new-tab MakeThisUrl() <CR><CR>
instead of
:!firefox -new-tab http://localhost/filename.php <CR><CR>
Any ideas on how to make it work? Thanks in advance