Wednesday, December 10, 2014

Re: VIM PHP



On Wed, Dec 10, 2014 at 2:47 PM, Joydeep Chakrabarty <chalao.adda@gmail.com> wrote:
Hello,

I am writing Php programs in Vim. My programs are in ~/public_html/test
directory. When I run the program from web server, I write
http://localhost/test/program1.php.
I need a short cut so that it opens Firefox and replaces
"~/public_html/current_directory/filename" to
"http://localhost/current_directory/filename".



Any of these will help you.
Just simply modify one of the ones that is closest to your needs.

You would just have to add some extra substitutes for the path name that launches.


if has("win32")
    " Open the folder containing the currently open file. Double <CR> at end
    " is so you don't have to hit return after command. Double quotes are
    " not necessary in the 'explorer.exe %:p:h' section.
    nnoremap <silent> <C-F5> :if expand("%:p:h") != ""<CR>:!start explorer.exe %:p:h<CR>:endif<CR><CR>

    " This command will execute the file, for example, if this is an HTML
    " file, it will run:
    "     start c:\absolute\filename.html
    nnoremap <silent> <C-F6> :let old_reg=@"<cr>:let @"=substitute(expand("%:p"), "/", "\\", "g")<cr>:silent!!cmd /cstart <C-R><C-R>"<CR><CR>:let @"=old_reg<cr>

    " Visually select something and run it
    " This can be anything you run from a command prompt like
    " notepad dave.txt
    " dave.txt
    "
    " This one does not work if there are multiple parameters
    " vmap <silent> <C-F5> :<C-U>let old_reg=@"<cr>gvy:silent!!start rundll32 url.dll,FileProtocolHandler <C-R><C-R>"<CR><CR>:let @"=old_reg<cr>
    " This one works in all cases, but a cmd window flashes
    vnoremap <silent> <C-F5> :<C-U>let old_reg=@"<cr>gvy:silent!!cmd /cstart <C-R><C-R>"<CR><CR>:let @"=old_reg<cr>

    " Look up the dictionary/meaning of the word under the cursor
    " Alternative:
    "      nmap \l :silent !start "c:\program files\internet explorer\iexplore.exe" -nohome "http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=<cword>"<CR>;
    nnoremap <silent> <C-F2> :silent!!cmd /cstart http://dictionary.reference.com/search?q=<cWORD><CR>
endif





HTH,
David
 

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment