On Thu, Dec 11, 2014 at 12:10 PM, Joydeep Chakrabarty <[email protected]
> wrote:

> ...



> Thanks for your interesting tips. I forgot to mention I am working on Linux
> Mint 64-bit laptop. So I just changed "iexplorer.exe" to firefox.
> But when I used the tip - "nnoremap <silent> <C-F5> :if expand('%:p:h') !=
> ""<CR>:! firefox %:p<CR>:endif<CR><CR>", it sent "firefox
> /home/username/public_html/current_directory/program1.php" and it didn't
> work. As I said in my earlier post I am using Php. So I have to sent
> "http://localhost/current_directory/program1.php"; to firefox.
> I could use ":!firefox http://localhost/current_directory/%";. But in that
> case I have to write current_directory every time.
> I need a general way to get the path from after localhost(= ~/public_html)
> to filename.php ( = %).
>

You just have to use an extra substitution command (and probably an execute
statement).

I think this should work for you.

nnoremap <silent> <C-F5> :if expand('%:p:h') != ""<CR>:exec ":! firefox "
. substitute(expand('%:p'), '\/home\/username\/public_html', '
http://localhost', '')<CR>:endif<CR>

You can replace :exec with :echomsg and see what will happen.

Dave

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to